当前位置: 首页>>代码示例>>C#>>正文


C# SqlQuery.GetSqlQueryInfo方法代码示例

本文整理汇总了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"));
		}
开发者ID:x64,项目名称:bltoolkit,代码行数:9,代码来源:SqlTest.cs

示例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)));
			}
		}
开发者ID:MajidSafari,项目名称:bltoolkit,代码行数:14,代码来源:SqlTest.cs

示例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");
			}
		}
开发者ID:x64,项目名称:bltoolkit,代码行数:13,代码来源:SqlTest.cs

示例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");
			}
		}
开发者ID:x64,项目名称:bltoolkit,代码行数:15,代码来源:SqlTest.cs

示例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);
			}
		}
开发者ID:pbludov,项目名称:bltoolkit,代码行数:26,代码来源:SqlTest.cs


注:本文中的SqlQuery.GetSqlQueryInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。