private static EntityContainer ConvertToEntityContainer(
            System.Data.Entity.Core.SchemaObjectModel.EntityContainer element,
            DbProviderManifest providerManifest,
            Converter.ConversionCache convertedItemCache,
            Dictionary <SchemaElement, GlobalItem> newGlobalItems)
        {
            EntityContainer entityContainer = new EntityContainer(element.Name, Converter.GetDataSpace(providerManifest));

            newGlobalItems.Add((SchemaElement)element, (GlobalItem)entityContainer);
            foreach (EntityContainerEntitySet entitySet in element.EntitySets)
            {
                entityContainer.AddEntitySetBase((EntitySetBase)Converter.ConvertToEntitySet(entitySet, providerManifest, convertedItemCache, newGlobalItems));
            }
            foreach (EntityContainerRelationshipSet relationshipSet in element.RelationshipSets)
            {
                entityContainer.AddEntitySetBase((EntitySetBase)Converter.ConvertToAssociationSet(relationshipSet, providerManifest, convertedItemCache, entityContainer, newGlobalItems));
            }
            foreach (System.Data.Entity.Core.SchemaObjectModel.Function functionImport in element.FunctionImports)
            {
                entityContainer.AddFunctionImport(Converter.ConvertToFunction(functionImport, providerManifest, convertedItemCache, entityContainer, newGlobalItems));
            }
            if (element.Documentation != null)
            {
                entityContainer.Documentation = Converter.ConvertToDocumentation(element.Documentation);
            }
            Converter.AddOtherContent((SchemaElement)element, (MetadataItem)entityContainer);
            return(entityContainer);
        }
        internal static MetadataItem LoadSchemaElement(
            System.Data.Entity.Core.SchemaObjectModel.SchemaType element,
            DbProviderManifest providerManifest,
            Converter.ConversionCache convertedItemCache,
            Dictionary <SchemaElement, GlobalItem> newGlobalItems)
        {
            GlobalItem globalItem;

            if (newGlobalItems.TryGetValue((SchemaElement)element, out globalItem))
            {
                return((MetadataItem)globalItem);
            }
            System.Data.Entity.Core.SchemaObjectModel.EntityContainer element1 = element as System.Data.Entity.Core.SchemaObjectModel.EntityContainer;
            if (element1 != null)
            {
                return((MetadataItem)Converter.ConvertToEntityContainer(element1, providerManifest, convertedItemCache, newGlobalItems));
            }
            if (element is SchemaEntityType)
            {
                return((MetadataItem)Converter.ConvertToEntityType((SchemaEntityType)element, providerManifest, convertedItemCache, newGlobalItems));
            }
            if (element is Relationship)
            {
                return((MetadataItem)Converter.ConvertToAssociationType((Relationship)element, providerManifest, convertedItemCache, newGlobalItems));
            }
            if (element is SchemaComplexType)
            {
                return((MetadataItem)Converter.ConvertToComplexType((SchemaComplexType)element, providerManifest, convertedItemCache, newGlobalItems));
            }
            if (element is System.Data.Entity.Core.SchemaObjectModel.Function)
            {
                return((MetadataItem)Converter.ConvertToFunction((System.Data.Entity.Core.SchemaObjectModel.Function)element, providerManifest, convertedItemCache, (EntityContainer)null, newGlobalItems));
            }
            if (element is SchemaEnumType)
            {
                return((MetadataItem)Converter.ConvertToEnumType((SchemaEnumType)element, newGlobalItems));
            }
            return((MetadataItem)null);
        }
 // <summary>
 // Constructs an EntityContainerEntitySet
 // </summary>
 // <param name="parentElement"> Reference to the schema element. </param>
 public EntityContainerEntitySet(EntityContainer parentElement)
     : base(parentElement)
 {
 }
示例#4
0
 // <summary>
 // Constructs an EntityContainerAssociationSet
 // </summary>
 // <param name="parentElement"> Reference to the schema element. </param>
 public EntityContainerAssociationSet(EntityContainer parentElement)
     : base(parentElement)
 {
 }
示例#5
0
 public EntityContainerRelationshipSet(EntityContainer parentElement)
     : base((SchemaElement)parentElement, (IDbDependencyResolver)null)
 {
 }
示例#6
0
 // <summary>
 // Constructs an EntityContainerRelationshipSet
 // </summary>
 // <param name="parentElement"> Reference to the schema element. </param>
 public EntityContainerRelationshipSet(EntityContainer parentElement)
     : base(parentElement)
 {
 }
示例#7
0
        private void ValidateOnlyBaseEntitySetTypeDefinesConcurrency()
        {
            Dictionary <SchemaEntityType, EntityContainerEntitySet> baseEntitySetTypes = new Dictionary <SchemaEntityType, EntityContainerEntitySet>();

            foreach (SchemaElement member in this.Members)
            {
                EntityContainerEntitySet containerEntitySet = member as EntityContainerEntitySet;
                if (containerEntitySet != null && !baseEntitySetTypes.ContainsKey(containerEntitySet.EntityType))
                {
                    baseEntitySetTypes.Add(containerEntitySet.EntityType, containerEntitySet);
                }
            }
            foreach (SchemaType schemaType in this.Schema.SchemaTypes)
            {
                SchemaEntityType         itemType = schemaType as SchemaEntityType;
                EntityContainerEntitySet set;
                if (itemType != null && EntityContainer.TypeIsSubTypeOf(itemType, baseEntitySetTypes, out set) && EntityContainer.TypeDefinesNewConcurrencyProperties(itemType))
                {
                    this.AddError(ErrorCode.ConcurrencyRedefinedOnSubTypeOfEntitySetType, EdmSchemaErrorSeverity.Error, (object)Strings.ConcurrencyRedefinedOnSubTypeOfEntitySetType((object)itemType.FQName, (object)set.EntityType.FQName, (object)set.FQName));
                }
            }
        }