/// <summary>
        /// The factory method for constructing the <see cref="T:System.Data.Entity.Core.Metadata.Edm.RowType" /> object.
        /// </summary>
        /// <param name="properties">Properties of the row type object.</param>
        /// <param name="metadataProperties">Metadata properties that will be added to the function. Can be null.</param>
        /// <returns>
        /// A new, read-only instance of the <see cref="T:System.Data.Entity.Core.Metadata.Edm.RowType" /> object.
        /// </returns>
        public static RowType Create(
            IEnumerable <EdmProperty> properties,
            IEnumerable <MetadataProperty> metadataProperties)
        {
            Check.NotNull <IEnumerable <EdmProperty> >(properties, nameof(properties));
            RowType rowType = new RowType(properties);

            if (metadataProperties != null)
            {
                rowType.AddMetadataProperties(metadataProperties.ToList <MetadataProperty>());
            }
            rowType.SetReadOnly();
            return(rowType);
        }
Example #2
0
        /// <summary>
        /// The factory method for constructing the <see cref="RowType" /> object.
        /// </summary>
        /// <param name="properties">Properties of the row type object.</param>
        /// <param name="metadataProperties">Metadata properties that will be added to the function. Can be null.</param>
        /// <returns>
        /// A new, read-only instance of the <see cref="RowType" /> object.
        /// </returns>
        public static RowType Create(IEnumerable <EdmProperty> properties, IEnumerable <MetadataProperty> metadataProperties)
        {
            Check.NotNull(properties, "properties");

            var rowType = new RowType(properties);

            if (metadataProperties != null)
            {
                rowType.AddMetadataProperties(metadataProperties);
            }

            rowType.SetReadOnly();

            return(rowType);
        }
Example #3
0
        /// <summary>
        /// The factory method for constructing the <see cref="RowType" /> object.
        /// </summary>
        /// <param name="properties">Properties of the row type object.</param>
        /// <param name="metadataProperties">Metadata properties that will be added to the function. Can be null.</param>
        /// <returns>
        /// A new, read-only instance of the <see cref="RowType" /> object.
        /// </returns>
        public static RowType Create(IEnumerable<EdmProperty> properties, IEnumerable<MetadataProperty> metadataProperties)
        {
            Check.NotNull(properties, "properties");

            var rowType = new RowType(properties);

            if (metadataProperties != null)
            {
                rowType.AddMetadataProperties(metadataProperties.ToList());
            }

            rowType.SetReadOnly();

            return rowType;
        }
        internal override TypeUsage GetTypeUsage()
        {
            if (_typeUsage == null)
            {
                var listOfProperties = new List<EdmProperty>();
                foreach (var property in _properties)
                {
                    var edmProperty = new EdmProperty(property.FQName, property.GetTypeUsage());
                    edmProperty.AddMetadataProperties(property.OtherContent);
                    //edmProperty.DeclaringType
                    listOfProperties.Add(edmProperty);
                }

                var rowType = new RowType(listOfProperties);
                if (Schema.DataModel
                    == SchemaDataModelOption.EntityDataModel)
                {
                    rowType.DataSpace = DataSpace.CSpace;
                }
                else
                {
                    Debug.Assert(
                        Schema.DataModel == SchemaDataModelOption.ProviderDataModel,
                        "Only DataModel == SchemaDataModelOption.ProviderDataModel is expected");
                    rowType.DataSpace = DataSpace.SSpace;
                }

                rowType.AddMetadataProperties(OtherContent);
                _typeUsage = TypeUsage.Create(rowType);
            }
            return _typeUsage;
        }