protected void AddObjectProvider(IObjectProvider provider) { if (provider != null) { ObjectProviders.Add(provider); } }
public TypedObjectWorkshop(MetaEntityNamespaceCollection namespaces, TypedObjectWorkshopSettings workshopSettings, IDataMiningTypeProvider typeProvider) { Namespaces = namespaces; TypeProvider = typeProvider; foreach (TypedObjectProviderDefinition provider in workshopSettings.providers) { TypedObjectProvider provider_instance = new TypedObjectProvider(provider); MetaEntityClass entityClass = Namespaces.FindClass(provider.EntityClassNamePath); provider_instance.Deploy(entityClass, typeProvider); ObjectProviders.Add(provider_instance); } foreach (TypedObjectProvider provider in ObjectProviders) { foreach (TypePropertyMapDefinitionItem itemDefinition in provider.map.items) { PropertyInfo pi = provider.type.GetProperty(itemDefinition.typePropertyName); TypePropertyMapItem mapItem = new TypePropertyMapItem() { metaPropertyName = itemDefinition.metaPropertyName, typePropertyName = itemDefinition.typePropertyName, propertyInfo = pi }; //var IListInterface = pi.PropertyType.GetInterface("IList"); //Type[] GenericArguments = pi.PropertyType.GetGenericArguments(); //if (GenericArguments.Any()) //{ //} TypedObjectProvider subentity_provider = GetProviderForType(pi.PropertyType); mapItem.TypeProvider = subentity_provider; IMetaEntityExpressionTarget metaTarget = provider.entityClass.SelectTargetByPath(itemDefinition.metaPropertyName); if (metaTarget is MetaEntityClassProperty metaProperty) { mapItem.metaProperty = metaProperty; } if (itemDefinition.converter != null) { IPropertyItemConverter mapConverter = itemDefinition.converter.GetConverter(pi); mapItem.converter = mapConverter; } provider.items.Add(mapItem); } } }