public void Deploy(MetaEntityClass _entityClass, IDataMiningTypeProvider typeProvider) { entityClass = _entityClass; type = typeProvider.GetTypeByName(definition.ObjectTypeName); // map = new TypePropertyMap(type, entityClass, definition.mapDefinition, typeProvider); }
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); } } }
// public Dictionary<MetaEntityClass, TypedObjectProvider> ObjectProviderByClassNamepath { get; set; } = new Dictionary<MetaEntityClass, TypedObjectProvider>(); public TypedObjectProvider GetProviderForEntityClass(MetaEntityClass entityClass) { TypedObjectProvider output = null; foreach (var provider in ObjectProviders) { if (provider.entityClass == entityClass) { if (output == null) { output = provider; } else { if (provider.IsPrimary) { output = provider; } } } } return(output); }
// MetaTablePropertyAliasList UIDMetaProperties = new MetaTablePropertyAliasList(); //public MetaTableProperty GetUIDMetaProperty(MetaTablePropertyCollection metaProperties) //{ // MetaTableProperty output = null; // foreach (var ae in UIDMetaProperties.items) // { // output = metaProperties.Get(ae.rootPropertyName, UIDMetaProperties); // if (output != null) break; // } // return output; //} public TypePropertyMap(Type _type, MetaEntityClass schema, TypePropertyMapDefinition definition, IDataMiningTypeProvider typeProvider) { type = _type; typeProvider = typeProvider; var prop = type.GetProperties(BindingFlags.Public | BindingFlags.Instance).ToDictionary(x => x.Name); List <MetaTableProperty> taskProperties = new List <MetaTableProperty>(); foreach (TypePropertyMapDefinitionItem item in definition.items) { if (!prop.ContainsKey(item.typePropertyName)) { continue; } var schemaProperty = schema.FindProperty(item.metaPropertyName); if (schemaProperty == null) { continue; } var pi = prop[item.typePropertyName]; if (schema.namePropertyName == schemaProperty.PropertyName) { TypeUIDProperty = pi; } propertyLinkABs.Add(schemaProperty, pi); propertyLinkBAs.Add(pi, schemaProperty); } }