本文整理汇总了C#中Loader.Models方法的典型用法代码示例。如果您正苦于以下问题:C# Loader.Models方法的具体用法?C# Loader.Models怎么用?C# Loader.Models使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Loader
的用法示例。
在下文中一共展示了Loader.Models方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Tables
public async Task Tables()
{
var loader = new Loader<Schema>();
using (var connection = new SqlConnection(connectionString))
{
await connection.OpenAsync();
var cmd = connection.CreateCommand();
cmd.CommandText = Statements.Tables;
var models = loader.Models(cmd);
Assert.IsNotNull(models);
Assert.AreEqual(20, models.Count());
foreach (var schema in models)
{
Assert.AreEqual("dbo", schema.Preface);
Assert.IsTrue(schema.Name == "LotsOfStuff" || schema.Name == "DualPrimaryKeys");
}
}
}
示例2: StoredProcedures
public async Task StoredProcedures()
{
var loader = new Loader<Schema>();
using (var connection = new SqlConnection(connectionString))
{
await connection.OpenAsync();
var cmd = connection.CreateCommand();
cmd.CommandText = Statements.StoredProcedures;
var models = loader.Models(cmd);
Assert.IsNotNull(models);
Assert.AreEqual(16, models.Count());
foreach (var schema in models)
{
Assert.AreEqual("dbo", schema.Preface);
Assert.AreEqual("ManyTypes", schema.Name);
}
}
}
示例3: ReaderModels
public async Task ReaderModels()
{
using (var con = new SqlConnection(connectionString))
{
var sproc = new dboSelectMultipleStatement();
var cmd = sproc.Build(con);
await con.OpenAsync();
var reader = await cmd.ExecuteReaderAsync();
var loader = new Loader<SelectData>();
var objs = loader.Models(reader);
Assert.IsNotNull(objs);
var i = 0;
foreach (var obj in objs)
{
Assert.AreEqual(i, obj.Identifier);
i++;
}
}
}
示例4: DataSetModels
public async Task DataSetModels()
{
using (var con = new SqlConnection(connectionString))
{
var sproc = new dboSelectMultipleStatement();
var cmd = sproc.Build(con);
var loader = new Loader<SelectData>();
await con.OpenAsync();
var adapter = new SqlDataAdapter(cmd);
var ds = new DataSet();
adapter.Fill(ds);
var objs = loader.Models(ds);
Assert.IsNotNull(objs);
var i = 0;
foreach (var obj in objs)
{
Assert.AreEqual(i, obj.Identifier);
i++;
}
}
}
示例5: ModelsDataTableNull
public void ModelsDataTableNull()
{
var l = new Loader<object>();
l.Models((DataTable)null);
}
示例6: ModelsDataSetNull
public void ModelsDataSetNull()
{
var l = new Loader<object>();
l.Models((DataSet)null);
}
示例7: ModelsIDataReaderNull
public void ModelsIDataReaderNull()
{
var l = new Loader<object>();
l.Models((IDataReader)null);
}
示例8: ModelsIDbCommandNull
public void ModelsIDbCommandNull()
{
var l = new Loader<object>();
l.Models((IDbCommand)null);
}