private void MapProperites( MappingType type, Func <string, bool> filter, IDictionary <string, string> args, Action <string, string> a) { var parameters = m_config.GetProperties().Where(p => p.UrlMapType == type); foreach (var p in parameters) { string valueStr = String.Empty; if (args.ContainsKey(p.Name)) { valueStr = args[p.Name]; } if ((filter != null) && filter(valueStr)) { continue; } a(p.MappingName, valueStr); } }
private void CheckUriProperties(RestEntityConfigurationBase config) { var props = config.GetProperties(); bool hasPrimaryKey = false; var mappingNames = new HashSet <string>(); foreach (var p in props) { hasPrimaryKey |= p.IsPrimaryKey; // TODO: This check should be in the RestEntityConfiguration if (mappingNames.Contains(p.MappingName)) { string msg = String.Format( "The mapping '{0}' has been mapped to more than one property.", p.MappingName); throw new Exception(msg); } mappingNames.Add(p.MappingName); } if (!hasPrimaryKey) { string msg = String.Format("No primary key(s) defined for type {0}", config.GetBaseType().FullName); throw new Exception(msg); } }