本文整理汇总了C#中SqlQuery.GetSqlQueryInfo方法的典型用法代码示例。如果您正苦于以下问题:C# SqlQuery.GetSqlQueryInfo方法的具体用法?C# SqlQuery.GetSqlQueryInfo怎么用?C# SqlQuery.GetSqlQueryInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlQuery
的用法示例。
在下文中一共展示了SqlQuery.GetSqlQueryInfo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecursiveTest
public void RecursiveTest()
{
var query = new SqlQuery<TestObject>();
var info = query.GetSqlQueryInfo(new DbManager(), "SelectAll");
Console.WriteLine(info.QueryText);
Assert.That(info.QueryText.Contains("InnerId"));
Assert.That(info.QueryText, Is.Not.Contains("InnerObject"));
}
示例2: GetFieldListTest
public void GetFieldListTest()
{
var da = new SqlQuery();
using (var db = new DbManager())
{
var info = da.GetSqlQueryInfo(db, typeof (Person), "SelectAll");
Console.WriteLine(info.QueryText);
Assert.That(info.QueryText.Contains("\t" + db.DataProvider.Convert("PersonID", ConvertType.NameToQueryField)));
Assert.That(info.QueryText.Contains("\t" + db.DataProvider.Convert("LastName", ConvertType.NameToQueryField)));
Assert.That(info.QueryText, Is.Not.Contains("\t" + db.DataProvider.Convert("Name", ConvertType.NameToQueryField)));
}
}
示例3: ComplexMapperNonUpdatableTest
public void ComplexMapperNonUpdatableTest()
{
var da = new SqlQuery();
using (var db = new DbManager())
{
var update = da.GetSqlQueryInfo<TestObject2>(db, "Update");
var insert = da.GetSqlQueryInfo<TestObject2>(db, "Insert");
Assert.That(update.QueryText.Contains("CategoryId"), "Update");
Assert.That(insert.QueryText.Contains("CategoryId"), "Insert");
}
}
示例4: NonUpdatableTest
public void NonUpdatableTest()
{
var da = new SqlQuery();
using (var db = new DbManager())
{
var update = da.GetSqlQueryInfo<TestCategory>(db, "Update");
var insert = da.GetSqlQueryInfo<TestCategory>(db, "Insert");
Assert.That(update.QueryText, Is.Not.Contains(
"\t" + db.DataProvider.Convert("Id", ConvertType.NameToQueryField) + " = " + db.DataProvider.Convert("Id", db.GetConvertTypeToParameter()) + "\n"),
"Update");
Assert.That(insert.QueryText, Is.Not.Contains("Id"), "Insert");
}
}
示例5: NonUpdatableOnClass
public void NonUpdatableOnClass()
{
var da = new SqlQuery();
using (var db = new DbManager())
{
var update = da.GetSqlQueryInfo<Person2>(db, "Update");
var insert = da.GetSqlQueryInfo<Person2>(db, "Insert");
var personID = "\t" + db.DataProvider.Convert("PersonID", ConvertType.NameToQueryField).ToString();
var middleName = "\t" + db.DataProvider.Convert("MiddleName", ConvertType.NameToQueryField).ToString();
var firstName = "\t" + db.DataProvider.Convert("FirstName", ConvertType.NameToQueryField).ToString();
var personID_P = " = " + db.DataProvider.Convert("PersonID_P", ConvertType.NameToQueryParameter).ToString();
var middleName_P = " = " + db.DataProvider.Convert("MiddleName_P", ConvertType.NameToQueryParameter).ToString();
var firstName_P = " = " + db.DataProvider.Convert("FirstName_P", ConvertType.NameToQueryParameter).ToString();
Assert.That(update.QueryText, Is.Not.Contains(personID + personID_P), "personId\n" + update.QueryText);
Assert.That(update.QueryText, Is.Not.Contains(middleName + middleName_P), "middleName\n" + update.QueryText);
Assert.That(update.QueryText.Contains(firstName + firstName_P), "firstName\n" + update.QueryText);
Assert.That(insert.QueryText, Is.Not.Contains(personID), "personId\n" + insert.QueryText);
Assert.That(insert.QueryText, Is.Not.Contains(firstName), "firstName\n" + insert.QueryText);
Assert.That(insert.QueryText.Contains(middleName), "middleName\n" + insert.QueryText);
}
}