/// <summary> /// Look for this table's primary key in the route values (i.e. typically the query string). /// If they're all found, return a DataKey containing the primary key values. Otherwise return null. /// </summary> public DataKey GetDataKeyFromRoute() { var queryStringKeys = new OrderedDictionary(PrimaryKeyNames.Length); foreach (MetaColumn key in PrimaryKeyColumns) { // Try to find the PK in the route values. If any PK is not found, return null string value = Misc.GetRouteValue(key.Name); if (string.IsNullOrEmpty(value)) { return(null); } queryStringKeys[key.Name] = Misc.ChangeType(value, key.ColumnType); } return(new DataKey(queryStringKeys, PrimaryKeyNames)); }