本文整理汇总了C#中Microsoft.OData.Edm.Library.EdmComplexType类的典型用法代码示例。如果您正苦于以下问题:C# EdmComplexType类的具体用法?C# EdmComplexType怎么用?C# EdmComplexType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EdmComplexType类属于Microsoft.OData.Edm.Library命名空间,在下文中一共展示了EdmComplexType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateAmbiguousBinding
public void CreateAmbiguousBinding()
{
EdmModel model = new EdmModel();
EdmComplexType c1 = new EdmComplexType("Ambiguous", "Binding");
EdmComplexType c2 = new EdmComplexType("Ambiguous", "Binding");
EdmComplexType c3 = new EdmComplexType("Ambiguous", "Binding");
model.AddElement(c1);
Assert.AreEqual(c1, model.FindType("Ambiguous.Binding"), "Single item resolved");
model.AddElement(c2);
model.AddElement(c3);
IEdmNamedElement ambiguous = model.FindType("Ambiguous.Binding");
Assert.IsTrue(ambiguous.IsBad(), "Ambiguous binding is bad");
Assert.AreEqual(EdmErrorCode.BadAmbiguousElementBinding, ambiguous.Errors().First().ErrorCode, "Ambiguous");
c1 = null;
c2 = new EdmComplexType("Ambiguous", "Binding2");
Assert.IsTrue
(
model.SchemaElements.OfType<IEdmComplexType>().Count() == 3 && model.SchemaElements.OfType<IEdmComplexType>().All(n => n.FullName() == "Ambiguous.Binding"),
"The model must be immutable."
);
}
示例2: ODataAtomPropertyAndValueDeserializerTests
static ODataAtomPropertyAndValueDeserializerTests()
{
EdmModel = new EdmModel();
ComplexType = new EdmComplexType("TestNamespace", "TestComplexType");
StringProperty = ComplexType.AddStructuralProperty("Name", EdmPrimitiveTypeKind.String);
EdmModel.AddElement(ComplexType);
}
示例3: MultipleSchemasWithDifferentNamespacesEdm
public static IEdmModel MultipleSchemasWithDifferentNamespacesEdm()
{
var namespaces = new string[]
{
"FindMethodsTestModelBuilder.MultipleSchemasWithDifferentNamespaces.first",
"FindMethodsTestModelBuilder.MultipleSchemasWithDifferentNamespaces.second"
};
var model = new EdmModel();
foreach (var namespaceName in namespaces)
{
var entityType1 = new EdmEntityType(namespaceName, "validEntityType1");
entityType1.AddKeys(entityType1.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32));
var entityType2 = new EdmEntityType(namespaceName, "VALIDeNTITYtYPE2");
entityType2.AddKeys(entityType2.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32));
var entityType3 = new EdmEntityType(namespaceName, "VALIDeNTITYtYPE3");
entityType3.AddKeys(entityType3.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32));
entityType1.AddUnidirectionalNavigation(new EdmNavigationPropertyInfo {Name = "Mumble", Target = entityType2, TargetMultiplicity = EdmMultiplicity.Many});
var complexType = new EdmComplexType(namespaceName, "ValidNameComplexType1");
complexType.AddStructuralProperty("aPropertyOne", new EdmComplexTypeReference(complexType, false));
model.AddElements(new IEdmSchemaElement[] { entityType1, entityType2, entityType3, complexType });
var function1 = new EdmFunction(namespaceName, "ValidFunction1", EdmCoreModel.Instance.GetSingle(false));
var function2 = new EdmFunction(namespaceName, "ValidFunction1", EdmCoreModel.Instance.GetSingle(false));
function2.AddParameter("param1", new EdmEntityTypeReference(entityType1, false));
var function3 = new EdmFunction(namespaceName, "ValidFunction1", EdmCoreModel.Instance.GetSingle(false));
function3.AddParameter("param1", EdmCoreModel.Instance.GetSingle(false));
model.AddElements(new IEdmSchemaElement[] {function1, function2, function3});
}
return model;
}
示例4: Init
public void Init()
{
EdmModel model = new EdmModel();
EdmComplexType complex1 = new EdmComplexType("ns", "complex1");
complex1.AddProperty(new EdmStructuralProperty(complex1, "p1", EdmCoreModel.Instance.GetInt32(isNullable: false)));
model.AddElement(complex1);
EdmComplexType complex2 = new EdmComplexType("ns", "complex2");
complex2.AddProperty(new EdmStructuralProperty(complex2, "p1", EdmCoreModel.Instance.GetInt32(isNullable: false)));
model.AddElement(complex2);
EdmComplexTypeReference complex2Reference = new EdmComplexTypeReference(complex2, isNullable: false);
EdmCollectionType primitiveCollectionType = new EdmCollectionType(EdmCoreModel.Instance.GetPrimitive(EdmPrimitiveTypeKind.Int32, isNullable: false));
EdmCollectionType complexCollectionType = new EdmCollectionType(complex2Reference);
EdmCollectionTypeReference primitiveCollectionTypeReference = new EdmCollectionTypeReference(primitiveCollectionType);
EdmCollectionTypeReference complexCollectionTypeReference = new EdmCollectionTypeReference(complexCollectionType);
model.AddElement(new EdmTerm("custom", "int", EdmCoreModel.Instance.GetPrimitive(EdmPrimitiveTypeKind.Int32, isNullable: false)));
model.AddElement(new EdmTerm("custom", "string", EdmCoreModel.Instance.GetPrimitive(EdmPrimitiveTypeKind.String, isNullable: false)));
model.AddElement(new EdmTerm("custom", "double", EdmCoreModel.Instance.GetPrimitive(EdmPrimitiveTypeKind.Double, isNullable: false)));
model.AddElement(new EdmTerm("custom", "bool", EdmCoreModel.Instance.GetPrimitive(EdmPrimitiveTypeKind.Boolean, isNullable: true)));
model.AddElement(new EdmTerm("custom", "decimal", EdmCoreModel.Instance.GetPrimitive(EdmPrimitiveTypeKind.Decimal, isNullable: false)));
model.AddElement(new EdmTerm("custom", "timespan", EdmCoreModel.Instance.GetPrimitive(EdmPrimitiveTypeKind.Duration, isNullable: false)));
model.AddElement(new EdmTerm("custom", "guid", EdmCoreModel.Instance.GetPrimitive(EdmPrimitiveTypeKind.Guid, isNullable: false)));
model.AddElement(new EdmTerm("custom", "complex", complex2Reference));
model.AddElement(new EdmTerm("custom", "primitiveCollection", primitiveCollectionTypeReference));
model.AddElement(new EdmTerm("custom", "complexCollection", complexCollectionTypeReference));
this.stream = new MemoryStream();
this.settings = new ODataMessageWriterSettings { Version = ODataVersion.V4, ShouldIncludeAnnotation = ODataUtils.CreateAnnotationFilter("*") };
this.settings.SetServiceDocumentUri(ServiceDocumentUri);
this.serializer = new ODataAtomPropertyAndValueSerializer(this.CreateAtomOutputContext(model, this.stream));
}
示例5: CreateComplexTypeBody
private void CreateComplexTypeBody(EdmComplexType type, ComplexTypeConfiguration config)
{
Contract.Assert(type != null);
Contract.Assert(config != null);
CreateStructuralTypeBody(type, config);
}
示例6: ReferentialConstraintDemo
private static void ReferentialConstraintDemo()
{
Console.WriteLine("ReferentialConstraintDemo");
EdmModel model = new EdmModel();
var customer = new EdmEntityType("ns", "Customer");
model.AddElement(customer);
var customerId = customer.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32, false);
customer.AddKeys(customerId);
var address = new EdmComplexType("ns", "Address");
model.AddElement(address);
var code = address.AddStructuralProperty("gid", EdmPrimitiveTypeKind.Guid);
customer.AddStructuralProperty("addr", new EdmComplexTypeReference(address, true));
var order = new EdmEntityType("ns", "Order");
model.AddElement(order);
var oId = order.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32, false);
order.AddKeys(oId);
var orderCustomerId = order.AddStructuralProperty("CustomerId", EdmPrimitiveTypeKind.Int32, false);
var nav = new EdmNavigationPropertyInfo()
{
Name = "NavCustomer",
Target = customer,
TargetMultiplicity = EdmMultiplicity.One,
DependentProperties = new[] { orderCustomerId },
PrincipalProperties = new[] { customerId }
};
order.AddUnidirectionalNavigation(nav);
ShowModel(model);
}
示例7: NonPrimitiveIsXXXMethods
public void NonPrimitiveIsXXXMethods()
{
IEdmEntityType entityDef = new EdmEntityType("MyNamespace", "MyEntity");
IEdmEntityTypeReference entityRef = new EdmEntityTypeReference(entityDef, false);
Assert.IsTrue(entityRef.IsEntity(), "Entity is Entity");
IEdmPrimitiveTypeReference bad = entityRef.AsPrimitive();
Assert.IsTrue(bad.Definition.IsBad(), "bad TypeReference is bad");
Assert.AreEqual(EdmErrorCode.TypeSemanticsCouldNotConvertTypeReference, bad.Definition.Errors().First().ErrorCode, "Reference is bad from conversion");
Assert.IsTrue(bad.Definition.IsBad(), "Bad definition is bad");
Assert.AreEqual(EdmErrorCode.TypeSemanticsCouldNotConvertTypeReference, bad.Definition.Errors().First().ErrorCode, "Definition is bad from conversion");
IEdmPrimitiveType intDef = EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Int32);
IEdmPrimitiveTypeReference intRef = new EdmPrimitiveTypeReference(intDef, false);
IEdmCollectionTypeReference intCollection = new EdmCollectionTypeReference(new EdmCollectionType(intRef));
Assert.IsTrue(intCollection.IsCollection(), "Collection is collection");
IEdmComplexType complexDef = new EdmComplexType("MyNamespace", "MyComplex");
IEdmComplexTypeReference complexRef = new EdmComplexTypeReference(complexDef, false);
Assert.IsTrue(complexRef.IsComplex(), "Complex is Complex");
Assert.IsTrue(entityRef.IsStructured(), "Entity is Structured");
Assert.IsTrue(complexRef.IsStructured(), "Complex is stuctured");
Assert.IsFalse(intCollection.IsStructured(), "Collection is not structured");
}
示例8: NonPrimitiveTypeRoundtripAtomTests
public NonPrimitiveTypeRoundtripAtomTests()
{
this.model = new EdmModel();
EdmComplexType personalInfo = new EdmComplexType(MyNameSpace, "PersonalInfo");
personalInfo.AddStructuralProperty("Age", EdmPrimitiveTypeKind.Int16);
personalInfo.AddStructuralProperty("Email", EdmPrimitiveTypeKind.String);
personalInfo.AddStructuralProperty("Tel", EdmPrimitiveTypeKind.String);
personalInfo.AddStructuralProperty("ID", EdmPrimitiveTypeKind.Guid);
EdmComplexType subjectInfo = new EdmComplexType(MyNameSpace, "Subject");
subjectInfo.AddStructuralProperty("Name", EdmPrimitiveTypeKind.String);
subjectInfo.AddStructuralProperty("Score", EdmPrimitiveTypeKind.Int16);
EdmCollectionTypeReference subjectsCollection = new EdmCollectionTypeReference(new EdmCollectionType(new EdmComplexTypeReference(subjectInfo, isNullable:true)));
EdmEntityType studentInfo = new EdmEntityType(MyNameSpace, "Student");
studentInfo.AddStructuralProperty("Info", new EdmComplexTypeReference(personalInfo, isNullable: false));
studentInfo.AddProperty(new EdmStructuralProperty(studentInfo, "Subjects", subjectsCollection));
EdmCollectionTypeReference hobbiesCollection = new EdmCollectionTypeReference(new EdmCollectionType(EdmCoreModel.Instance.GetString(isNullable: false)));
studentInfo.AddProperty(new EdmStructuralProperty(studentInfo, "Hobbies", hobbiesCollection));
model.AddElement(studentInfo);
model.AddElement(personalInfo);
model.AddElement(subjectInfo);
}
示例9: Initialize
public void Initialize()
{
var addressEdmType = new EdmComplexType("Default", "Address");
addressEdmType.AddStructuralProperty("ZipCode", EdmPrimitiveTypeKind.String);
this.edmAddressComplexTypeRef = new EdmComplexTypeReference(addressEdmType, true);
}
示例10: CraftModel
public CraftModel()
{
model = new EdmModel();
var address = new EdmComplexType("NS", "Address");
model.AddElement(address);
var mail = new EdmEntityType("NS", "Mail");
var mailId = mail.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32);
mail.AddKeys(mailId);
model.AddElement(mail);
var person = new EdmEntityType("NS", "Person");
model.AddElement(person);
var personId = person.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32);
person.AddKeys(personId);
person.AddStructuralProperty("Addr", new EdmComplexTypeReference(address, /*Nullable*/false));
MailBox = person.AddUnidirectionalNavigation(new EdmNavigationPropertyInfo()
{
ContainsTarget = true,
Name = "Mails",
TargetMultiplicity = EdmMultiplicity.Many,
Target = mail,
});
var container = new EdmEntityContainer("NS", "DefaultContainer");
model.AddElement(container);
MyLogin = container.AddSingleton("MyLogin", person);
}
示例11: ODataJsonLightInheritComplexCollectionWriterTests
public ODataJsonLightInheritComplexCollectionWriterTests()
{
collectionStartWithoutSerializationInfo = new ODataCollectionStart();
collectionStartWithSerializationInfo = new ODataCollectionStart();
collectionStartWithSerializationInfo.SetSerializationInfo(new ODataCollectionStartSerializationInfo { CollectionTypeName = "Collection(ns.Address)" });
address = new ODataComplexValue { Properties = new[]
{
new ODataProperty { Name = "Street", Value = "1 Microsoft Way" },
new ODataProperty { Name = "Zipcode", Value = 98052 },
new ODataProperty { Name = "State", Value = new ODataEnumValue("WA", "ns.StateEnum") },
new ODataProperty { Name = "City", Value = "Shanghai" }
}, TypeName = "TestNamespace.DerivedAddress" };
items = new[] { address };
EdmComplexType addressType = new EdmComplexType("ns", "Address");
addressType.AddProperty(new EdmStructuralProperty(addressType, "Street", EdmCoreModel.Instance.GetString(isNullable: true)));
addressType.AddProperty(new EdmStructuralProperty(addressType, "Zipcode", EdmCoreModel.Instance.GetInt32(isNullable: true)));
var stateEnumType = new EdmEnumType("ns", "StateEnum", isFlags: true);
stateEnumType.AddMember("IL", new EdmIntegerConstant(1));
stateEnumType.AddMember("WA", new EdmIntegerConstant(2));
addressType.AddProperty(new EdmStructuralProperty(addressType, "State", new EdmEnumTypeReference(stateEnumType, true)));
EdmComplexType derivedAddressType = new EdmComplexType("ns", "DerivedAddress", addressType, false);
derivedAddressType.AddProperty(new EdmStructuralProperty(derivedAddressType, "City", EdmCoreModel.Instance.GetString(isNullable: true)));
addressTypeReference = new EdmComplexTypeReference(addressType, isNullable: false);
derivedAddressTypeReference = new EdmComplexTypeReference(derivedAddressType, isNullable: false);
}
示例12: InstanceAnnotationsReaderIntegrationTests
static InstanceAnnotationsReaderIntegrationTests()
{
EdmModel modelTmp = new EdmModel();
EntityType = new EdmEntityType("TestNamespace", "TestEntityType");
modelTmp.AddElement(EntityType);
var keyProperty = new EdmStructuralProperty(EntityType, "ID", EdmCoreModel.Instance.GetInt32(false));
EntityType.AddKeys(new IEdmStructuralProperty[] { keyProperty });
EntityType.AddProperty(keyProperty);
var resourceNavigationProperty = EntityType.AddUnidirectionalNavigation(new EdmNavigationPropertyInfo { Name = "ResourceNavigationProperty", Target = EntityType, TargetMultiplicity = EdmMultiplicity.ZeroOrOne });
var resourceSetNavigationProperty = EntityType.AddUnidirectionalNavigation(new EdmNavigationPropertyInfo { Name = "ResourceSetNavigationProperty", Target = EntityType, TargetMultiplicity = EdmMultiplicity.Many });
var defaultContainer = new EdmEntityContainer("TestNamespace", "DefaultContainer_sub");
modelTmp.AddElement(defaultContainer);
EntitySet = new EdmEntitySet(defaultContainer, "TestEntitySet", EntityType);
EntitySet.AddNavigationTarget(resourceNavigationProperty, EntitySet);
EntitySet.AddNavigationTarget(resourceSetNavigationProperty, EntitySet);
defaultContainer.AddElement(EntitySet);
Singleton = new EdmSingleton(defaultContainer, "TestSingleton", EntityType);
Singleton.AddNavigationTarget(resourceNavigationProperty, EntitySet);
Singleton.AddNavigationTarget(resourceSetNavigationProperty, EntitySet);
defaultContainer.AddElement(Singleton);
ComplexType = new EdmComplexType("TestNamespace", "TestComplexType");
ComplexType.AddProperty(new EdmStructuralProperty(ComplexType, "StringProperty", EdmCoreModel.Instance.GetString(false)));
modelTmp.AddElement(ComplexType);
Model = TestUtils.WrapReferencedModelsToMainModel("TestNamespace", "DefaultContainer", modelTmp);
}
示例13: ComplexValueTest
public void ComplexValueTest()
{
EdmModel model = new EdmModel();
var emptyComplexType = new EdmComplexType(DefaultNamespaceName, "EmptyComplexType");
model.AddElement(emptyComplexType);
var complexTypeWithStringProperty = new EdmComplexType(DefaultNamespaceName, "ComplexTypeWithStringProperty");
complexTypeWithStringProperty.AddStructuralProperty("stringProperty", EdmCoreModel.Instance.GetString(isNullable: true));
complexTypeWithStringProperty.AddStructuralProperty("numberProperty", EdmCoreModel.Instance.GetInt32(isNullable: false));
model.AddElement(complexTypeWithStringProperty);
model.Fixup();
IEnumerable<PayloadReaderTestDescriptor> testDescriptors = new[]
{
// Empty element is a valid complex value
new PayloadReaderTestDescriptor(this.Settings)
{
PayloadElement = PayloadBuilder.ComplexValue("TestModel.EmptyComplexType")
.XmlValueRepresentation(new XNode[0])
.WithTypeAnnotation(emptyComplexType),
PayloadEdmModel = model
},
};
testDescriptors = testDescriptors.Concat(
PropertiesElementAtomValues.CreatePropertiesElementPaddingPayloads<ComplexInstance>(
new PayloadReaderTestDescriptor(this.Settings)
{
PayloadElement = PayloadBuilder.ComplexValue("TestModel.ComplexTypeWithStringProperty")
.WithTypeAnnotation(complexTypeWithStringProperty),
PayloadEdmModel = model
},
(complexInstance, xmlValue) => complexInstance.XmlValueRepresentation(xmlValue)));
testDescriptors = testDescriptors.Select(td => td.InProperty());
testDescriptors = testDescriptors.Concat(new []
{
// Top-level property without expected type and no type name - this is read as primitive string!
new PayloadReaderTestDescriptor(this.Settings)
{
PayloadElement = PayloadBuilder.Property(null, PayloadBuilder.PrimitiveValue(string.Empty))
.XmlRepresentation("<m:value/>"),
PayloadEdmModel = model,
},
});
this.CombinatorialEngineProvider.RunCombinations(
testDescriptors,
this.ReaderTestConfigurationProvider.AtomFormatConfigurations,
(testDescriptor, testConfiguration) =>
{
testDescriptor.RunTest(testConfiguration);
});
}
示例14: CreateServiceEdmModel
public static IEdmModel CreateServiceEdmModel(string ns)
{
EdmModel model = new EdmModel();
var defaultContainer = new EdmEntityContainer(ns, "PerfInMemoryContainer");
model.AddElement(defaultContainer);
var personType = new EdmEntityType(ns, "Person");
var personIdProperty = new EdmStructuralProperty(personType, "PersonID", EdmCoreModel.Instance.GetInt32(false));
personType.AddProperty(personIdProperty);
personType.AddKeys(new IEdmStructuralProperty[] { personIdProperty });
personType.AddProperty(new EdmStructuralProperty(personType, "FirstName", EdmCoreModel.Instance.GetString(false)));
personType.AddProperty(new EdmStructuralProperty(personType, "LastName", EdmCoreModel.Instance.GetString(false)));
personType.AddProperty(new EdmStructuralProperty(personType, "MiddleName", EdmCoreModel.Instance.GetString(true)));
personType.AddProperty(new EdmStructuralProperty(personType, "Age", EdmCoreModel.Instance.GetInt32(false)));
model.AddElement(personType);
var simplePersonSet = new EdmEntitySet(defaultContainer, "SimplePeopleSet", personType);
defaultContainer.AddElement(simplePersonSet);
var largetPersonSet = new EdmEntitySet(defaultContainer, "LargePeopleSet", personType);
defaultContainer.AddElement(largetPersonSet);
var addressType = new EdmComplexType(ns, "Address");
addressType.AddProperty(new EdmStructuralProperty(addressType, "Street", EdmCoreModel.Instance.GetString(false)));
addressType.AddProperty(new EdmStructuralProperty(addressType, "City", EdmCoreModel.Instance.GetString(false)));
addressType.AddProperty(new EdmStructuralProperty(addressType, "PostalCode", EdmCoreModel.Instance.GetString(false)));
model.AddElement(addressType);
var companyType = new EdmEntityType(ns, "Company");
var companyId = new EdmStructuralProperty(companyType, "CompanyID", EdmCoreModel.Instance.GetInt32(false));
companyType.AddProperty(companyId);
companyType.AddKeys(companyId);
companyType.AddProperty(new EdmStructuralProperty(companyType, "Name", EdmCoreModel.Instance.GetString(true)));
companyType.AddProperty(new EdmStructuralProperty(companyType, "Address", new EdmComplexTypeReference(addressType, true)));
companyType.AddProperty(new EdmStructuralProperty(companyType, "Revenue", EdmCoreModel.Instance.GetInt32(false)));
model.AddElement(companyType);
var companySet = new EdmEntitySet(defaultContainer, "CompanySet", companyType);
defaultContainer.AddElement(companySet);
var companyEmployeeNavigation = companyType.AddUnidirectionalNavigation(new EdmNavigationPropertyInfo()
{
Name = "Employees",
Target = personType,
TargetMultiplicity = EdmMultiplicity.Many
});
companySet.AddNavigationTarget(companyEmployeeNavigation, largetPersonSet);
// ResetDataSource
var resetDataSourceAction = new EdmAction(ns, "ResetDataSource", null, false, null);
model.AddElement(resetDataSourceAction);
defaultContainer.AddActionImport(resetDataSourceAction);
return model;
}
示例15: Initialize
public void Initialize()
{
this.model = new EdmModel();
EdmComplexType personalInfo = new EdmComplexType(MyNameSpace, "PersonalInfo");
personalInfo.AddStructuralProperty("Age", EdmPrimitiveTypeKind.Int16);
personalInfo.AddStructuralProperty("Email", EdmPrimitiveTypeKind.String);
personalInfo.AddStructuralProperty("Tel", EdmPrimitiveTypeKind.String);
personalInfo.AddStructuralProperty("ID", EdmPrimitiveTypeKind.Guid);
EdmComplexType derivedPersonalInfo = new EdmComplexType(MyNameSpace, "DerivedPersonalInfo", personalInfo);
derivedPersonalInfo.AddStructuralProperty("Hobby", EdmPrimitiveTypeKind.String);
EdmComplexType derivedDerivedPersonalInfo = new EdmComplexType(MyNameSpace, "DerivedDerivedPersonalInfo", derivedPersonalInfo);
derivedDerivedPersonalInfo.AddStructuralProperty("Education", EdmPrimitiveTypeKind.String);
EdmComplexType subjectInfo = new EdmComplexType(MyNameSpace, "Subject");
subjectInfo.AddStructuralProperty("Name", EdmPrimitiveTypeKind.String);
subjectInfo.AddStructuralProperty("Score", EdmPrimitiveTypeKind.Int16);
EdmComplexType derivedSubjectInfo = new EdmComplexType(MyNameSpace, "DerivedSubject", subjectInfo);
derivedSubjectInfo.AddStructuralProperty("Teacher", EdmPrimitiveTypeKind.String);
EdmComplexType derivedDerivedSubjectInfo = new EdmComplexType(MyNameSpace, "DerivedDerivedSubject", derivedSubjectInfo);
derivedDerivedSubjectInfo.AddStructuralProperty("Classroom", EdmPrimitiveTypeKind.String);
EdmCollectionTypeReference subjectsCollection = new EdmCollectionTypeReference(new EdmCollectionType(new EdmComplexTypeReference(subjectInfo, isNullable: true)));
studentInfo = new EdmEntityType(MyNameSpace, "Student");
studentInfo.AddStructuralProperty("Info", new EdmComplexTypeReference(personalInfo, isNullable: false));
studentInfo.AddProperty(new EdmStructuralProperty(studentInfo, "Subjects", subjectsCollection));
// enum with flags
var enumFlagsType = new EdmEnumType(MyNameSpace, "ColorFlags", isFlags: true);
enumFlagsType.AddMember("Red", new EdmIntegerConstant(1));
enumFlagsType.AddMember("Green", new EdmIntegerConstant(2));
enumFlagsType.AddMember("Blue", new EdmIntegerConstant(4));
studentInfo.AddStructuralProperty("ClothesColors", new EdmCollectionTypeReference(new EdmCollectionType(new EdmEnumTypeReference(enumFlagsType, true))));
EdmCollectionTypeReference hobbiesCollection = new EdmCollectionTypeReference(new EdmCollectionType(EdmCoreModel.Instance.GetString(isNullable: false)));
studentInfo.AddProperty(new EdmStructuralProperty(studentInfo, "Hobbies", hobbiesCollection));
model.AddElement(enumFlagsType);
model.AddElement(studentInfo);
model.AddElement(personalInfo);
model.AddElement(derivedPersonalInfo);
model.AddElement(derivedDerivedPersonalInfo);
model.AddElement(subjectInfo);
model.AddElement(derivedSubjectInfo);
model.AddElement(derivedDerivedSubjectInfo);
IEdmEntityContainer defaultContainer = new EdmEntityContainer("NS", "DefaultContainer");
model.AddElement(defaultContainer);
this.studentSet = new EdmEntitySet(defaultContainer, "MySet", this.studentInfo);
}