public EntityMapping(EntityMappingConfiguration configuration, IEnumerable<MapMappingConfiguration> maps, KeyMappingConfiguration key) { var keyMaps = key.Keys.Select(x => new MapMapping(x)).ToArray(); Maps = maps.Where(x => !key.Keys.Contains(x)).Select(x => new MapMapping(x)).Union(keyMaps).ToArray(); Key = key; TableName = configuration.TableName; Type = configuration.Type; InterceptList = Maps.Select(x => x.Property.GetMethod) .Union(Maps.Where(x => x.Property.CanWrite).Select(x => x.Property.SetMethod)) .ToArray(); InterceptDictionary = Maps.Select(x => new {Method = x.Property.GetMethod, x}) .Union(Maps.Where(x => x.Property.CanWrite).Select(x => new {Method = x.Property.SetMethod, x})) .ToDictionary(x => x.Method, x => x.x); InterceptPropertyDictionary = Maps.ToDictionary(x => x.Property, x => x); }
public EntityMapping(EntityMappingConfiguration configuration, IEnumerable <MapMappingConfiguration> maps, KeyMappingConfiguration key) { var keyMaps = key.Keys.Select(x => new MapMapping(x)).ToArray(); Maps = maps.Where(x => !key.Keys.Contains(x)).Select(x => new MapMapping(x)).Union(keyMaps).ToArray(); Key = key; TableName = configuration.TableName; Type = configuration.Type; InterceptList = Maps.Select(x => x.Property.GetMethod) .Union(Maps.Where(x => x.Property.CanWrite).Select(x => x.Property.SetMethod)) .ToArray(); InterceptDictionary = Maps.Select(x => new { Method = x.Property.GetMethod, x }) .Union(Maps.Where(x => x.Property.CanWrite).Select(x => new { Method = x.Property.SetMethod, x })) .ToDictionary(x => x.Method, x => x.x); InterceptPropertyDictionary = Maps.ToDictionary(x => x.Property, x => x); }
public virtual void OnKey(KeyMappingConfiguration mapping) { }