예제 #1
0
        internal static CsdlEntityType EntityType(
            string name,
            string baseName                   = null,
            bool isAbstract                   = false,
            bool isOpen                       = false,
            bool hasStream                    = false,
            CsdlKey csdlKey                   = null,
            CsdlProperty[] properties         = default(CsdlProperty[]),
            CsdlNavigationProperty[] navProps = default(CsdlNavigationProperty[]),
            CsdlLocation location             = null)
        {
            if (properties == null)
            {
                properties = new CsdlProperty[] { };
            }

            if (navProps == null)
            {
                navProps = new CsdlNavigationProperty[] { };
            }

            return(new CsdlEntityType(
                       name,
                       baseName,
                       isAbstract,
                       isOpen,
                       hasStream,
                       csdlKey,
                       properties,
                       navProps,
                       location));
        }
예제 #2
0
        private CsdlEntityType OnEntityTypeElement(XmlElementInfo element, XmlElementValueCollection childValues)
        {
            string name       = Required(CsdlConstants.Attribute_Name);
            string baseType   = OptionalQualifiedName(CsdlConstants.Attribute_BaseType);
            bool   isOpen     = OptionalBoolean(CsdlConstants.Attribute_OpenType) ?? CsdlConstants.Default_OpenType;
            bool   isAbstract = OptionalBoolean(CsdlConstants.Attribute_Abstract) ?? CsdlConstants.Default_Abstract;
            bool   hasStream  = OptionalBoolean(CsdlConstants.Attribute_HasStream) ?? CsdlConstants.Default_HasStream;

            CsdlKey key = childValues.ValuesOfType <CsdlKey>().FirstOrDefault();

            return(new CsdlEntityType(name, baseType, isAbstract, isOpen, hasStream, key, childValues.ValuesOfType <CsdlProperty>(), childValues.ValuesOfType <CsdlNavigationProperty>(), element.Location));
        }