public CsdlSemanticsPropertyValueBinding(CsdlSemanticsTypeAnnotation context, CsdlPropertyValue property) : base(property) { this.valueCache = new Cache <CsdlSemanticsPropertyValueBinding, IEdmExpression>(); this.boundPropertyCache = new Cache <CsdlSemanticsPropertyValueBinding, IEdmProperty>(); this.context = context; this.property = property; }
public void ParseRecordExpressionWorksAsExpected() { string json = @" { ""@type"": ""org.example.person.Manager"", ""@Core.Description"": ""Annotation on record"", ""GivenName"": { ""$Path"": ""FirstName"" }, ""*****@*****.**"": ""Annotation on record member"", ""Surname"": { ""$Path"": ""LastName"" }, ""DirectSupervisor"": { ""$Path"": ""Manager"" }, ""CostCenter"": ""CostCenter Value"" }"; CsdlExpressionBase expressionBase = ParseExpression(json, out JsonParserContext context); Assert.NotEmpty(context.Errors); Assert.Equal(2, context.Errors.Count); Assert.Equal("A member at JSON path '[email protected]' is not supported.", context.Errors.First().ErrorMessage); Assert.Equal("A member at JSON path '[email protected]' is not supported.", context.Errors.Last().ErrorMessage); Assert.NotNull(expressionBase); CsdlRecordExpression recordExp = Assert.IsType <CsdlRecordExpression>(expressionBase); Assert.NotNull(recordExp.Type); CsdlNamedTypeReference namedType = Assert.IsType <CsdlNamedTypeReference>(recordExp.Type); Assert.Equal("org.example.person.Manager", namedType.FullName); Assert.NotNull(recordExp.PropertyValues); Assert.Equal(4, recordExp.PropertyValues.Count()); // GivenName CsdlPropertyValue propertyValue = recordExp.PropertyValues.FirstOrDefault(c => c.Property == "GivenName"); Assert.NotNull(propertyValue); Assert.IsType <CsdlPathExpression>(propertyValue.Expression); // Surname propertyValue = recordExp.PropertyValues.FirstOrDefault(c => c.Property == "Surname"); Assert.NotNull(propertyValue); Assert.IsType <CsdlPathExpression>(propertyValue.Expression); // DirectSupervisor propertyValue = recordExp.PropertyValues.FirstOrDefault(c => c.Property == "DirectSupervisor"); Assert.NotNull(propertyValue); Assert.IsType <CsdlPathExpression>(propertyValue.Expression); // DirectSupervisor propertyValue = recordExp.PropertyValues.FirstOrDefault(c => c.Property == "CostCenter"); Assert.NotNull(propertyValue); Assert.IsType <CsdlConstantExpression>(propertyValue.Expression); }
public CsdlSemanticsPropertyConstructor(CsdlPropertyValue property, CsdlSemanticsRecordExpression context) : base(property) { this.property = property; this.context = context; }
public CsdlSemanticsPropertyConstructor(CsdlPropertyValue property, CsdlSemanticsRecordExpression context) : base(property) { this.valueCache = new Cache <CsdlSemanticsPropertyConstructor, IEdmExpression>(); this.property = property; this.context = context; }
public CsdlSemanticsPropertyValueBinding(CsdlSemanticsTypeAnnotation context, CsdlPropertyValue property) : base(property) { this.context = context; this.property = property; }