本文整理汇总了C#中Parameters.Write方法的典型用法代码示例。如果您正苦于以下问题:C# Parameters.Write方法的具体用法?C# Parameters.Write怎么用?C# Parameters.Write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parameters
的用法示例。
在下文中一共展示了Parameters.Write方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadSchema
public Database ReadSchema(Parameters parameters, out ISchemaLoader schemaLoader)
{
Database dbSchema;
var nameAliases = NameAliasesLoader.Load(parameters.Aliases);
if (parameters.SchemaXmlFile == null) // read schema from DB
{
schemaLoader = SchemaLoaderFactory.Load(parameters);
parameters.Write(">>> Reading schema from {0} database", schemaLoader.Vendor.VendorName);
dbSchema = schemaLoader.Load(parameters.Database, nameAliases,
new NameFormat(parameters.Pluralize, GetCase(parameters), new CultureInfo(parameters.Culture)),
parameters.Sprocs, parameters.Namespace, parameters.Namespace);
dbSchema.Provider = parameters.Provider;
dbSchema.Tables.Sort(new LambdaComparer<Table>((x, y) => (x.Type.Name.CompareTo(y.Type.Name))));
foreach (var table in dbSchema.Tables)
table.Type.Columns.Sort(new LambdaComparer<Column>((x, y) => (x.Member.CompareTo(y.Member))));
dbSchema.Functions.Sort(new LambdaComparer<Function>((x, y) => (x.Method.CompareTo(y.Method))));
//SchemaPostprocess.PostProcess_DB(dbSchema);
}
else // load DBML
{
dbSchema = ReadSchema(parameters, parameters.SchemaXmlFile);
schemaLoader = SchemaLoaderFactory.Load(dbSchema.Provider);
}
if (schemaLoader == null)
throw new ApplicationException("Please provide -Provider=MySql (or Oracle, OracleODP, PostgreSql, Sqlite - see app.config for provider listing)");
return dbSchema;
}
示例2: WriteSchema
protected void WriteSchema(Database dbSchema, ISchemaLoader schemaLoader, Parameters parameters)
{
if (parameters.Dbml != null)
{
//we are supposed to write out a DBML file and exit
parameters.Write("<<< Writing file '{0}'", parameters.Dbml);
using (Stream dbmlFile = File.Create(parameters.Dbml))
{
DbmlSerializer.Write(dbmlFile, dbSchema);
}
}
else
{
if (!parameters.Schema)
RemoveSchemaFromTables(dbSchema);
// extract filename from output filename, database schema or schema name
string filename = parameters.Code;
if (string.IsNullOrEmpty(filename) && !string.IsNullOrEmpty(parameters.Database))
filename = parameters.Database.Replace("\"", "");
if (string.IsNullOrEmpty(filename))
filename = dbSchema.Name;
// TODO: move such check to runtime.
schemaLoader.CheckNamesSafety(dbSchema);
parameters.Write("<<< writing C# classes in file '{0}'", filename);
GenerateCode(parameters, dbSchema, schemaLoader, filename);
}
}