Exemple #1
0
        private IEdmEntityType AddEntityType(ResourceType resourceType, string resourceTypeNamespace)
        {
            Action <MetadataProviderEdmEntityType> propertyLoadAction = delegate(MetadataProviderEdmEntityType type) {
                IEnumerable <ResourceProperty> allVisiblePropertiesDeclaredInThisType = this.GetAllVisiblePropertiesDeclaredInThisType(resourceType);
                if (allVisiblePropertiesDeclaredInThisType != null)
                {
                    foreach (ResourceProperty property in allVisiblePropertiesDeclaredInThisType)
                    {
                        IEdmProperty property2 = this.CreateProperty(type, property);
                        if (property.IsOfKind(ResourcePropertyKind.Key))
                        {
                            type.AddKeys(new IEdmStructuralProperty[] { (IEdmStructuralProperty)property2 });
                        }
                    }
                }
            };
            MetadataProviderEdmEntityType schemaType = new MetadataProviderEdmEntityType(resourceTypeNamespace, resourceType.Name, (resourceType.BaseType != null) ? ((IEdmEntityType)this.EnsureSchemaType(resourceType.BaseType)) : null, resourceType.IsAbstract, resourceType.IsOpenType, propertyLoadAction);

            this.CacheSchemaType(schemaType);
            if (resourceType.IsMediaLinkEntry && ((resourceType.BaseType == null) || !resourceType.BaseType.IsMediaLinkEntry))
            {
                this.SetHasDefaultStream(schemaType, true);
            }
            if (resourceType.HasEntityPropertyMappings)
            {
                MetadataProviderUtils.ConvertEntityPropertyMappings(this, resourceType, schemaType);
            }
            MetadataProviderUtils.ConvertCustomAnnotations(this, resourceType.CustomAnnotations, schemaType);
            return(schemaType);
        }
 private IEdmEntityType AddEntityType(ResourceType resourceType, string resourceTypeNamespace)
 {
     Action<MetadataProviderEdmEntityType> propertyLoadAction = delegate (MetadataProviderEdmEntityType type) {
         IEnumerable<ResourceProperty> allVisiblePropertiesDeclaredInThisType = this.GetAllVisiblePropertiesDeclaredInThisType(resourceType);
         if (allVisiblePropertiesDeclaredInThisType != null)
         {
             foreach (ResourceProperty property in allVisiblePropertiesDeclaredInThisType)
             {
                 IEdmProperty property2 = this.CreateProperty(type, property);
                 if (property.IsOfKind(ResourcePropertyKind.Key))
                 {
                     type.AddKeys(new IEdmStructuralProperty[] { (IEdmStructuralProperty) property2 });
                 }
             }
         }
     };
     MetadataProviderEdmEntityType schemaType = new MetadataProviderEdmEntityType(resourceTypeNamespace, resourceType.Name, (resourceType.BaseType != null) ? ((IEdmEntityType) this.EnsureSchemaType(resourceType.BaseType)) : null, resourceType.IsAbstract, resourceType.IsOpenType, propertyLoadAction);
     this.CacheSchemaType(schemaType);
     if (resourceType.IsMediaLinkEntry && ((resourceType.BaseType == null) || !resourceType.BaseType.IsMediaLinkEntry))
     {
         this.SetHasDefaultStream(schemaType, true);
     }
     if (resourceType.HasEntityPropertyMappings)
     {
         MetadataProviderUtils.ConvertEntityPropertyMappings(this, resourceType, schemaType);
     }
     MetadataProviderUtils.ConvertCustomAnnotations(this, resourceType.CustomAnnotations, schemaType);
     return schemaType;
 }