示例#1
0
 internal static bool TryWriteCsdl(IEdmModel model, Func <string, XmlWriter> writerProvider, bool singleFileExpected, out IEnumerable <EdmError> errors)
 {
     EdmUtil.CheckArgumentNull <IEdmModel>(model, "model");
     EdmUtil.CheckArgumentNull <Func <string, XmlWriter> >(writerProvider, "writerProvider");
     errors = model.GetSerializationErrors();
     if (errors.FirstOrDefault <EdmError>() == null)
     {
         IEnumerable <EdmSchema> schemas = (new EdmModelSchemaSeparationSerializationVisitor(model)).GetSchemas();
         if (schemas.Count <EdmSchema>() <= 1 || !singleFileExpected)
         {
             if (schemas.Count <EdmSchema>() != 0)
             {
                 CsdlWriter.WriteSchemas(model, schemas, writerProvider);
                 errors = Enumerable.Empty <EdmError>();
                 return(true);
             }
             else
             {
                 EdmError[] edmError = new EdmError[1];
                 edmError[0] = new EdmError(new CsdlLocation(0, 0), EdmErrorCode.NoSchemasProduced, Strings.Serializer_NoSchemasProduced);
                 errors      = edmError;
                 return(false);
             }
         }
         else
         {
             EdmError[] edmErrorArray = new EdmError[1];
             edmErrorArray[0] = new EdmError(new CsdlLocation(0, 0), EdmErrorCode.SingleFileExpected, Strings.Serializer_SingleFileExpected);
             errors           = edmErrorArray;
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
示例#2
0
 public static bool TryWriteCsdl(this IEdmModel model, Func <string, XmlWriter> writerProvider, out IEnumerable <EdmError> errors)
 {
     return(CsdlWriter.TryWriteCsdl(model, writerProvider, false, out errors));
 }
示例#3
0
 public static bool TryWriteCsdl(this IEdmModel model, XmlWriter writer, out IEnumerable <EdmError> errors)
 {
     return(CsdlWriter.TryWriteCsdl(model, (string x) => writer, true, out errors));
 }