internal static IPropertyMapping BuildExplicitMappings <TEntity>( this IEntityContext entityContext, Action <IExplicitMappingsBuilder <TEntity> > mappingsBuilder, Iri owningEntity, bool allowSinglePropertyOnly = false) where TEntity : IEntity { var builder = new DefaultExplicitMappingsBuilder <TEntity>(QIriMappings, allowSinglePropertyOnly); mappingsBuilder(builder); var mappingProviders = new List <ITermMappingProvider>(); mappingProviders.AddClasses(builder); mappingProviders.AddCollections(builder); mappingProviders.AddProperties(builder); IPropertyMapping propertyMapping; ExplicitMappings[entityContext].Set(mappingProviders.BuildMapping <TEntity>(out propertyMapping), owningEntity); return(propertyMapping); }
internal static void AddProperties(this ICollection <ITermMappingProvider> mappingProviders, Type entityType, DefaultExplicitMappingsBuilder builder) { foreach (var property in builder.Properties) { var propertyMappingProvider = new FluentPropertyMappingProvider( entityType, property.Key, property.Value.Item1, property.Value.Item3, property.Value.Item2); mappingProviders.Add(propertyMappingProvider); } }
internal static void AddCollections(this ICollection <ITermMappingProvider> mappingProviders, Type entityType, DefaultExplicitMappingsBuilder builder) { foreach (var collection in builder.Collections) { var collectionMappingProvider = new FluentCollectionMappingProvider( entityType, collection.Key, collection.Value.Item1, collection.Value.Item3, collection.Value.Item4, collection.Value.Item2); mappingProviders.Add(collectionMappingProvider); } }
internal static void AddClasses(this ICollection <ITermMappingProvider> mappingProviders, Type entityType, DefaultExplicitMappingsBuilder builder) { foreach (var @class in builder.Classes) { mappingProviders.Add(new FluentEntityMappingProvider(entityType, @class.Item1, @class.Item2)); } }
private static void AddProperties <TEntity>(this ICollection <ITermMappingProvider> mappingProviders, DefaultExplicitMappingsBuilder <TEntity> builder) where TEntity : IEntity { mappingProviders.AddProperties(typeof(TEntity), builder); }
public void Setup() { Builder = new DefaultExplicitMappingsBuilder <IProduct>(); ScenarioSetup(); TheTest(); }