/// <summary> /// Returns an IEdmModel for the given CSDL artifacts. /// </summary> /// <param name="readers">Collection of XmlReaders containing the CSDL artifacts.</param> /// <param name="references">Models to be references by the created model.</param> /// <param name="model">The model generated by parsing.</param> /// <param name="errors">Errors reported while parsing.</param> /// <returns>Success of the parse operation.</returns> public static bool TryParse(IEnumerable<XmlReader> readers, IEnumerable<IEdmModel> references, out IEdmModel model, out IEnumerable<EdmError> errors) { CsdlModel ast; if (CsdlParser.TryParse(readers, out ast, out errors)) { model = new CsdlSemanticsModel(ast, new CsdlSemanticsDirectValueAnnotationsManager(), references); return true; } model = null; return false; }
private bool TryParse(IEnumerable<IEdmModel> references, out IEdmModel model, out IEnumerable<EdmError> parsingErrors) { Version edmxVersion; try { this.ParseEdmxFile(out edmxVersion); } catch (XmlException e) { model = null; parsingErrors = new EdmError[] { new EdmError(new CsdlLocation(e.LineNumber, e.LinePosition), EdmErrorCode.XmlError, e.Message) }; return false; } if (this.errors.Count == 0) { CsdlModel astModel; IEnumerable<EdmError> csdlErrors; if (this.csdlParser.GetResult(out astModel, out csdlErrors)) { model = new CsdlSemanticsModel(astModel, new CsdlSemanticsDirectValueAnnotationsManager(), references); Debug.Assert(edmxVersion != null, "edmxVersion != null"); model.SetEdmxVersion(edmxVersion); if (this.dataServiceVersion != null) { model.SetDataServiceVersion(this.dataServiceVersion); } if (this.maxDataServiceVersion != null) { model.SetMaxDataServiceVersion(this.maxDataServiceVersion); } } else { Debug.Assert(csdlErrors != null && csdlErrors.Count() > 0, "csdlErrors != null && csdlErrors.Count() > 0"); this.errors.AddRange(csdlErrors); model = null; } } else { model = null; } parsingErrors = this.errors; return this.errors.Count == 0; }
private IEdmExpression ComputeValue() { return(CsdlSemanticsModel.WrapExpression(this.property.Expression, this.context.TargetBindingContext, this.context.Schema)); }
public CsdlSemanticsDocumentation(CsdlDocumentation documentation, CsdlSemanticsModel model) : base(documentation) { this.documentation = documentation; this.model = model; }
private IEdmTypeReference ComputeType() { return(CsdlSemanticsModel.WrapTypeReference(this.declaringFunction.Context, this.parameter.Type)); }
private IEdmTypeReference ComputeElementType() { return(CsdlSemanticsModel.WrapTypeReference(this.schema, this.collection.ElementType)); }
private IEdmExpression ComputeIfFalse() { return(CsdlSemanticsModel.WrapExpression(this.expression.IfFalse, this.BindingContext, this.Schema)); }
private IEdmTypeReference ComputeType() { return(CsdlSemanticsModel.WrapTypeReference(this.declaringType.Context, this.property.Type)); }
private IEdmExpression ComputeOperand() { return(CsdlSemanticsModel.WrapExpression(this.expression.Operand, this.bindingContext, this.Schema)); }
private IEdmExpression ComputeValue() { return(CsdlSemanticsModel.WrapExpression(((CsdlValueAnnotation)this.Annotation).Expression, base.TargetBindingContext, base.Schema)); }
private IEdmEntityType ComputeEntityType() { IEdmTypeReference type = CsdlSemanticsModel.WrapTypeReference(this.schema, this.entityTypeReference.EntityType); return(type.TypeKind() == EdmTypeKind.Entity ? type.AsEntity().EntityDefinition() : new UnresolvedEntityType(this.schema.UnresolvedName(type.FullName()), this.Location)); }
private IEdmTypeReference ComputeDeclaredType() { return(this.expression.Type != null?CsdlSemanticsModel.WrapTypeReference(this.Schema, this.expression.Type) : null); }
public CsdlSemanticsDirectValueAnnotation(CsdlDirectValueAnnotation annotation, CsdlSemanticsModel model) : base(annotation) { this.annotation = annotation; this.model = model; }
public CsdlSemanticsSchema(CsdlSemanticsModel model, CsdlSchema schema) : base(schema) { this.model = model; this.schema = schema; }
private bool TryParse(IEnumerable<IEdmModel> references, out IEdmModel model, out IEnumerable<EdmError> parsingErrors) { Version version = null; CsdlModel csdlModel = null; IEnumerable<EdmError> edmErrors = null; bool flag; try { this.ParseEdmxFile(out version); if (this.errors.Count != 0) { model = null; } else { if (!this.csdlParser.GetResult(out csdlModel, out edmErrors)) { this.errors.AddRange(edmErrors); model = null; } else { model = new CsdlSemanticsModel(csdlModel, new CsdlSemanticsDirectValueAnnotationsManager(), references); model.SetEdmxVersion(version); if (this.dataServiceVersion != null) { model.SetDataServiceVersion(this.dataServiceVersion); } if (this.maxDataServiceVersion != null) { model.SetMaxDataServiceVersion(this.maxDataServiceVersion); } } } parsingErrors = this.errors; return this.errors.Count == 0; } catch (XmlException xmlException1) { XmlException xmlException = xmlException1; model = null; EdmError[] edmError = new EdmError[1]; edmError[0] = new EdmError(new CsdlLocation(xmlException.LineNumber, xmlException.LinePosition), EdmErrorCode.XmlError, xmlException.Message); parsingErrors = edmError; flag = false; } return flag; }
private IEdmTypeReference ComputeType() { return(CsdlSemanticsModel.WrapTypeReference(this.Schema, this.expression.Type)); }
public CsdlSemanticsDirectValueAnnotation(CsdlDirectValueAnnotation annotation, CsdlSemanticsModel model) : base(annotation) { this.valueCache = new Cache<CsdlSemanticsDirectValueAnnotation, IEdmValue>(); this.annotation = annotation; this.model = model; }