Example #1
0
        internal override bool ResolveNameAndSetTypeUsage(
            Converter.ConversionCache convertedItemCache, Dictionary <SchemaElement, GlobalItem> newGlobalItems)
        {
            if (_typeUsage == null)
            {
                if (_typeSubElement != null) //Has sub-elements
                {
                    return(_typeSubElement.ResolveNameAndSetTypeUsage(convertedItemCache, newGlobalItems));
                }
                else //Does not have sub-elements; try to resolve
                {
                    if (_type is ScalarType) //Create and store type usage for scalar type
                    {
                        _typeUsageBuilder.ValidateAndSetTypeUsage(_type as ScalarType, false);
                        _typeUsage = TypeUsage.Create(new CollectionType(_typeUsageBuilder.TypeUsage));
                        return(true);
                    }
                    else //Try to resolve edm type. If not now, it will resolve in the second pass
                    {
                        var edmType =
                            (EdmType)Converter.LoadSchemaElement(_type, _type.Schema.ProviderManifest, convertedItemCache, newGlobalItems);
                        if (edmType != null)
                        {
                            _typeUsageBuilder.ValidateAndSetTypeUsage(edmType, false); //use typeusagebuilder so dont lose facet information
                            _typeUsage = TypeUsage.Create(new CollectionType(_typeUsageBuilder.TypeUsage));
                        }

                        return(_typeUsage != null);
                    }
                }
            }
            return(true);
        }
        //



        internal void EnsureEnumTypeFacets(Converter.ConversionCache convertedItemCache, Dictionary <SchemaElement, GlobalItem> newGlobalItems)
        {
            Debug.Assert(Type is SchemaEnumType);
            EdmType propertyType = (EdmType)Converter.LoadSchemaElement(Type, Type.Schema.ProviderManifest, convertedItemCache, newGlobalItems);

            _typeUsageBuilder.ValidateAndSetTypeUsage(propertyType, false);//use typeusagebuilder so dont lose facet information
        }
Example #3
0
        internal override bool ResolveNameAndSetTypeUsage(
            Converter.ConversionCache convertedItemCache,
            Dictionary <SchemaElement, GlobalItem> newGlobalItems)
        {
            if (this._typeUsage != null)
            {
                return(true);
            }
            if (this._typeSubElement != null)
            {
                return(this._typeSubElement.ResolveNameAndSetTypeUsage(convertedItemCache, newGlobalItems));
            }
            if (this._type is ScalarType)
            {
                this._typeUsageBuilder.ValidateAndSetTypeUsage(this._type as ScalarType, false);
                this._typeUsage = TypeUsage.Create((EdmType) new CollectionType(this._typeUsageBuilder.TypeUsage));
                return(true);
            }
            EdmType edmType = (EdmType)Converter.LoadSchemaElement(this._type, this._type.Schema.ProviderManifest, convertedItemCache, newGlobalItems);

            if (edmType != null)
            {
                this._typeUsageBuilder.ValidateAndSetTypeUsage(edmType, false);
                this._typeUsage = TypeUsage.Create((EdmType) new CollectionType(this._typeUsageBuilder.TypeUsage));
            }
            return(this._typeUsage != null);
        }
Example #4
0
 internal bool ResolveNestedTypeNames(Converter.ConversionCache convertedItemCache, Dictionary <Som.SchemaElement, GlobalItem> newGlobalItems)
 {
     if (_typeSubElement == null)
     {
         return(false);
     }
     return(_typeSubElement.ResolveNameAndSetTypeUsage(convertedItemCache, newGlobalItems));
 }
Example #5
0
        internal override bool ResolveNameAndSetTypeUsage(
            Converter.ConversionCache convertedItemCache, Dictionary <SchemaElement, GlobalItem> newGlobalItems)
        {
            Debug.Fail(
                "This method was not called from anywhere in the code before. If you got here you need to update this method and possibly ResolveNestedTypeNames()");

            return(false);
        }
Example #6
0
 internal override bool ResolveNameAndSetTypeUsage(
     Converter.ConversionCache convertedItemCache,
     Dictionary <SchemaElement, GlobalItem> newGlobalItems)
 {
     if (this._typeUsage == null)
     {
         RefType refType = new RefType((EdmType)Converter.LoadSchemaElement(this._type, this._type.Schema.ProviderManifest, convertedItemCache, newGlobalItems) as System.Data.Entity.Core.Metadata.Edm.EntityType);
         refType.AddMetadataProperties(this.OtherContent);
         this._typeUsage = TypeUsage.Create((EdmType)refType);
     }
     return(true);
 }
Example #7
0
        internal override bool ResolveNameAndSetTypeUsage(Converter.ConversionCache convertedItemCache, Dictionary <Som.SchemaElement, GlobalItem> newGlobalItems)
        {
            bool result = true;

            if (_typeUsage == null)
            {
                foreach (var property in _properties)
                {
                    if (!property.ResolveNameAndSetTypeUsage(convertedItemCache, newGlobalItems))
                    {
                        result = false;
                    }
                }
            }
            return(result);
        }
        internal override bool ResolveNameAndSetTypeUsage(Converter.ConversionCache convertedItemCache, Dictionary <Som.SchemaElement, GlobalItem> newGlobalItems)
        {
            if (_typeUsage == null)
            {
                Debug.Assert(!(_type is ScalarType));

                EdmType    edmType    = (EdmType)Converter.LoadSchemaElement(_type, _type.Schema.ProviderManifest, convertedItemCache, newGlobalItems);
                EntityType entityType = edmType as EntityType;

                Debug.Assert(entityType != null);

                RefType refType = new RefType(entityType);
                refType.AddMetadataProperties(this.OtherContent);
                _typeUsage = TypeUsage.Create(refType);
            }
            return(true);
        }
Example #9
0
        internal override bool ResolveNameAndSetTypeUsage(
            Converter.ConversionCache convertedItemCache,
            Dictionary <SchemaElement, GlobalItem> newGlobalItems)
        {
            bool flag = true;

            if (this._typeUsage == null)
            {
                foreach (ModelFunctionTypeElement property in this._properties)
                {
                    if (!property.ResolveNameAndSetTypeUsage(convertedItemCache, newGlobalItems))
                    {
                        flag = false;
                    }
                }
            }
            return(flag);
        }
        internal override bool ResolveNameAndSetTypeUsage(Converter.ConversionCache convertedItemCache, Dictionary <Som.SchemaElement, GlobalItem> newGlobalItems)
        {
            if (_type is ScalarType) //Create and store type usage for scalar type
            {
                _typeUsageBuilder.ValidateAndSetTypeUsage(_type as ScalarType, false);
                _typeUsage = _typeUsageBuilder.TypeUsage;
                return(true);
            }
            else  //Try to resolve edm type. If not now, it will resolve in the second pass
            {
                EdmType edmType = (EdmType)Converter.LoadSchemaElement(_type, _type.Schema.ProviderManifest, convertedItemCache, newGlobalItems);
                if (edmType != null)
                {
                    _typeUsageBuilder.ValidateAndSetTypeUsage(edmType, false); //use typeusagebuilder so dont lose facet information
                    _typeUsage = _typeUsageBuilder.TypeUsage;
                }

                return(_typeUsage != null);
            }
        }
Example #11
0
 internal override bool ResolveNameAndSetTypeUsage(
     Converter.ConversionCache convertedItemCache,
     Dictionary <SchemaElement, GlobalItem> newGlobalItems)
 {
     if (this._typeUsage != null)
     {
         return(true);
     }
     if (this._typeSubElement != null)
     {
         return(this._typeSubElement.ResolveNameAndSetTypeUsage(convertedItemCache, newGlobalItems));
     }
     if (this._type is ScalarType)
     {
         this._typeUsageBuilder.ValidateAndSetTypeUsage(this._type as ScalarType, false);
         this._typeUsage = this._typeUsageBuilder.TypeUsage;
     }
     else
     {
         EdmType edmType = (EdmType)Converter.LoadSchemaElement(this._type, this._type.Schema.ProviderManifest, convertedItemCache, newGlobalItems);
         if (edmType != null)
         {
             if (this._isRefType)
             {
                 this._typeUsage = TypeUsage.Create((EdmType) new RefType(edmType as System.Data.Entity.Core.Metadata.Edm.EntityType));
             }
             else
             {
                 this._typeUsageBuilder.ValidateAndSetTypeUsage(edmType, false);
                 this._typeUsage = this._typeUsageBuilder.TypeUsage;
             }
         }
     }
     if (this._collectionKind != CollectionKind.None)
     {
         this._typeUsage = TypeUsage.Create((EdmType) new CollectionType(this._typeUsage));
     }
     return(this._typeUsage != null);
 }
 internal abstract bool ResolveNameAndSetTypeUsage(
     Converter.ConversionCache convertedItemCache, Dictionary <SchemaElement, GlobalItem> newGlobalItems);
Example #13
0
 internal override bool ResolveNameAndSetTypeUsage(
     Converter.ConversionCache convertedItemCache,
     Dictionary <SchemaElement, GlobalItem> newGlobalItems)
 {
     return(false);
 }
Example #14
0
 internal bool ResolveNestedTypeNames(
     Converter.ConversionCache convertedItemCache,
     Dictionary <SchemaElement, GlobalItem> newGlobalItems)
 {
     return(this._typeSubElement.ResolveNameAndSetTypeUsage(convertedItemCache, newGlobalItems));
 }
Example #15
0
 internal bool ResolveNestedTypeNames(
     Converter.ConversionCache convertedItemCache, Dictionary <SchemaElement, GlobalItem> newGlobalItems)
 {
     Debug.Assert(_typeSubElement != null, "Nested type expected.");
     return(_typeSubElement.ResolveNameAndSetTypeUsage(convertedItemCache, newGlobalItems));
 }
Example #16
0
 internal void EnsureEnumTypeFacets(
     Converter.ConversionCache convertedItemCache,
     Dictionary <SchemaElement, GlobalItem> newGlobalItems)
 {
     this._typeUsageBuilder.ValidateAndSetTypeUsage((EdmType)Converter.LoadSchemaElement(this.Type, this.Type.Schema.ProviderManifest, convertedItemCache, newGlobalItems), false);
 }