本文整理汇总了C#中Microsoft.OData.Edm.Library.EdmEntityContainer.AddElement方法的典型用法代码示例。如果您正苦于以下问题:C# EdmEntityContainer.AddElement方法的具体用法?C# EdmEntityContainer.AddElement怎么用?C# EdmEntityContainer.AddElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.OData.Edm.Library.EdmEntityContainer
的用法示例。
在下文中一共展示了EdmEntityContainer.AddElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: CreateModel
public static IEdmModel CreateModel(string ns)
{
EdmModel model = new EdmModel();
var defaultContainer = new EdmEntityContainer(ns, "DefaultContainer");
model.AddElement(defaultContainer);
var addressType = new EdmComplexType(ns, "Address");
addressType.AddProperty(new EdmStructuralProperty(addressType, "Road", EdmCoreModel.Instance.GetString(false)));
addressType.AddProperty(new EdmStructuralProperty(addressType, "City", EdmCoreModel.Instance.GetString(false)));
model.AddElement(addressType);
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, "Address", new EdmComplexTypeReference(addressType, true)));
personType.AddProperty(new EdmStructuralProperty(personType, "Descriptions", new EdmCollectionTypeReference(new EdmCollectionType(EdmCoreModel.Instance.GetString(false)))));
model.AddElement(personType);
var peopleSet = new EdmEntitySet(defaultContainer, "People", personType);
defaultContainer.AddElement(peopleSet);
var numberComboType = new EdmComplexType(ns, "NumberCombo");
numberComboType.AddProperty(new EdmStructuralProperty(numberComboType, "Small", EdmCoreModel.Instance.GetInt32(false)));
numberComboType.AddProperty(new EdmStructuralProperty(numberComboType, "Middle", EdmCoreModel.Instance.GetInt64(false)));
numberComboType.AddProperty(new EdmStructuralProperty(numberComboType, "Large", EdmCoreModel.Instance.GetDecimal(false)));
model.AddElement(numberComboType);
var productType = new EdmEntityType(ns, "Product");
var productIdProperty = new EdmStructuralProperty(productType, "ProductId", EdmCoreModel.Instance.GetInt32(false));
productType.AddProperty(productIdProperty);
productType.AddKeys(new IEdmStructuralProperty[] { productIdProperty });
productType.AddProperty(new EdmStructuralProperty(productType, "Quantity", EdmCoreModel.Instance.GetInt64(false)));
productType.AddProperty(new EdmStructuralProperty(productType, "LifeTimeInSeconds", EdmCoreModel.Instance.GetDecimal(false)));
productType.AddProperty(new EdmStructuralProperty(productType, "TheCombo", new EdmComplexTypeReference(numberComboType, true)));
productType.AddProperty(new EdmStructuralProperty(productType, "LargeNumbers", new EdmCollectionTypeReference(new EdmCollectionType(EdmCoreModel.Instance.GetDecimal(false)))));
model.AddElement(productType);
var productsSet = new EdmEntitySet(defaultContainer, "Products", productType);
defaultContainer.AddElement(productsSet);
var productsProperty = personType.AddUnidirectionalNavigation(new EdmNavigationPropertyInfo
{
Name = "Products",
Target = productType,
TargetMultiplicity = EdmMultiplicity.Many
});
peopleSet.AddNavigationTarget(productsProperty, productsSet);
IEnumerable<EdmError> errors;
model.Validate(out errors);
return model;
}
示例3: 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;
}
示例4: CreateEntryWithKeyAsSegmentConvention
private static ODataEntry CreateEntryWithKeyAsSegmentConvention(bool addAnnotation, bool? useKeyAsSegment)
{
var model = new EdmModel();
var container = new EdmEntityContainer("Fake", "Container");
model.AddElement(container);
if (addAnnotation)
{
model.AddVocabularyAnnotation(new EdmAnnotation(container, UrlConventionsConstants.ConventionTerm, UrlConventionsConstants.KeyAsSegmentAnnotationValue));
}
EdmEntityType entityType = new EdmEntityType("Fake", "FakeType");
entityType.AddKeys(entityType.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32));
model.AddElement(entityType);
var entitySet = new EdmEntitySet(container, "FakeSet", entityType);
container.AddElement(entitySet);
var metadataContext = new ODataMetadataContext(
true,
ODataReaderBehavior.DefaultBehavior.OperationsBoundToEntityTypeMustBeContainerQualified,
new EdmTypeReaderResolver(model, ODataReaderBehavior.DefaultBehavior),
model,
new Uri("http://temp.org/$metadata"),
null /*requestUri*/);
var thing = new ODataEntry {Properties = new[] {new ODataProperty {Name = "Id", Value = 1}}};
thing.SetAnnotation(new ODataTypeAnnotation(entitySet, entityType));
thing.MetadataBuilder = metadataContext.GetEntityMetadataBuilderForReader(new TestJsonLightReaderEntryState { Entry = thing, SelectedProperties = new SelectedPropertiesNode("*")}, useKeyAsSegment);
return thing;
}
示例5: ODataSingletonDeserializerTest
public ODataSingletonDeserializerTest()
{
EdmModel model = new EdmModel();
var employeeType = new EdmEntityType("NS", "Employee");
employeeType.AddStructuralProperty("EmployeeId", EdmPrimitiveTypeKind.Int32);
employeeType.AddStructuralProperty("EmployeeName", EdmPrimitiveTypeKind.String);
model.AddElement(employeeType);
EdmEntityContainer defaultContainer = new EdmEntityContainer("NS", "Default");
model.AddElement(defaultContainer);
_singleton = new EdmSingleton(defaultContainer, "CEO", employeeType);
defaultContainer.AddElement(_singleton);
model.SetAnnotationValue<ClrTypeAnnotation>(employeeType, new ClrTypeAnnotation(typeof(EmployeeModel)));
_edmModel = model;
_edmContainer = defaultContainer;
_readContext = new ODataDeserializerContext
{
Path = new ODataPath(new SingletonPathSegment(_singleton)),
Model = _edmModel,
ResourceType = typeof(EmployeeModel)
};
_deserializerProvider = new DefaultODataDeserializerProvider();
}
示例6: ODataFeedAndEntryTypeContextTests
static ODataFeedAndEntryTypeContextTests()
{
Model = new EdmModel();
EntitySetElementType = new EdmEntityType("ns", "Customer");
ExpectedEntityType = new EdmEntityType("ns", "VipCustomer", EntitySetElementType);
ActualEntityType = new EdmEntityType("ns", "DerivedVipCustomer", ExpectedEntityType);
EdmEntityContainer defaultContainer = new EdmEntityContainer("ns", "DefaultContainer");
Model.AddElement(defaultContainer);
Model.AddVocabularyAnnotation(new EdmAnnotation(defaultContainer, UrlConventionsConstants.ConventionTerm, UrlConventionsConstants.KeyAsSegmentAnnotationValue));
EntitySet = new EdmEntitySet(defaultContainer, "Customers", EntitySetElementType);
Model.AddElement(EntitySetElementType);
Model.AddElement(ExpectedEntityType);
Model.AddElement(ActualEntityType);
defaultContainer.AddElement(EntitySet);
SerializationInfo = new ODataFeedAndEntrySerializationInfo { NavigationSourceName = "MyCustomers", NavigationSourceEntityTypeName = "ns.MyCustomer", ExpectedTypeName = "ns.MyVipCustomer" };
SerializationInfoWithEdmUnknowEntitySet = new ODataFeedAndEntrySerializationInfo() { NavigationSourceName = null, NavigationSourceEntityTypeName = "ns.MyCustomer", ExpectedTypeName = "ns.MyVipCustomer", NavigationSourceKind = EdmNavigationSourceKind.UnknownEntitySet };
TypeContextWithoutModel = ODataFeedAndEntryTypeContext.Create(SerializationInfo, navigationSource: null, navigationSourceEntityType: null, expectedEntityType: null, model: Model, throwIfMissingTypeInfo: true);
TypeContextWithModel = ODataFeedAndEntryTypeContext.Create(/*serializationInfo*/null, EntitySet, EntitySetElementType, ExpectedEntityType, Model, throwIfMissingTypeInfo: true);
TypeContextWithEdmUnknowEntitySet = ODataFeedAndEntryTypeContext.Create(SerializationInfoWithEdmUnknowEntitySet, navigationSource: null, navigationSourceEntityType: null, expectedEntityType: null, model: Model, throwIfMissingTypeInfo: true);
BaseTypeContextThatThrows = ODataFeedAndEntryTypeContext.Create(serializationInfo: null, navigationSource: null, navigationSourceEntityType: null, expectedEntityType: null, model: Model, throwIfMissingTypeInfo: true);
BaseTypeContextThatWillNotThrow = ODataFeedAndEntryTypeContext.Create(serializationInfo: null, navigationSource: null, navigationSourceEntityType: null, expectedEntityType: null, model: Model, throwIfMissingTypeInfo: false);
}
示例7: ODataAsynchronousReaderTests
static ODataAsynchronousReaderTests()
{
userModel = new EdmModel();
testType = new EdmEntityType("NS", "Test");
testType.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32);
userModel.AddElement(testType);
var defaultContainer = new EdmEntityContainer("NS", "DefaultContainer");
userModel.AddElement(defaultContainer);
singleton = new EdmSingleton(defaultContainer, "MySingleton", testType);
defaultContainer.AddElement(singleton);
}
示例8: InstanceAnnotationWriterIntegrationTests
static InstanceAnnotationWriterIntegrationTests()
{
Model = new EdmModel();
EntityType = new EdmEntityType("TestNamespace", "TestEntityType");
Model.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");
Model.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);
}
示例9: AmbiguousEntitySetTest
public void AmbiguousEntitySetTest()
{
EdmEntityContainer container = new EdmEntityContainer("NS1", "Baz");
IEdmEntitySet set1 = new StubEdmEntitySet("Foo", container);
IEdmEntitySet set2 = new StubEdmEntitySet("Foo", container);
IEdmEntitySet set3 = new StubEdmEntitySet("Foo", container);
container.AddElement(set1);
Assert.AreNotEqual(set3, container.FindEntitySet("Foo"), "Checking the object equality.");
Assert.AreEqual(set3.Name, container.FindEntitySet("Foo").Name, "Checking the object equality.");
container.AddElement(set2);
container.AddElement(set3);
IEdmEntitySet ambiguous = container.FindEntitySet("Foo");
Assert.IsTrue(ambiguous.IsBad(), "Ambiguous binding is bad");
Assert.AreEqual(EdmContainerElementKind.EntitySet, ambiguous.ContainerElementKind, "Correct container element kind");
Assert.AreEqual("NS1.Baz", ambiguous.Container.FullName(), "Correct container name");
Assert.AreEqual("Foo", ambiguous.Name, "Correct Name");
Assert.IsTrue(ambiguous.EntityType().IsBad(), "Association is bad.");
}
示例10: AsyncRoundtripJsonLightTests
static AsyncRoundtripJsonLightTests()
{
userModel = new EdmModel();
testType = new EdmEntityType("NS", "Test");
testType.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32);
testType.AddStructuralProperty("Dummy", EdmPrimitiveTypeKind.String);
userModel.AddElement(testType);
defaultContainer = new EdmEntityContainer("NS", "DefaultContainer");
userModel.AddElement(defaultContainer);
singleton = new EdmSingleton(defaultContainer, "MySingleton", testType);
defaultContainer.AddElement(singleton);
}
示例11: TestInit
private ODataAsynchronousWriter TestInit()
{
this.userModel = new EdmModel();
testType = new EdmEntityType("NS", "Test");
testType.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32);
this.userModel.AddElement(testType);
var defaultContainer = new EdmEntityContainer("NS", "DefaultContainer");
this.userModel.AddElement(defaultContainer);
this.singleton = new EdmSingleton(defaultContainer, "MySingleton", this.testType);
defaultContainer.AddElement(this.singleton);
responseStream = new MemoryStream();
responseMessage = new InMemoryMessage { Stream = responseStream };
messageWriter = new ODataMessageWriter(responseMessage);
return messageWriter.CreateODataAsynchronousWriter();
}
示例12: EnumFilterFunctionalTests
public EnumFilterFunctionalTests()
{
// set up the edm model etc
this.userModel = new EdmModel();
var enumType = new EdmEnumType("NS", "Color", EdmPrimitiveTypeKind.Int32, false);
var red = new EdmEnumMember(enumType, "Red", new EdmIntegerConstant(1));
enumType.AddMember(red);
enumType.AddMember("Green", new EdmIntegerConstant(2));
enumType.AddMember("Blue", new EdmIntegerConstant(3));
enumType.AddMember("White", new EdmIntegerConstant(-10));
// add to model
this.userModel.AddElement(enumType);
// add enum property
this.entityType = new EdmEntityType("NS", "MyEntityType", isAbstract: false, isOpen: true, baseType: null);
var enumTypeReference = new EdmEnumTypeReference(enumType, true);
this.entityType.AddProperty(new EdmStructuralProperty(this.entityType, "Color", enumTypeReference));
// enum with flags
var enumFlagsType = new EdmEnumType("NS", "ColorFlags", EdmPrimitiveTypeKind.Int64, true);
enumFlagsType.AddMember("Red", new EdmIntegerConstant(1L));
enumFlagsType.AddMember("Green", new EdmIntegerConstant(2L));
enumFlagsType.AddMember("Blue", new EdmIntegerConstant(4L));
enumFlagsType.AddMember("GreenRed", new EdmIntegerConstant(3L));
// add to model
this.userModel.AddElement(enumFlagsType);
// add enum with flags
var enumFlagsTypeReference = new EdmEnumTypeReference(enumFlagsType, true);
this.entityType.AddProperty(new EdmStructuralProperty(this.entityType, "ColorFlags", enumFlagsTypeReference));
this.userModel.AddElement(this.entityType);
var defaultContainer = new EdmEntityContainer("NS", "DefaultContainer");
this.userModel.AddElement(defaultContainer);
this.entitySet = new EdmEntitySet(defaultContainer, "MySet", this.entityType);
defaultContainer.AddElement(this.entitySet);
}
示例13: Initialize
public void Initialize()
{
EdmModel edmModel = new EdmModel();
EdmEntityType edmEntityType = new EdmEntityType("TestNamespace", "EntityType", baseType: null, isAbstract: false, isOpen: true);
edmModel.AddElement(edmEntityType);
EdmComplexType ComplexType = new EdmComplexType("TestNamespace", "TestComplexType");
ComplexType.AddProperty(new EdmStructuralProperty(ComplexType, "StringProperty", EdmCoreModel.Instance.GetString(false)));
edmModel.AddElement(ComplexType);
EdmComplexType derivedComplexType = new EdmComplexType("TestNamespace", "TestDerivedComplexType", ComplexType, true);
derivedComplexType.AddProperty(new EdmStructuralProperty(derivedComplexType, "DerivedStringProperty", EdmCoreModel.Instance.GetString(false)));
edmModel.AddElement(derivedComplexType);
var defaultContainer = new EdmEntityContainer("TestNamespace", "DefaultContainer_sub");
edmModel.AddElement(defaultContainer);
this.entitySet = new EdmEntitySet(defaultContainer, "TestEntitySet", edmEntityType);
defaultContainer.AddElement(this.entitySet);
this.model = TestUtils.WrapReferencedModelsToMainModel("TestNamespace", "DefaultContainer", edmModel);
this.entityType = edmEntityType;
this.complexType = ComplexType;
}
示例14: ODataEntityReferenceLinksTests
static ODataEntityReferenceLinksTests()
{
EdmModel tmpModel = new EdmModel();
EdmComplexType complexType = new EdmComplexType("TestNamespace", "TestComplexType");
complexType.AddProperty(new EdmStructuralProperty(complexType, "StringProperty", EdmCoreModel.Instance.GetString(false)));
tmpModel.AddElement(complexType);
EntityType = new EdmEntityType("TestNamespace", "TestEntityType");
tmpModel.AddElement(EntityType);
var keyProperty = new EdmStructuralProperty(EntityType, "ID", EdmCoreModel.Instance.GetInt32(false));
EntityType.AddKeys(new IEdmStructuralProperty[] { keyProperty });
EntityType.AddProperty(keyProperty);
var defaultContainer = new EdmEntityContainer("TestNamespace", "DefaultContainer_sub");
tmpModel.AddElement(defaultContainer);
EntitySet = new EdmEntitySet(defaultContainer, "Customers", EntityType);
defaultContainer.AddElement(EntitySet);
EdmModel = TestUtils.WrapReferencedModelsToMainModel("TestNamespace", "DefaultContainer", tmpModel);
MessageReaderSettingsReadAndValidateCustomInstanceAnnotations = new ODataMessageReaderSettings { ShouldIncludeAnnotation = ODataUtils.CreateAnnotationFilter("*") };
}
示例15: VerifyAnnotationComputedConcurrency
public void VerifyAnnotationComputedConcurrency()
{
var model = new EdmModel();
var entity = new EdmEntityType("NS1", "Product");
var entityId = entity.AddStructuralProperty("Id", EdmCoreModel.Instance.GetInt32(false));
entity.AddKeys(entityId);
EdmStructuralProperty name1 = entity.AddStructuralProperty("Name", EdmCoreModel.Instance.GetString(false));
EdmStructuralProperty timeVer = entity.AddStructuralProperty("UpdatedTime", EdmCoreModel.Instance.GetDate(false));
model.AddElement(entity);
SetComputedAnnotation(model, entityId); // semantic meaning is V3's 'Identity' for Key profperty
SetComputedAnnotation(model, timeVer); // semantic meaning is V3's 'Computed' for non-key profperty
var entityContainer = new EdmEntityContainer("NS1", "Container");
model.AddElement(entityContainer);
EdmEntitySet set1 = new EdmEntitySet(entityContainer, "Products", entity);
model.SetOptimisticConcurrencyAnnotation(set1, new IEdmStructuralProperty[] { entityId, timeVer });
entityContainer.AddElement(set1);
string csdlStr = GetEdmx(model, EdmxTarget.OData);
Assert.AreEqual(@"<?xml version=""1.0"" encoding=""utf-16""?><edmx:Edmx Version=""4.0"" xmlns:edmx=""http://docs.oasis-open.org/odata/ns/edmx""><edmx:DataServices><Schema Namespace=""NS1"" xmlns=""http://docs.oasis-open.org/odata/ns/edm""><EntityType Name=""Product""><Key><PropertyRef Name=""Id"" /></Key><Property Name=""Id"" Type=""Edm.Int32"" Nullable=""false""><Annotation Term=""Org.OData.Core.V1.Computed"" Bool=""true"" /></Property><Property Name=""Name"" Type=""Edm.String"" Nullable=""false"" /><Property Name=""UpdatedTime"" Type=""Edm.Date"" Nullable=""false""><Annotation Term=""Org.OData.Core.V1.Computed"" Bool=""true"" /></Property></EntityType><EntityContainer Name=""Container""><EntitySet Name=""Products"" EntityType=""NS1.Product""><Annotation Term=""Org.OData.Core.V1.OptimisticConcurrency""><Collection><PropertyPath>Id</PropertyPath><PropertyPath>UpdatedTime</PropertyPath></Collection></Annotation></EntitySet></EntityContainer></Schema></edmx:DataServices></edmx:Edmx>", csdlStr);
}