public void TargetOnEntitySetReturnsCorrectSkipSupportedValue(EdmVocabularyAnnotationSerializationLocation location) { // Arrange const string template = @" <Annotations Target=""NS.Default/Calendars""> {0} </Annotations>"; IEdmModel model = GetEdmModel(template, location); Assert.NotNull(model); // guard IEdmEntitySet calendars = model.EntityContainer.FindEntitySet("Calendars"); Assert.NotNull(calendars); // guard // Act SkipSupported skip = new SkipSupported(); bool result = skip.Load(model, calendars); // Assert Assert.True(result); Assert.NotNull(skip.Supported); Assert.False(skip.Supported.Value); }
public void TargetOnEntitySetReturnsCorrectNavigationRestrictionsValue(EdmVocabularyAnnotationSerializationLocation location) { // Arrange const string template = @" <Annotations Target=""NS.Default/Calendars""> {0} </Annotations>"; IEdmModel model = GetEdmModel(template, location); Assert.NotNull(model); // guard IEdmEntitySet calendars = model.EntityContainer.FindEntitySet("Calendars"); // Act NavigationRestrictionsType navigation = model.GetRecord <NavigationRestrictionsType>(calendars); // Assert VerifyNavigationRestrictions(navigation); NavigationPropertyRestriction navRestriction = navigation.RestrictedProperties.Last(); Assert.NotNull(navRestriction.Navigability); Assert.Equal(NavigationType.None, navRestriction.Navigability.Value); Assert.Equal("xyz", navRestriction.NavigationProperty); Assert.True(navigation.IsRestrictedProperty("xyz")); }
public void TargetOnEntityTypeReturnsCorrectIndexableByKeyValue(EdmVocabularyAnnotationSerializationLocation location) { // Arrange const string template = @" <Annotations Target=""NS.Calendar""> {0} </Annotations>"; IEdmModel model = GetEdmModel(template, location); Assert.NotNull(model); // guard IEdmEntitySet calendars = model.EntityContainer.FindEntitySet("Calendars"); Assert.NotNull(calendars); // guard // Act IndexableByKey index = new IndexableByKey(); bool result = index.Load(model, calendars); // Assert Assert.True(result); Assert.NotNull(index.Supported); Assert.False(index.Supported.Value); }
public void TargetOnEntityTypeReturnsCorrectSkipSupportedValue(EdmVocabularyAnnotationSerializationLocation location) { // Arrange const string template = @" <Annotations Target=""NS.Calendar""> {0} </Annotations>"; IEdmModel model = GetEdmModel(template, location); Assert.NotNull(model); // guard IEdmEntityType calendar = model.SchemaElements.OfType <IEdmEntityType>().First(c => c.Name == "Calendar"); Assert.NotNull(calendar); // guard // Act SkipSupported skip = new SkipSupported(); bool result = skip.Load(model, calendar); // Assert Assert.True(result); Assert.False(skip.IsSupported); Assert.NotNull(skip.Supported); Assert.False(skip.Supported.Value); }
private static IEdmModel GetEdmModel(string template, EdmVocabularyAnnotationSerializationLocation location) { string countAnnotation = @" <Annotation Term=""Org.OData.Capabilities.V1.FilterRestrictions"" > <Record> <PropertyValue Property=""Filterable"" Bool=""false"" /> <PropertyValue Property=""RequiresFilter"" Bool=""false"" /> <PropertyValue Property=""RequiredProperties"" > <Collection> <PropertyPath>Id</PropertyPath> </Collection> </PropertyValue> <PropertyValue Property=""NonFilterableProperties"" > <Collection> <PropertyPath>Emails</PropertyPath> </Collection> </PropertyValue> </Record> </Annotation>"; if (location == EdmVocabularyAnnotationSerializationLocation.OutOfLine) { countAnnotation = string.Format(template, countAnnotation); return(CapabilitiesModelHelper.GetEdmModelOutline(countAnnotation)); } else { return(CapabilitiesModelHelper.GetEdmModelTypeInline(countAnnotation)); } }
private static IEdmModel GetEdmModel(string template, EdmVocabularyAnnotationSerializationLocation location) { string countAnnotation = @" <Annotation Term=""Org.OData.Capabilities.V1.UpdateRestrictions"" > <Record> <PropertyValue Property=""Updatable"" Bool=""false"" /> <PropertyValue Property=""NonUpdatableNavigationProperties"" > <Collection> <NavigationPropertyPath>abc</NavigationPropertyPath> <NavigationPropertyPath>RelatedEvents</NavigationPropertyPath> </Collection> </PropertyValue> </Record> </Annotation>"; if (location == EdmVocabularyAnnotationSerializationLocation.OutOfLine) { countAnnotation = string.Format(template, countAnnotation); return(CapabilitiesModelHelper.GetEdmModelOutline(countAnnotation)); } else { return(CapabilitiesModelHelper.GetEdmModelTypeInline(countAnnotation)); } }
private static IEdmModel GetEdmModel(string template, EdmVocabularyAnnotationSerializationLocation location, bool navInLine = false) { string countAnnotation = @" <Annotation Term=""Org.OData.Capabilities.V1.SortRestrictions"" > <Record> <PropertyValue Property=""Sortable"" Bool=""false"" /> <PropertyValue Property=""AscendingOnlyProperties"" > <Collection> <PropertyPath>abc</PropertyPath> </Collection> </PropertyValue> <PropertyValue Property=""DescendingOnlyProperties"" > <Collection> <PropertyPath>rst</PropertyPath> </Collection> </PropertyValue> <PropertyValue Property=""NonSortableProperties"" > <Collection> <PropertyPath>Emails</PropertyPath> </Collection> </PropertyValue> </Record> </Annotation>"; if (location == EdmVocabularyAnnotationSerializationLocation.OutOfLine) { countAnnotation = string.Format(template, countAnnotation); return(CapabilitiesModelHelper.GetEdmModelOutline(countAnnotation)); } else { return(CapabilitiesModelHelper.GetEdmModelTypeInline(countAnnotation)); } }
public void TargetOnEntitySetReturnsCorrectNavigationRestrictionsValue(EdmVocabularyAnnotationSerializationLocation location) { // Arrange const string outOfLineTemplate = @" <Annotations Target=""NS.Default/Calendars""> {0} </Annotations>"; string navigationAnnotation = @" <Annotation Term=""Org.OData.Capabilities.V1.NavigationRestrictions"" > <Record> <PropertyValue Property=""Navigability"" > <EnumMember>Org.OData.Capabilities.V1.NavigationType/Recursive</EnumMember> </PropertyValue> <PropertyValue Property=""RestrictedProperties"" > <Collection> <Record> <PropertyValue Property=""Navigability"" > <EnumMember>Org.OData.Capabilities.V1.NavigationType/Single</EnumMember> </PropertyValue> <PropertyValue Property=""NavigationProperty"" NavigationPropertyPath=""abc"" /> </Record> <Record> <PropertyValue Property=""Navigability"" > <EnumMember>Org.OData.Capabilities.V1.NavigationType/None</EnumMember> </PropertyValue> <PropertyValue Property=""NavigationProperty"" NavigationPropertyPath=""xyz"" /> </Record> </Collection> </PropertyValue> </Record> </Annotation>"; IEdmModel model; if (location == EdmVocabularyAnnotationSerializationLocation.OutOfLine) { navigationAnnotation = string.Format(outOfLineTemplate, navigationAnnotation); model = CapabilitiesModelHelper.GetEdmModelOutline(navigationAnnotation); } else { model = CapabilitiesModelHelper.GetEdmModelTypeInline(navigationAnnotation); } IEdmEntitySet calendars = model.EntityContainer.FindEntitySet("Calendars"); // Act NavigationRestrictions navigation = new NavigationRestrictions(); bool result = navigation.Load(model, calendars); // Assert Assert.True(result); VerifyNavigationRestrictions(navigation); NavigationPropertyRestriction navRestriction = navigation.RestrictedProperties.Last(); Assert.NotNull(navRestriction.Navigability); Assert.Equal(NavigationType.None, navRestriction.Navigability.Value); Assert.Equal("xyz", navRestriction.NavigationProperty); Assert.True(navigation.IsRestrictedProperty("xyz")); }
public void TargetOnEntitySetReturnsCorrectExpandRestrictionsValue(EdmVocabularyAnnotationSerializationLocation location) { // Arrange const string template = @" <Annotations Target=""NS.Default/Calendars""> {0} </Annotations>"; IEdmModel model = GetEdmModel(template, location); Assert.NotNull(model); // guard IEdmEntitySet calendars = model.EntityContainer.FindEntitySet("Calendars"); Assert.NotNull(calendars); // guard // Act // Act ExpandRestrictions expand = new ExpandRestrictions(); bool result = expand.Load(model, calendars); // Assert Assert.True(result); VerifyExpandRestrictions(expand); }
private static IEdmModel GetEdmModel(string template, EdmVocabularyAnnotationSerializationLocation location) { string countAnnotation = @"<Annotation Term=""Org.OData.Capabilities.V1.SkipSupported"" Bool=""false"" />"; if (location == EdmVocabularyAnnotationSerializationLocation.OutOfLine) { countAnnotation = string.Format(template, countAnnotation); return(CapabilitiesModelHelper.GetEdmModelOutline(countAnnotation)); } else { return(CapabilitiesModelHelper.GetEdmModelTypeInline(countAnnotation)); } }
public void EntitySetContainerReturnsCorrectKeyAsSegmentSupportedValue(EdmVocabularyAnnotationSerializationLocation location, bool support) { // Arrange IEdmModel model = GetEdmModel(location, support); Assert.NotNull(model); // guard // Act bool?result = model.GetBoolean(model.EntityContainer, CapabilitiesConstants.KeyAsSegmentSupported); // Assert Assert.NotNull(result); Assert.Equal(support, result.Value); }
private static IEdmModel GetEdmModel(string template, EdmVocabularyAnnotationSerializationLocation location) { string countAnnotation = @" <Annotation Term=""Org.OData.Capabilities.V1.InsertRestrictions"" > <Record> <PropertyValue Property=""Insertable"" Bool=""false"" /> <PropertyValue Property=""NonInsertableProperties"" > <Collection> <PropertyPath>abc/xyz</PropertyPath> </Collection> </PropertyValue> <PropertyValue Property=""NonInsertableNavigationProperties"" > <Collection> <NavigationPropertyPath>abc</NavigationPropertyPath> <NavigationPropertyPath>RelatedEvents</NavigationPropertyPath> </Collection> </PropertyValue> <PropertyValue Property=""MaxLevels"" Int=""8"" /> <PropertyValue Property=""CustomQueryOptions"" > <Collection> <Record> <PropertyValue Property=""Name"" String=""primitive name"" /> <PropertyValue Property=""Description"" String=""primitive desc"" /> <PropertyValue Property=""DocumentationURL"" String=""http://any3"" /> <PropertyValue Property=""Required"" Bool=""true"" /> <PropertyValue Property=""ExampleValues""> <Collection> <Record> <PropertyValue Property=""Description"" String=""example desc"" /> <PropertyValue Property=""Value"" String=""example value"" /> </Record> </Collection> </PropertyValue> </Record> </Collection> </PropertyValue> </Record> </Annotation>"; if (location == EdmVocabularyAnnotationSerializationLocation.OutOfLine) { countAnnotation = string.Format(template, countAnnotation); return(CapabilitiesModelHelper.GetEdmModelOutline(countAnnotation)); } else { return(CapabilitiesModelHelper.GetEdmModelTypeInline(countAnnotation)); } }
public void EntitySetContainerReturnsCorrectKeyAsSegmentSupportedValue(EdmVocabularyAnnotationSerializationLocation location, bool support) { // Arrange IEdmModel model = GetEdmModel(location, support); Assert.NotNull(model); // guard // Act KeyAsSegmentSupported KeyAsSegmentSupported = new KeyAsSegmentSupported(); bool result = KeyAsSegmentSupported.Load(model, model.EntityContainer); // Assert Assert.True(result); Assert.NotNull(KeyAsSegmentSupported.Supported); Assert.Equal(support, KeyAsSegmentSupported.Supported.Value); }
private static IEdmModel GetEdmModel(EdmVocabularyAnnotationSerializationLocation location, bool supported) { EdmModel model = new EdmModel(); EdmEntityContainer container = new EdmEntityContainer("NS", "Default"); model.AddElement(container); IEdmTerm term = model.FindTerm(CapabilitiesConstants.KeyAsSegmentSupported); Assert.NotNull(term); IEdmBooleanConstantExpression boolean = new EdmBooleanConstant(supported); EdmVocabularyAnnotation annotation = new EdmVocabularyAnnotation(container, term, boolean); annotation.SetSerializationLocation(model, location); model.SetVocabularyAnnotation(annotation); return(model); }
public void TargetOnEntityTypeReturnsCorrectNavigationRestrictionsValue(EdmVocabularyAnnotationSerializationLocation location) { // Arrange const string template = @" <Annotations Target=""NS.Calendar""> {0} </Annotations>"; IEdmModel model = GetEdmModel(template, location); Assert.NotNull(model); // guard IEdmEntitySet calendars = model.EntityContainer.FindEntitySet("Calendars"); // Act NavigationRestrictionsType navigation = model.GetRecord <NavigationRestrictionsType>(calendars); // Assert VerifyNavigationRestrictions(navigation); }
private static IEdmModel GetEdmModel(string template, EdmVocabularyAnnotationSerializationLocation location) { string annotation = @" <Annotation Term=""Org.OData.Capabilities.V1.DeleteRestrictions"" > <Record> <PropertyValue Property=""Deletable"" Bool=""false"" /> <PropertyValue Property=""NonDeletableNavigationProperties"" > <Collection> <NavigationPropertyPath>abc</NavigationPropertyPath> <NavigationPropertyPath>RelatedEvents</NavigationPropertyPath> </Collection> </PropertyValue> <PropertyValue Property=""MaxLevels"" Int=""42"" /> <PropertyValue Property=""Permissions""> <Collection> <Record> <PropertyValue Property=""SchemeName"" String=""schemeName"" /> </Record> </Collection> </PropertyValue> <PropertyValue Property=""CustomQueryOptions"" > <Collection> <Record> <PropertyValue Property=""Name"" String=""odata-debug"" /> <PropertyValue Property=""DocumentationURL"" String=""https://debug.html"" /> </Record> </Collection> </PropertyValue> </Record> </Annotation>"; if (location == EdmVocabularyAnnotationSerializationLocation.OutOfLine) { annotation = string.Format(template, annotation); return(CapabilitiesModelHelper.GetEdmModelOutline(annotation)); } else { return(CapabilitiesModelHelper.GetEdmModelTypeInline(annotation)); } }
private static IEdmModel GetEdmModel(string template, EdmVocabularyAnnotationSerializationLocation location) { string navigationAnnotation = @" <Annotation Term=""Org.OData.Capabilities.V1.NavigationRestrictions"" > <Record> <PropertyValue Property=""Navigability"" > <EnumMember>Org.OData.Capabilities.V1.NavigationType/Recursive</EnumMember> </PropertyValue> <PropertyValue Property=""RestrictedProperties"" > <Collection> <Record> <PropertyValue Property=""Navigability"" > <EnumMember>Org.OData.Capabilities.V1.NavigationType/Single</EnumMember> </PropertyValue> <PropertyValue Property=""NavigationProperty"" NavigationPropertyPath=""abc"" /> <PropertyValue Property=""SkipSupported"" Bool=""false"" /> </Record> <Record> <PropertyValue Property=""Navigability"" > <EnumMember>Org.OData.Capabilities.V1.NavigationType/None</EnumMember> </PropertyValue> <PropertyValue Property=""NavigationProperty"" NavigationPropertyPath=""xyz"" /> <PropertyValue Property=""OptimisticConcurrencyControl"" Bool=""true"" /> </Record> </Collection> </PropertyValue> </Record> </Annotation>"; if (location == EdmVocabularyAnnotationSerializationLocation.OutOfLine) { navigationAnnotation = string.Format(template, navigationAnnotation); return(CapabilitiesModelHelper.GetEdmModelOutline(navigationAnnotation)); } else { return(CapabilitiesModelHelper.GetEdmModelTypeInline(navigationAnnotation)); } }
public void TargetOnEntityTypeReturnsCorrectUpdateRestrictionsValue(EdmVocabularyAnnotationSerializationLocation location) { // Arrange const string template = @" <Annotations Target=""NS.Calendar""> {0} </Annotations>"; IEdmModel model = GetEdmModel(template, location); Assert.NotNull(model); // guard IEdmEntityType calendar = model.SchemaElements.OfType <IEdmEntityType>().First(c => c.Name == "Calendar"); Assert.NotNull(calendar); // guard // Act UpdateRestrictionsType update = model.GetRecord <UpdateRestrictionsType>(calendar); // Assert VerifyUpdateRestrictions(update); }
private static IEdmModel GetEdmModel(string template, EdmVocabularyAnnotationSerializationLocation location) { string countAnnotation = @" <Annotation Term=""Org.OData.Capabilities.V1.ReadRestrictions"" > <Record> <PropertyValue Property=""Readable"" Bool=""false"" /> <PropertyValue Property=""CustomQueryOptions"" > <Collection> <Record> <PropertyValue Property=""Name"" String=""root query name"" /> </Record> </Collection> </PropertyValue> <PropertyValue Property=""ReadByKeyRestrictions""> <Record> <PropertyValue Property=""Readable"" Bool=""true"" /> <PropertyValue Property=""CustomHeaders"" > <Collection> <Record> <PropertyValue Property=""Name"" String=""by key head name"" /> </Record> </Collection> </PropertyValue> </Record> </PropertyValue> </Record> </Annotation>"; if (location == EdmVocabularyAnnotationSerializationLocation.OutOfLine) { countAnnotation = string.Format(template, countAnnotation); return(CapabilitiesModelHelper.GetEdmModelOutline(countAnnotation)); } else { return(CapabilitiesModelHelper.GetEdmModelTypeInline(countAnnotation)); } }
public void TargetOnEntityTypeReturnsCorrectSortRestrictionsValue(EdmVocabularyAnnotationSerializationLocation location) { // Arrange const string template = @" <Annotations Target=""NS.Calendar""> {0} </Annotations>"; IEdmModel model = GetEdmModel(template, location); Assert.NotNull(model); // guard IEdmEntityType calendar = model.SchemaElements.OfType <IEdmEntityType>().First(c => c.Name == "Calendar"); Assert.NotNull(calendar); // guard // Act SortRestrictions sort = new SortRestrictions(); bool result = sort.Load(model, calendar); // Assert Assert.True(result); VerifySortRestrictions(sort); }
public void TargetOnEntityTypeReturnsCorrectfilterRestrictionsValue(EdmVocabularyAnnotationSerializationLocation location) { // Arrange const string template = @" <Annotations Target=""NS.Calendar""> {0} </Annotations>"; IEdmModel model = GetEdmModel(template, location); Assert.NotNull(model); // guard IEdmEntitySet calendars = model.EntityContainer.FindEntitySet("Calendars"); Assert.NotNull(calendars); // guard // Act FilterRestrictions filter = new FilterRestrictions(); bool result = filter.Load(model, calendars); // Assert Assert.True(result); VerifyFilterRestrictions(filter); }
public static EdmModel AnnotationWithInvalidTargetModel(EdmVocabularyAnnotationSerializationLocation location) { EdmModel model = VocabularyTestModelBuilder.SimpleModel(); var simpleTerm = model.FindValueTerm("Foo.SimpleTerm"); var entityTerm = model.FindValueTerm("Foo.EntityTerm"); var entityType = model.FindType("Foo.SimpleEntity") as EdmEntityType; var entityTypeProperty = entityType.FindProperty("Int32Value"); var invalidType = new EdmComplexType("Foo", "InvalidType"); var invalidTypeProperty = invalidType.AddStructuralProperty("InvalidValue", EdmCoreModel.Instance.GetString(true)); var invalidTerm = new EdmTerm("Foo", "InvalidTerm", EdmCoreModel.Instance.GetString(false)); var invalidEntitySet = new EdmEntitySet(new EdmEntityContainer("", ""), "InvalidEntitySet", entityType); var invalidFunction = new EdmFunction("Foo", "InvalidFunction", EdmCoreModel.Instance.GetInt32(true)); var invalidFunctionParameter = invalidFunction.AddParameter("InvalidParameter", EdmCoreModel.Instance.GetInt32(true)); model.AddElement(invalidFunction); var invalidFunctionImport = new EdmFunctionImport(new EdmEntityContainer("", ""), "InvalidFunctionImport", invalidFunction); EdmAnnotation valueAnnotationOnContainer = new EdmAnnotation( new EdmEntityContainer("", ""), simpleTerm, new EdmIntegerConstant(1)); valueAnnotationOnContainer.SetSerializationLocation(model, location); model.AddVocabularyAnnotation(valueAnnotationOnContainer); EdmAnnotation valueAnnotationOnEntitySet = new EdmAnnotation( invalidEntitySet, simpleTerm, new EdmIntegerConstant(1)); valueAnnotationOnEntitySet.SetSerializationLocation(model, location); model.AddVocabularyAnnotation(valueAnnotationOnEntitySet); EdmAnnotation valueAnnotationOnType = new EdmAnnotation( invalidType, simpleTerm, new EdmIntegerConstant(1)); valueAnnotationOnType.SetSerializationLocation(model, location); model.AddVocabularyAnnotation(valueAnnotationOnType); EdmAnnotation valueAnnotationOnProperty = new EdmAnnotation( invalidTypeProperty, simpleTerm, new EdmIntegerConstant(1)); valueAnnotationOnProperty.SetSerializationLocation(model, location); model.AddVocabularyAnnotation(valueAnnotationOnProperty); EdmAnnotation valueAnnotationOnTerm = new EdmAnnotation( invalidTerm, simpleTerm, new EdmIntegerConstant(1)); valueAnnotationOnTerm.SetSerializationLocation(model, location); model.AddVocabularyAnnotation(valueAnnotationOnTerm); EdmAnnotation valueAnnotationOnFunction = new EdmAnnotation( invalidFunction, simpleTerm, new EdmIntegerConstant(1)); valueAnnotationOnFunction.SetSerializationLocation(model, location); model.AddVocabularyAnnotation(valueAnnotationOnFunction); EdmAnnotation valueAnnotationOnParameter = new EdmAnnotation( invalidFunctionParameter, simpleTerm, new EdmIntegerConstant(1)); valueAnnotationOnParameter.SetSerializationLocation(model, location); model.AddVocabularyAnnotation(valueAnnotationOnParameter); EdmAnnotation valueAnnotationOnFunctionImport = new EdmAnnotation( invalidFunctionImport, simpleTerm, new EdmIntegerConstant(1)); valueAnnotationOnFunctionImport.SetSerializationLocation(model, location); model.AddVocabularyAnnotation(valueAnnotationOnFunctionImport); EdmAnnotation valueAnnotation = new EdmAnnotation( new EdmEntityContainer("", ""), entityTerm, new EdmRecordExpression(new EdmPropertyConstructor(entityTypeProperty.Name, new EdmIntegerConstant(1)))); valueAnnotation.SetSerializationLocation(model, location); model.AddVocabularyAnnotation(valueAnnotation); return model; }
/// <summary> /// Initializes a DerivedTypeContraintSet instance with a base type specified. /// </summary> /// <param name="location">The location for the annotation.</param> public DerivedTypeConstraintConfiguration(EdmVocabularyAnnotationSerializationLocation location) { Location = location; ConstraintSet = new HashSet <Type>(); }
public static void SetSerializationLocation(this IEdmVocabularyAnnotation annotation, IEdmModel model, EdmVocabularyAnnotationSerializationLocation? location) { EdmUtil.CheckArgumentNull<IEdmVocabularyAnnotation>(annotation, "annotation"); EdmUtil.CheckArgumentNull<IEdmModel>(model, "model"); model.SetAnnotationValue(annotation, "http://schemas.microsoft.com/ado/2011/04/edm/internal", "AnnotationSerializationLocation", location); }
/// <summary> /// Sets the location an annotation should be serialized in. /// </summary> /// <param name="annotation">The annotation the location is being specified for.</param> /// <param name="model">Model containing the annotation.</param> /// <param name="location">The location the annotation should appear.</param> public static void SetSerializationLocation(this IEdmVocabularyAnnotation annotation, IEdmModel model, EdmVocabularyAnnotationSerializationLocation? location) { EdmUtil.CheckArgumentNull(annotation, "annotation"); EdmUtil.CheckArgumentNull(model, "model"); model.SetAnnotationValue(annotation, EdmConstants.InternalUri, CsdlConstants.AnnotationSerializationLocationAnnotation, (object)location); }
public static void AddVocabularyAnnotation(this EdmModel model, IEdmVocabularyAnnotation annotation, EdmVocabularyAnnotationSerializationLocation location) { model.AddVocabularyAnnotation(annotation); annotation.SetSerializationLocation(model, location); }
private static IEdmModel GetEdmModel(string template, EdmVocabularyAnnotationSerializationLocation location) { string countAnnotation = @" <Annotation Term=""Org.OData.Capabilities.V1.UpdateRestrictions"" > <Record> <PropertyValue Property=""Updatable"" Bool=""false"" /> <PropertyValue Property=""NonUpdatableNavigationProperties"" > <Collection> <NavigationPropertyPath>abc</NavigationPropertyPath> <NavigationPropertyPath>RelatedEvents</NavigationPropertyPath> </Collection> </PropertyValue> <PropertyValue Property=""MaxLevels"" Int=""8"" /> <PropertyValue Property=""Permissions""> <Collection> <Record Type=""Org.OData.Capabilities.V1.PermissionType""> <PropertyValue Property=""SchemeName"" String=""authorizationName"" /> <PropertyValue Property=""Scopes""> <Collection> <Record Type=""Org.OData.Capabilities.V1.ScopeType""> <PropertyValue Property=""Scope"" String=""scopeName1"" /> <PropertyValue Property=""RestrictedProperties"" String=""p1,p2"" /> </Record> <Record Type=""Org.OData.Capabilities.V1.ScopeType""> <PropertyValue Property=""Scope"" String=""scopeName2"" /> <PropertyValue Property=""RestrictedProperties"" String=""p3,p4"" /> </Record> </Collection> </PropertyValue> </Record> </Collection> </PropertyValue> <PropertyValue Property=""QueryOptions""> <Record> <PropertyValue Property=""ExpandSupported"" Bool=""true"" /> <PropertyValue Property=""SelectSupported"" Bool=""true"" /> <PropertyValue Property=""ComputeSupported"" Bool=""true"" /> <PropertyValue Property=""FilterSupported"" Bool=""true"" /> <PropertyValue Property=""SearchSupported"" Bool=""true"" /> <PropertyValue Property=""SortSupported"" Bool=""false"" /> <PropertyValue Property=""SortSupported"" Bool=""false"" /> </Record> </PropertyValue> <PropertyValue Property=""CustomHeaders""> <Collection> <Record> <PropertyValue Property=""Name"" String=""HeadName1"" /> <PropertyValue Property=""Description"" String=""Description1"" /> <PropertyValue Property=""ComputeSupported"" String=""http://any1"" /> <PropertyValue Property=""Required"" Bool=""true"" /> <PropertyValue Property=""ExampleValues""> <Collection> <Record> <PropertyValue Property=""Description"" String=""Description23"" /> <PropertyValue Property=""Value"" String=""value1"" /> </Record> </Collection> </PropertyValue> </Record> <Record> <PropertyValue Property=""Name"" String=""HeadName2"" /> <PropertyValue Property=""Description"" String=""Description2"" /> <PropertyValue Property=""ComputeSupported"" String=""http://any2"" /> <PropertyValue Property=""Required"" Bool=""false"" /> <PropertyValue Property=""ExampleValues""> <Collection> <Record> <PropertyValue Property=""Description"" String=""Description23"" /> <PropertyValue Property=""Value"" String=""value2"" /> </Record> </Collection> </PropertyValue> </Record> </Collection> </PropertyValue> <PropertyValue Property=""CustomQueryOptions""> <Collection> <Record> <PropertyValue Property=""Name"" String=""HeadName1"" /> <PropertyValue Property=""Description"" String=""Description1"" /> <PropertyValue Property=""ComputeSupported"" String=""http://any3"" /> <PropertyValue Property=""Required"" Bool=""true"" /> <PropertyValue Property=""ExampleValues""> <Collection> <Record> <PropertyValue Property=""Description"" String=""Description23"" /> <PropertyValue Property=""Value"" String=""value3"" /> </Record> </Collection> </PropertyValue> </Record> <Record> <PropertyValue Property=""Name"" String=""HeadName2"" /> <PropertyValue Property=""Description"" String=""Description2"" /> <PropertyValue Property=""ComputeSupported"" String=""http://any4"" /> <PropertyValue Property=""Required"" Bool=""false"" /> <PropertyValue Property=""ExampleValues""> <Collection> <Record> <PropertyValue Property=""Description"" String=""Description23"" /> <PropertyValue Property=""Value"" String=""value4"" /> </Record> </Collection> </PropertyValue> </Record> </Collection> </PropertyValue> </Record> </Annotation>"; if (location == EdmVocabularyAnnotationSerializationLocation.OutOfLine) { countAnnotation = string.Format(template, countAnnotation); return(CapabilitiesModelHelper.GetEdmModelOutline(countAnnotation)); } else { return(CapabilitiesModelHelper.GetEdmModelTypeInline(countAnnotation)); } }