protected virtual IEnumerable <EntityModel> BuildEntityModels() { var classToEntityAnalyzer = new ClassToEntityIntersectionAnalyzer( ClassToEntityCandidateSources, ClassToEntityRules ); var modelToTypeAnalyzer = new DefaultIntersectionAnalyzer <EntityModel, EntityField, TypeModel, PropertyInfoField>( EntityToTypeCandidateSources, EntityToTypeRules ); foreach (var entityDefinition in EntityDefinitions) { yield return(BuildEntityModel(classToEntityAnalyzer, modelToTypeAnalyzer, entityDefinition)); } }
private static MappingStore MappingStoreFactory(IServiceProvider serviceProvider) { var typeConverters = serviceProvider.GetService <IEnumerable <ITypeConverter> >()?.ToArray(); var mappingOptions = serviceProvider.GetRequiredService <IOptions <MappingOptions> >().Value; var analyzer = new DefaultIntersectionAnalyzer <TypeModel, PropertyInfoField, TypeModel, PropertyInfoField>( mappingOptions.IntersectCandidateSources, mappingOptions.IntersectionRules ); if (typeConverters != null && typeConverters.Length > 0) { analyzer.AddTypeConverters(typeConverters); } return(new MappingStore(analyzer)); }