本文整理汇总了C#中Microsoft.OData.Edm.Library.EdmModel.SetOptimisticConcurrencyAnnotation方法的典型用法代码示例。如果您正苦于以下问题:C# EdmModel.SetOptimisticConcurrencyAnnotation方法的具体用法?C# EdmModel.SetOptimisticConcurrencyAnnotation怎么用?C# EdmModel.SetOptimisticConcurrencyAnnotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.OData.Edm.Library.EdmModel
的用法示例。
在下文中一共展示了EdmModel.SetOptimisticConcurrencyAnnotation方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEdmModel
private static IEdmModel GetEdmModel()
{
EdmModel model = new EdmModel();
// entity type customer
EdmEntityType customer = new EdmEntityType("NS", "Customer");
customer.AddKeys(customer.AddStructuralProperty("ID", EdmPrimitiveTypeKind.Int32));
IEdmStructuralProperty customerName = customer.AddStructuralProperty("Name", EdmPrimitiveTypeKind.String);
model.AddElement(customer);
// entity sets
EdmEntityContainer container = new EdmEntityContainer("NS", "Default");
model.AddElement(container);
EdmEntitySet customers = container.AddEntitySet("ETagUntypedCustomers", customer);
model.SetOptimisticConcurrencyAnnotation(customers, new[] { customerName });
return model;
}
示例2: AutoComputeETagWithOptimisticConcurrencyAnnotation
public void AutoComputeETagWithOptimisticConcurrencyAnnotation()
{
const string expected = "{" +
"\"@odata.context\":\"http://example.com/$metadata#People/$entity\"," +
"\"@odata.id\":\"People(123)\"," +
"\"@odata.etag\":\"W/\\\"'lucy',12306\\\"\"," +
"\"@odata.editLink\":\"People(123)\"," +
"\"@odata.mediaEditLink\":\"People(123)/$value\"," +
"\"ID\":123," +
"\"Name\":\"lucy\"," +
"\"Class\":12306," +
"\"Alias\":\"lily\"}";
EdmModel model = new EdmModel();
EdmEntityType personType = new EdmEntityType("MyNs", "Person", null, false, false, true);
personType.AddKeys(personType.AddStructuralProperty("ID", EdmPrimitiveTypeKind.Int32));
var nameProperty = personType.AddStructuralProperty("Name", EdmCoreModel.Instance.GetString(isNullable: true));
var classProperty = personType.AddStructuralProperty("Class", EdmPrimitiveTypeKind.Int32);
personType.AddStructuralProperty("Alias", EdmCoreModel.Instance.GetString(isNullable: true), null, EdmConcurrencyMode.Fixed);
var container = new EdmEntityContainer("MyNs", "Container");
model.AddElement(personType);
container.AddEntitySet("People", personType);
model.AddElement(container);
IEdmEntitySet peopleSet = model.FindDeclaredEntitySet("People");
model.SetOptimisticConcurrencyAnnotation(peopleSet, new[] { nameProperty, classProperty });
ODataEntry entry = new ODataEntry
{
Properties = new[]
{
new ODataProperty {Name = "ID", Value = 123},
new ODataProperty {Name = "Name", Value = "lucy"},
new ODataProperty {Name = "Class", Value = 12306},
new ODataProperty {Name = "Alias", Value = "lily"},
}
};
string actual = GetWriterOutputForContentTypeAndKnobValue(entry, model, peopleSet, personType);
Assert.Equal(expected, actual);
}
示例3: 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);
}
示例4: GetModelAsync
/// <inheritdoc/>
public Task<IEdmModel> GetModelAsync(InvocationContext context, CancellationToken cancellationToken)
{
Ensure.NotNull(context, "context");
var model = new EdmModel();
var apiContext = context.ApiContext;
var dbContext = apiContext.GetProperty<DbContext>(DbApiConstants.DbContextKey);
var elementMap = new Dictionary<MetadataItem, IEdmElement>();
var efModel = (dbContext as IObjectContextAdapter)
.ObjectContext.MetadataWorkspace;
var namespaceName = efModel.GetItems<EntityType>(DataSpace.CSpace)
.Select(t => efModel.GetObjectSpaceType(t).NamespaceName)
.GroupBy(nameSpace => nameSpace)
.Select(group => new
{
NameSpace = group.Key,
Count = group.Count(),
})
.OrderByDescending(nsItem => nsItem.Count)
.Select(nsItem => nsItem.NameSpace)
.FirstOrDefault();
if (namespaceName == null)
{
// When dbContext has not a namespace, just use its type name as namespace.
namespaceName = dbContext.GetType().Namespace ?? dbContext.GetType().Name;
}
var efEntityContainer = efModel.GetItems<EntityContainer>(DataSpace.CSpace).Single();
var entityContainer = new EdmEntityContainer(namespaceName, efEntityContainer.Name);
elementMap.Add(efEntityContainer, entityContainer);
// TODO GitHubIssue#36 : support complex and enumeration types
foreach (var efEntitySet in efEntityContainer.EntitySets)
{
var efEntityType = efEntitySet.ElementType;
if (elementMap.ContainsKey(efEntityType))
{
continue;
}
List<EdmStructuralProperty> concurrencyProperties;
var entityType = CreateEntityType(efModel, efEntityType, model, elementMap, out concurrencyProperties);
model.AddElement(entityType);
elementMap.Add(efEntityType, entityType);
var entitySet = entityContainer.AddEntitySet(efEntitySet.Name, entityType);
if (concurrencyProperties != null)
{
model.SetOptimisticConcurrencyAnnotation(entitySet, concurrencyProperties);
}
elementMap.Add(efEntitySet, entitySet);
}
foreach (var efAssociationSet in efEntityContainer.AssociationSets)
{
AddNavigationProperties(efAssociationSet, elementMap);
AddNavigationPropertyBindings(efAssociationSet, elementMap);
}
// TODO GitHubIssue#36 : support function imports
model.AddElement(entityContainer);
return Task.FromResult<IEdmModel>(model);
}
示例5: GetModelAsync
/// <summary>
/// Asynchronously produces a base model.
/// </summary>
/// <param name="context">
/// The model context.
/// </param>
/// <param name="cancellationToken">
/// A cancellation token.
/// </param>
/// <returns>
/// A task that represents the asynchronous
/// operation whose result is the base model.
/// </returns>
public Task<IEdmModel> GetModelAsync(
InvocationContext context,
CancellationToken cancellationToken)
{
var model = new EdmModel();
var domainContext = context.ApiContext;
var dbContext = domainContext.GetProperty<DbContext>(DbApiConstants.DbContextKey);
var elementMap = new Dictionary<IAnnotatable, IEdmElement>();
var efModel = dbContext.Model;
var namespaceName = efModel.EntityTypes
.Select(t => t.HasClrType() ? t.ClrType.Namespace : null)
.Where(t => t != null)
.GroupBy(nameSpace => nameSpace)
.Select(group => new
{
NameSpace = group.Key,
Count = group.Count(),
})
.OrderByDescending(nsItem => nsItem.Count)
.Select(nsItem => nsItem.NameSpace)
.FirstOrDefault();
if (namespaceName == null)
{
// When dbContext has not a namespace, just use its type name as namespace.
namespaceName = dbContext.GetType().Namespace ?? dbContext.GetType().Name;
}
var entityTypes = efModel.EntityTypes;
var entityContainer = new EdmEntityContainer(
namespaceName, "Container");
var dbSetProperties = dbContext.GetType().
GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance).
Where(e => e.PropertyType.IsGenericType && e.PropertyType.GetGenericTypeDefinition() == typeof(DbSet<>)).
ToDictionary(e => e.PropertyType.GetGenericArguments()[0]);
// TODO GitHubIssue#36 : support complex and entity inheritance
foreach (var efEntityType in entityTypes)
{
if (elementMap.ContainsKey(efEntityType))
{
continue;
}
List<EdmStructuralProperty> concurrencyProperties;
var entityType = ModelProducer.CreateEntityType(
efModel, efEntityType, model, out concurrencyProperties);
model.AddElement(entityType);
elementMap.Add(efEntityType, entityType);
System.Reflection.PropertyInfo propInfo;
if (dbSetProperties.TryGetValue(efEntityType.ClrType, out propInfo))
{
var entitySet = entityContainer.AddEntitySet(propInfo.Name, entityType);
if (concurrencyProperties != null)
{
model.SetOptimisticConcurrencyAnnotation(entitySet, concurrencyProperties);
}
}
}
foreach (var efEntityType in entityTypes)
{
foreach (var navi in efEntityType.GetNavigations())
{
ModelProducer.AddNavigationProperties(
efModel, navi, model, elementMap);
ModelProducer.AddNavigationPropertyBindings(
efModel, navi, entityContainer, elementMap);
}
}
// TODO GitHubIssue#36 : support function imports
model.AddElement(entityContainer);
return Task.FromResult<IEdmModel>(model);
}
示例6: CreateTripPinServiceModel
//.........这里部分代码省略.........
var me = new EdmSingleton(defaultContainer, "Me", personType);
defaultContainer.AddElement(me);
personSet.AddNavigationTarget(friendsnNavigation, personSet);
me.AddNavigationTarget(friendsnNavigation, personSet);
personSet.AddNavigationTarget(flightAirlineNavigation, airlineSet);
me.AddNavigationTarget(flightAirlineNavigation, airlineSet);
personSet.AddNavigationTarget(flightFromAirportNavigation, airportSet);
me.AddNavigationTarget(flightFromAirportNavigation, airportSet);
personSet.AddNavigationTarget(flightToAirportNavigation, airportSet);
me.AddNavigationTarget(flightToAirportNavigation, airportSet);
personSet.AddNavigationTarget(personPhotoNavigation, photoSet);
me.AddNavigationTarget(personPhotoNavigation, photoSet);
personSet.AddNavigationTarget(tripPhotosNavigation, photoSet);
me.AddNavigationTarget(tripPhotosNavigation, photoSet);
var getFavoriteAirlineFunction = new EdmFunction(ns, "GetFavoriteAirline",
new EdmEntityTypeReference(airlineType, false), true,
new EdmPathExpression("person/Trips/PlanItems/Microsoft.OData.SampleService.Models.TripPin.Flight/Airline"), true);
getFavoriteAirlineFunction.AddParameter("person", new EdmEntityTypeReference(personType, false));
model.AddElement(getFavoriteAirlineFunction);
var getInvolvedPeopleFunction = new EdmFunction(ns, "GetInvolvedPeople",
new EdmCollectionTypeReference(new EdmCollectionType(new EdmEntityTypeReference(personType, false))), true, null, true);
getInvolvedPeopleFunction.AddParameter("trip", new EdmEntityTypeReference(tripType, false));
model.AddElement(getInvolvedPeopleFunction);
var getFriendsTripsFunction = new EdmFunction(ns, "GetFriendsTrips",
new EdmCollectionTypeReference(new EdmCollectionType(new EdmEntityTypeReference(tripType, false))),
true, new EdmPathExpression("person/Friends/Trips"), true);
getFriendsTripsFunction.AddParameter("person", new EdmEntityTypeReference(personType, false));
getFriendsTripsFunction.AddParameter("userName", EdmCoreModel.Instance.GetString(false));
model.AddElement(getFriendsTripsFunction);
var getNearestAirport = new EdmFunction(ns, "GetNearestAirport",
new EdmEntityTypeReference(airportType, false),
false, null, true);
getNearestAirport.AddParameter("lat", EdmCoreModel.Instance.GetDouble(false));
getNearestAirport.AddParameter("lon", EdmCoreModel.Instance.GetDouble(false));
model.AddElement(getNearestAirport);
var getNearestAirportFunctionImport = (IEdmFunctionImport)defaultContainer.AddFunctionImport("GetNearestAirport", getNearestAirport, new EdmEntitySetReferenceExpression(airportSet), true);
var resetDataSourceAction = new EdmAction(ns, "ResetDataSource", null, false, null);
model.AddElement(resetDataSourceAction);
defaultContainer.AddActionImport(resetDataSourceAction);
var shareTripAction = new EdmAction(ns, "ShareTrip", null, true, null);
shareTripAction.AddParameter("person", new EdmEntityTypeReference(personType, false));
shareTripAction.AddParameter("userName", EdmCoreModel.Instance.GetString(false));
shareTripAction.AddParameter("tripId", EdmCoreModel.Instance.GetInt32(false));
model.AddElement(shareTripAction);
model.SetDescriptionAnnotation(defaultContainer, "TripPin service is a sample service for OData V4.");
model.SetOptimisticConcurrencyAnnotation(personSet, personType.StructuralProperties().Where(p => p.Name == "Concurrency"));
// TODO: currently singleton does not support ETag feature
// model.SetOptimisticConcurrencyAnnotation(me, personType.StructuralProperties().Where(p => p.Name == "Concurrency"));
model.SetResourcePathCoreAnnotation(personSet, "People");
model.SetResourcePathCoreAnnotation(me, "Me");
model.SetResourcePathCoreAnnotation(airlineSet, "Airlines");
model.SetResourcePathCoreAnnotation(airportSet, "Airports");
model.SetResourcePathCoreAnnotation(photoSet, "Photos");
model.SetResourcePathCoreAnnotation(getNearestAirportFunctionImport, "Microsoft.OData.SampleService.Models.TripPin.GetNearestAirport");
model.SetDereferenceableIDsCoreAnnotation(defaultContainer, true);
model.SetConventionalIDsCoreAnnotation(defaultContainer, true);
model.SetPermissionsCoreAnnotation(personType.FindProperty("UserName"), CorePermission.Read);
model.SetPermissionsCoreAnnotation(airlineType.FindProperty("AirlineCode"), CorePermission.Read);
model.SetPermissionsCoreAnnotation(airportType.FindProperty("IcaoCode"), CorePermission.Read);
model.SetPermissionsCoreAnnotation(planItemType.FindProperty("PlanItemId"), CorePermission.Read);
model.SetPermissionsCoreAnnotation(tripType.FindProperty("TripId"), CorePermission.Read);
model.SetPermissionsCoreAnnotation(photoType.FindProperty("Id"), CorePermission.Read);
model.SetImmutableCoreAnnotation(airportType.FindProperty("IataCode"), true);
model.SetComputedCoreAnnotation(personType.FindProperty("Concurrency"), true);
model.SetAcceptableMediaTypesCoreAnnotation(photoType, new[] { "image/jpeg" });
model.SetConformanceLevelCapabilitiesAnnotation(defaultContainer, CapabilitiesConformanceLevelType.Advanced);
model.SetSupportedFormatsCapabilitiesAnnotation(defaultContainer, new[] { "application/json;odata.metadata=full;IEEE754Compatible=false;odata.streaming=true", "application/json;odata.metadata=minimal;IEEE754Compatible=false;odata.streaming=true", "application/json;odata.metadata=none;IEEE754Compatible=false;odata.streaming=true" });
model.SetAsynchronousRequestsSupportedCapabilitiesAnnotation(defaultContainer, true);
model.SetBatchContinueOnErrorSupportedCapabilitiesAnnotation(defaultContainer, false);
model.SetNavigationRestrictionsCapabilitiesAnnotation(personSet, CapabilitiesNavigationType.None, new[] { new Tuple<IEdmNavigationProperty, CapabilitiesNavigationType>(friendsnNavigation, CapabilitiesNavigationType.Recursive) });
model.SetFilterFunctionsCapabilitiesAnnotation(defaultContainer, new[] { "contains", "endswith", "startswith", "length", "indexof", "substring", "tolower", "toupper", "trim", "concat", "year", "month", "day", "hour", "minute", "second", "round", "floor", "ceiling", "cast", "isof" });
model.SetSearchRestrictionsCapabilitiesAnnotation(personSet, true, CapabilitiesSearchExpressions.None);
model.SetSearchRestrictionsCapabilitiesAnnotation(airlineSet, true, CapabilitiesSearchExpressions.None);
model.SetSearchRestrictionsCapabilitiesAnnotation(airportSet, true, CapabilitiesSearchExpressions.None);
model.SetSearchRestrictionsCapabilitiesAnnotation(photoSet, true, CapabilitiesSearchExpressions.None);
model.SetInsertRestrictionsCapabilitiesAnnotation(personSet, true, new[] { personTripNavigation, friendsnNavigation });
model.SetInsertRestrictionsCapabilitiesAnnotation(airlineSet, true, null);
model.SetInsertRestrictionsCapabilitiesAnnotation(airportSet, false, null);
model.SetInsertRestrictionsCapabilitiesAnnotation(photoSet, true, null);
// TODO: model.SetUpdateRestrictionsCapabilitiesAnnotation();
model.SetDeleteRestrictionsCapabilitiesAnnotation(airportSet, false, null);
model.SetISOCurrencyMeasuresAnnotation(tripType.FindProperty("Budget"), "USD");
model.SetScaleMeasuresAnnotation(tripType.FindProperty("Budget"), 2);
return model;
}
示例7: CustomersModelWithInheritance
//.........这里部分代码省略.........
{
Name = "OrderLines",
TargetMultiplicity = EdmMultiplicity.Many,
Target = orderLine,
ContainsTarget = true,
});
EdmNavigationProperty nonContainedOrderLinesNavProp = myOrder.AddUnidirectionalNavigation(
new EdmNavigationPropertyInfo
{
Name = "NonContainedOrderLines",
TargetMultiplicity = EdmMultiplicity.Many,
Target = orderLine,
ContainsTarget = false,
});
EdmAction tag = new EdmAction("NS", "tag", returnType: null, isBound: true, entitySetPathExpression: null);
tag.AddParameter("entity", new EdmEntityTypeReference(orderLine, false));
model.AddElement(tag);
// entity sets
EdmEntityContainer container = new EdmEntityContainer("NS", "ModelWithInheritance");
model.AddElement(container);
EdmEntitySet customers = container.AddEntitySet("Customers", customer);
EdmEntitySet orders = container.AddEntitySet("Orders", order);
EdmEntitySet myOrders = container.AddEntitySet("MyOrders", myOrder);
// singletons
EdmSingleton vipCustomer = container.AddSingleton("VipCustomer", customer);
EdmSingleton mary = container.AddSingleton("Mary", customer);
EdmSingleton rootOrder = container.AddSingleton("RootOrder", order);
// annotations
model.SetOptimisticConcurrencyAnnotation(customers, new[] { city });
// containment
IEdmContainedEntitySet orderLines = (IEdmContainedEntitySet)myOrders.FindNavigationTarget(orderLinesNavProp);
// no-containment
IEdmNavigationSource nonContainedOrderLines = myOrders.FindNavigationTarget(nonContainedOrderLinesNavProp);
// actions
EdmAction upgrade = new EdmAction("NS", "upgrade", returnType: null, isBound: true, entitySetPathExpression: null);
upgrade.AddParameter("entity", new EdmEntityTypeReference(customer, false));
model.AddElement(upgrade);
EdmAction specialUpgrade =
new EdmAction("NS", "specialUpgrade", returnType: null, isBound: true, entitySetPathExpression: null);
specialUpgrade.AddParameter("entity", new EdmEntityTypeReference(specialCustomer, false));
model.AddElement(specialUpgrade);
// actions bound to collection
EdmAction upgradeAll = new EdmAction("NS", "UpgradeAll", returnType: null, isBound: true, entitySetPathExpression: null);
upgradeAll.AddParameter("entityset",
new EdmCollectionTypeReference(new EdmCollectionType(new EdmEntityTypeReference(customer, false))));
model.AddElement(upgradeAll);
EdmAction upgradeSpecialAll = new EdmAction("NS", "UpgradeSpecialAll", returnType: null, isBound: true, entitySetPathExpression: null);
upgradeSpecialAll.AddParameter("entityset",
new EdmCollectionTypeReference(new EdmCollectionType(new EdmEntityTypeReference(specialCustomer, false))));
model.AddElement(upgradeSpecialAll);
// functions
IEdmTypeReference returnType = EdmCoreModel.Instance.GetPrimitive(EdmPrimitiveTypeKind.Boolean, isNullable: false);
IEdmTypeReference stringType = EdmCoreModel.Instance.GetPrimitive(EdmPrimitiveTypeKind.String, isNullable: false);
IEdmTypeReference intType = EdmCoreModel.Instance.GetPrimitive(EdmPrimitiveTypeKind.Int32, isNullable: false);
示例8: TestCoreOptimisticConcurrencyInlineAnnotation
public void TestCoreOptimisticConcurrencyInlineAnnotation()
{
EdmModel model = new EdmModel();
EdmEntityContainer container = new EdmEntityContainer("DefaultNamespace", "Container");
EdmEntityType personType = new EdmEntityType("DefaultNamespace", "Person");
EdmStructuralProperty propertyId = personType.AddStructuralProperty("Id", EdmCoreModel.Instance.GetInt32(false));
personType.AddKeys(propertyId);
IEdmStructuralProperty concurrencyProperty = personType.AddStructuralProperty("Concurrency", EdmCoreModel.Instance.GetInt32(true));
model.AddElement(personType);
container.AddEntitySet("People", personType);
model.AddElement(container);
container.AddEntitySet("Students", personType);
IEdmEntitySet peopleSet = model.FindDeclaredEntitySet("People");
model.SetOptimisticConcurrencyAnnotation(peopleSet, new[] { concurrencyProperty });
model.SetOptimisticConcurrencyAnnotation(peopleSet, new[] { concurrencyProperty });
IEdmEntitySet studentSet = model.FindDeclaredEntitySet("Students");
model.SetOptimisticConcurrencyAnnotation(studentSet, new[] { concurrencyProperty });
IEnumerable<EdmError> errors;
StringWriter sw = new StringWriter();
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.Encoding = System.Text.Encoding.UTF8;
XmlWriter xw = XmlWriter.Create(sw, settings);
model.TryWriteCsdl(xw, out errors);
xw.Flush();
xw.Close();
var actual = sw.ToString();
const string expected = @"<?xml version=""1.0"" encoding=""utf-16""?>
<Schema Namespace=""DefaultNamespace"" xmlns=""http://docs.oasis-open.org/odata/ns/edm"">
<EntityType Name=""Person"">
<Key>
<PropertyRef Name=""Id"" />
</Key>
<Property Name=""Id"" Type=""Edm.Int32"" Nullable=""false"" />
<Property Name=""Concurrency"" Type=""Edm.Int32"" />
</EntityType>
<EntityContainer Name=""Container"">
<EntitySet Name=""People"" EntityType=""DefaultNamespace.Person"">
<Annotation Term=""Org.OData.Core.V1.OptimisticConcurrency"">
<Collection>
<PropertyPath>Concurrency</PropertyPath>
</Collection>
</Annotation>
</EntitySet>
<EntitySet Name=""Students"" EntityType=""DefaultNamespace.Person"">
<Annotation Term=""Org.OData.Core.V1.OptimisticConcurrency"">
<Collection>
<PropertyPath>Concurrency</PropertyPath>
</Collection>
</Annotation>
</EntitySet>
</EntityContainer>
</Schema>";
Assert.AreEqual(expected, actual);
}