Beispiel #1
0
        internal override bool ParseSingleElement(ICollection <XName> unprocessedElements, XElement elem)
        {
            // EntityContainer elements are treated differently depending
            // whether we are in an SSDL EntityModel or a CSDL EntityModel
            // so do not include here

            if (elem.Name.LocalName == EntityType.ElementName)
            {
                EntityType et = null;
                if (IsCSDL)
                {
                    et = new ConceptualEntityType(this as ConceptualEntityModel, elem);
                }
                else
                {
                    et = new StorageEntityType(this as StorageEntityModel, elem);
                }
                _entityTypes.Add(et);
                et.Parse(unprocessedElements);
            }
            else if (elem.Name.LocalName == Association.ElementName)
            {
                var assoc = new Association(this, elem);
                _associations.Add(assoc);
                assoc.Parse(unprocessedElements);
            }
            else
            {
                return(base.ParseSingleElement(unprocessedElements, elem));
            }
            return(true);
        }
        /// <summary>
        ///     Return true if the input is the base entity type of the instance.
        /// </summary>
        /// <param name="baseType"></param>
        /// <returns></returns>
        internal bool IsDerivedFrom(ConceptualEntityType baseEntityType)
        {
            if (!HasResolvableBaseType)
            {
                return(false);
            }

            return((from type in ResolvableBaseTypes
                    where type == baseEntityType
                    select type).Count <EntityType>() > 0);
        }