public CsdlSemanticsTerm(CsdlSemanticsSchema context, CsdlTerm valueTerm) : base(valueTerm) { this.Context = context; this.term = valueTerm; this.fullName = EdmUtil.GetFullNameForSchemaElement(this.Context?.Namespace, this.term?.Name); }
public void ParseCsdlTermWithMembersWorksAsExpected() { string json = @"""ConformanceLevel"": { ""$Kind"": ""Term"", ""$Type"": ""Capabilities.ConformanceLevelType"", ""$Nullable"": true, ""$AppliesTo"": [ ""EntityContainer"" ], ""@Core.Description"": ""The conformance level achieved by this service"" }"; CsdlTerm term = ParseCsdlSchemaElement(json, SchemaJsonParser.ParseCsdlTermType); Assert.NotNull(term); Assert.Equal("ConformanceLevel", term.Name); Assert.Equal("EntityContainer", term.AppliesTo); Assert.Null(term.DefaultValue); Assert.True(term.HasVocabularyAnnotations); CsdlNamedTypeReference namedType = Assert.IsType <CsdlNamedTypeReference>(term.Type); Assert.Equal("Capabilities.ConformanceLevelType", namedType.FullName); Assert.True(namedType.IsNullable); CsdlAnnotation annotation = Assert.Single(term.VocabularyAnnotations); Assert.Equal("Core.Description", annotation.Term); Assert.IsType <CsdlConstantExpression>(annotation.Expression); }
internal static CsdlSchema Schema( string namespaceName, string alias = null, Version version = null, CsdlStructuredType[] csdlStructuredTypes = default(CsdlStructuredType[]), CsdlEnumType[] csdlEnumTypes = default(CsdlEnumType[]), CsdlOperation[] csdlOperations = default(CsdlOperation[]), CsdlTerm[] csdlTerms = default(CsdlTerm[]), CsdlEntityContainer[] csdlEntityContainers = default(CsdlEntityContainer[]), CsdlAnnotations[] csdlAnnotations = default(CsdlAnnotations[]), CsdlTypeDefinition[] csdlTypeDefinitions = default(CsdlTypeDefinition[]), CsdlLocation location = null) { if (csdlStructuredTypes == null) { csdlStructuredTypes = new CsdlStructuredType[] { }; } if (csdlEnumTypes == null) { csdlEnumTypes = new CsdlEnumType[] { }; } if (csdlOperations == null) { csdlOperations = new CsdlOperation[] { }; } if (csdlTerms == null) { csdlTerms = new CsdlTerm[] { }; } if (csdlEntityContainers == null) { csdlEntityContainers = new CsdlEntityContainer[] { }; } if (csdlAnnotations == null) { csdlAnnotations = new CsdlAnnotations[] { }; } if (csdlTypeDefinitions == null) { csdlTypeDefinitions = new CsdlTypeDefinition[] { }; } var csdlSchema = new CsdlSchema( namespaceName, alias, version, csdlStructuredTypes, csdlEnumTypes, csdlOperations, csdlTerms, csdlEntityContainers, csdlAnnotations, csdlTypeDefinitions, location /*location*/); return(csdlSchema); }
public CsdlSemanticsValueTerm(CsdlSemanticsSchema context, CsdlTerm valueTerm) : base(valueTerm) { this.Context = context; this.valueTerm = valueTerm; }