本文整理汇总了C#中Microsoft.OData.Edm.Library.EdmEntityType.StructuralProperties方法的典型用法代码示例。如果您正苦于以下问题:C# EdmEntityType.StructuralProperties方法的具体用法?C# EdmEntityType.StructuralProperties怎么用?C# EdmEntityType.StructuralProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.OData.Edm.Library.EdmEntityType
的用法示例。
在下文中一共展示了EdmEntityType.StructuralProperties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}