/// <summary> /// Tries parsing the given CSDL artifact for an IEdmModel. /// </summary> /// <param name="reader">XmlReader containing the CSDL artifact.</param> /// <param name="references">Models to be referenced 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(XmlReader reader, IEnumerable <IEdmModel> references, out IEdmModel model, out IEnumerable <EdmError> errors) { EdmUtil.CheckArgumentNull(references, "references"); CsdlReader edmxReader = new CsdlReader(reader, null); return(edmxReader.TryParse(references, out model, out errors)); }
/// <summary> /// Tries parsing the given CSDL artifact for an IEdmModel. /// </summary> /// <param name="reader">XmlReader containing the CSDL artifact.</param> /// <param name="ignoreUnexpectedAttributesAndElements">Ignore the unexpected attributes and elements in schema.</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(XmlReader reader, bool ignoreUnexpectedAttributesAndElements, out IEdmModel model, out IEnumerable <EdmError> errors) { CsdlReader edmxReader = new CsdlReader(reader, null); edmxReader.ignoreUnexpectedAttributesAndElements = ignoreUnexpectedAttributesAndElements; return(edmxReader.TryParse(Enumerable.Empty <IEdmModel>(), out model, out errors)); }
/// <summary> /// Tries parsing the given CSDL artifact for an IEdmModel. /// </summary> /// <param name="reader">XmlReader containing the CSDL artifact.</param> /// <param name="references">Models to be referenced by the created model.</param> /// <param name="settings">CsdlReader settings for current parser.</param> /// <param name="model">The model generated by parsing</param> /// <param name="errors">Errors reported while parsing.</param> /// <remarks>If getReferencedModelReaderFunc throws exception, it won't be caught internally but will be thrown out for caller to handle.</remarks> /// <returns>Success of the parse operation.</returns> /// <remarks> /// User should handle the disposal of XmlReader created by getReferencedModelReaderFunc. /// </remarks> public static bool TryParse(XmlReader reader, IEnumerable <IEdmModel> references, CsdlReaderSettings settings, out IEdmModel model, out IEnumerable <EdmError> errors) { EdmUtil.CheckArgumentNull(references, "references"); if (settings == null) { return(TryParse(reader, references, out model, out errors)); } CsdlReader edmxReader = new CsdlReader(reader, settings.GetReferencedModelReaderFunc) { ignoreUnexpectedAttributesAndElements = settings.IgnoreUnexpectedAttributesAndElements }; return(edmxReader.TryParse(references, out model, out errors)); }
/// <summary> /// Tries parsing the given CSDL artifact for an IEdmModel. /// </summary> /// <param name="reader">XmlReader containing the CSDL artifact.</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(XmlReader reader, out IEdmModel model, out IEnumerable <EdmError> errors) { CsdlReader edmxReader = new CsdlReader(reader, null); return(edmxReader.TryParse(Enumerable.Empty <IEdmModel>(), out model, out errors)); }
/// <summary> /// Tries parsing the given CSDL artifact for an IEdmModel. /// </summary> /// <param name="reader">XmlReader containing the CSDL artifact.</param> /// <param name="reference">Model to be referenced 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(XmlReader reader, IEdmModel reference, out IEdmModel model, out IEnumerable <EdmError> errors) { CsdlReader edmxReader = new CsdlReader(reader, null); return(edmxReader.TryParse(new[] { reference }, out model, out errors)); }
/// <summary> /// Tries parsing the given CSDL artifact for an IEdmModel. /// </summary> /// <param name="reader">XmlReader containing the CSDL artifact.</param> /// <param name="getReferencedModelReaderFunc">The function to load referenced model xml. If null, will stop loading the referenced models. Normally it should throw no exception.</param> /// <param name="model">The model generated by parsing</param> /// <param name="errors">Errors reported while parsing.</param> /// <remarks>If getReferencedModelReaderFunc throws exception, it won't be caught internally but will be thrown out for caller to handle.</remarks> /// <returns>Success of the parse operation.</returns> /// <remarks> /// User should handle the disposal of XmlReader created by getReferencedModelReaderFunc. /// </remarks> public static bool TryParse(XmlReader reader, Func <Uri, XmlReader> getReferencedModelReaderFunc, out IEdmModel model, out IEnumerable <EdmError> errors) { CsdlReader edmxReader = new CsdlReader(reader, getReferencedModelReaderFunc); return(edmxReader.TryParse(Enumerable.Empty <IEdmModel>(), out model, out errors)); }
/// <summary> /// Tries parsing the given CSDL artifact for an IEdmModel. /// </summary> /// <param name="reader">XmlReader containing the CSDL artifact.</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(XmlReader reader, out IEdmModel model, out IEnumerable <EdmError> errors) { CsdlReader edmxReader = new CsdlReader(reader, null); return(edmxReader.TryParse(Enumerable.Empty <IEdmModel>(), true /*includeDefaultVocabularies*/, out model, out errors)); }
/// <summary> /// Tries parsing the given CSDL artifact for an IEdmModel. /// </summary> /// <param name="reader">XmlReader containing the CSDL artifact.</param> /// <param name="reference">Model to be referenced 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(XmlReader reader, IEdmModel reference, out IEdmModel model, out IEnumerable <EdmError> errors) { CsdlReader edmxReader = new CsdlReader(reader, null); return(edmxReader.TryParse(new[] { reference }, true /*includeDefaultVocabularies*/, out model, out errors)); }