MetaTable.GetPrimaryKeyDictionary Method (Object)

.NET Framework (current version)

Retrieves a dictionary of primary-key names and values for the specified row.

Namespace:   System.Web.DynamicData
Assembly:  System.Web.DynamicData (in System.Web.DynamicData.dll)

public IDictionary<string, object> GetPrimaryKeyDictionary(
	object row


Type: System.Object

A row.

Return Value

Type: System.Collections.Generic.IDictionary<String, Object>

A dictionary of primary-key names and values.

The following example shows how to create a primary-key dictionary.

private RouteValueDictionary GetRouteValues(MetaTable table, object row) {
    RouteValueDictionary routeValues = GetRouteValues();
    foreach (var pk in table.GetPrimaryKeyDictionary(row)) {
        routeValues[pk.Key] = pk.Value;
    return routeValues;

.NET Framework
Available since 4.0
Return to top