private static IEdmModel GetEdmModel(string template, EdmVocabularyAnnotationSerializationLocation location)
        {
            string countAnnotation = @"
                <Annotation Term=""Org.OData.Capabilities.V1.ExpandRestrictions"" >
                  <Record>
                    <PropertyValue Property=""Expandable"" Bool=""false"" />
                    <PropertyValue Property=""MaxLevels"" Int=""42"" />
                    <PropertyValue Property=""NonExpandableProperties"" >
                      <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));
            }
        }
        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));
            }
        }
        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));
            }
        }
        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));
            }
        }
Пример #7
0
        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=""MaxLevels"" Int=""42"" />
                    <PropertyValue Property=""RequiredProperties"" >
                      <Collection>
                        <PropertyPath>Id</PropertyPath>
                      </Collection>
                    </PropertyValue>
                    <PropertyValue Property=""NonFilterableProperties"" >
                      <Collection>
                        <PropertyPath>Emails</PropertyPath>
                      </Collection>
                    </PropertyValue>
                    <PropertyValue Property=""FilterExpressionRestrictions"" >
                      <Collection>
                        <Record>
                          <PropertyValue Property=""Property"" PropertyPath=""RelatedProperty"" />
                        </Record>
                      </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>
                    <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));
            }
        }