• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Data.DbManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中BLToolkit.Data.DbManager的典型用法代码示例。如果您正苦于以下问题:C# DbManager类的具体用法?C# DbManager怎么用?C# DbManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DbManager类属于BLToolkit.Data命名空间,在下文中一共展示了DbManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Save

        public void Save(CustomerPriceAgreement PriceAgreement)
        {
            PriceAgreement.AccountCode = account.AccountCode;
            PriceAgreement.BranchCode = branch.BranchCode;
            PriceAgreement.BrandCode = brand.BrandCode;

            //TEMPORARY DATE AND USER SAVING
            PriceAgreement.DateCreated = DateTime.Now;
            PriceAgreement.CreatedBy = "SYSTEM";
            PriceAgreement.ModifiedBy = "SYSTEM";
            PriceAgreement.DateModified = DateTime.Now;
            //TEMPORARY DATE AND USER SAVING

            using (DbManager db = new DbManager())
            {
                try
                {
                    if (PriceAgreement.RecordNo != 0)
                    {
                        Accessor.Query.Update(db, PriceAgreement);
                    }
                    else
                    {
                        Accessor.Query.Insert(db, PriceAgreement);
                    }
                }
                catch (Exception except)
                {
                    throw new System.ArgumentException(except.Message);
                }
            }
        }
开发者ID:DennisPitallano,项目名称:IRMS-MARKETING,代码行数:32,代码来源:CustomerPriceAgreementManager.cs


示例2: Delete

 public void Delete(Forwarder FORWARDER)
 {
     using (DbManager db = new DbManager())
     {
         Accessor.Query.Delete(db, FORWARDER);
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-WAREHOUSE,代码行数:7,代码来源:ForwarderManager.cs


示例3: GetParameters

		public IDbDataParameter[] GetParameters(DbManager db, object obj)
		{
			var parameters = new IDbDataParameter[_parameters.Count];

			for (var i = 0; i < _parameters.Count; i++)
			{
				var info = _parameters[i];

				//parameters[i] = db.Parameter(info.ParameterName, info.MemberMapper.GetValue(obj));

				var mmi = info.MemberMapper.MapMemberInfo;
				var val = info.MemberMapper.GetValue(obj);

				if (val == null && mmi.Nullable/* && mmi.NullValue == null*/)
				{
					//replace value with DbNull
					val = DBNull.Value;
				}

				if (mmi.IsDbTypeSet)
				{
					parameters[i] = mmi.IsDbSizeSet 
						? db.Parameter(info.ParameterName, val, info.MemberMapper.DbType, mmi.DbSize) 
						: db.Parameter(info.ParameterName, val, info.MemberMapper.DbType);
				}
				else
				{
					parameters[i] = db.Parameter(info.ParameterName, val);
				}
			}

			return parameters;
		}
开发者ID:MozgC,项目名称:bltoolkit,代码行数:33,代码来源:SqlQueryInfo.cs


示例4: TearDown

 protected override void TearDown()
 {
     using (var dbManager = new DbManager("PerformanceTest"))
         dbManager
             .SetCommand("TRUNCATE TABLE Simplests")
             .ExecuteNonQuery();
 }
开发者ID:sdanyliv,项目名称:ormbattle,代码行数:7,代码来源:BLToolkitTest.cs


示例5: Save

 public void Save(PricePoint Object)
 {
     using (DbManager dbm = new DbManager())
     {
         Accessor.Query.Insert(dbm, Object);
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-MARKETING,代码行数:7,代码来源:PricePointManager.cs


示例6: DeleteRequest

 public void DeleteRequest(PulloutHeader PH)
 {
     using (DbManager db = new DbManager())
     {
         Accessor.Query.Delete(db, PH);
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-WAREHOUSE,代码行数:7,代码来源:PulloutHeaderManager.cs


示例7: DeleteByMemoID

 public void DeleteByMemoID(int MemoID)
 {
     using (DbManager dbm = new DbManager())
     {
         dbm.SetCommand(string.Format("DELETE FROM GENMEMODTL WHERE GENMEMOID = {0}", MemoID)).ExecuteNonQuery();
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-MARKETING,代码行数:7,代码来源:GeneralMemoConcessionDetailManager.cs


示例8: Delete

 public void Delete(Message Message)
 {
     using (DbManager dbm = new DbManager())
     {
         Accessor.Query.Delete(dbm, Message);
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-ACCOUNTING,代码行数:7,代码来源:MessageManager.cs


示例9: Messages

 public List<Message> Messages()
 {
     using (DbManager dbm = new DbManager())
     {
         return Accessor.Query.SelectAll<Message>(dbm);
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-ACCOUNTING,代码行数:7,代码来源:MessageManager.cs


示例10: Delete

 public void Delete(Memo memo)
 {
     using (DbManager db = new DbManager())
     {
         Accessor.Query.Delete(db, memo);
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-ACCOUNTING,代码行数:7,代码来源:MemoManager.cs


示例11: Test

		public void Test()
		{
			using (DbManager db = new DbManager())
			{
				List<Person> list = db
					.SetCommand(@"
						SELECT
							ps.*,
							d.Taxonomy,
							p.Diagnosis,
							CASE
								WHEN d.PersonID IS NOT NULL THEN 'D'
								WHEN p.PersonID IS NOT NULL THEN 'P'
							END as PersonType
						FROM
							Person ps
								LEFT JOIN Doctor  d ON d.PersonID = ps.PersonID
								LEFT JOIN Patient p ON p.PersonID = ps.PersonID
						ORDER BY
							ps.PersonID")
					.ExecuteList<Person>();

				Assert.AreEqual(list[0].GetType(), /*[a]*/typeof(Doctor)/*[/a]*/);
				Assert.AreEqual(list[1].GetType(), /*[a]*/typeof(Patient)/*[/a]*/);

				if (list.Count > 2)
					Assert.AreEqual(list[2].GetType(), typeof(Person));
			}
		}
开发者ID:MajidSafari,项目名称:bltoolkit,代码行数:29,代码来源:ObjectFactory.cs


示例12: GetPersonByID

		// Insert, Update, and Delete a person.
		//
		public Person GetPersonByID(DbManager db, int id)
		{
			return db
				./*[a]*/SetCommand/*[/a]*/("SELECT * FROM Person WHERE PersonID = @id",
					db./*[a]*/Parameter/*[/a]*/("@id", id))
				.ExecuteObject<Person>();
		}
开发者ID:MajidSafari,项目名称:bltoolkit,代码行数:9,代码来源:SetCommand.cs


示例13: OutputParameterTest

		public void OutputParameterTest()
		{
			using (DbManager db = new DbManager())
			{
				/*
				 * CREATE Procedure Scalar_OutputParameter
				 *     @outputInt    int         = 0  output,
				 *     @outputString varchar(50) = '' output
				 * AS
				 * BEGIN
				 *     SET @outputInt = 12345
				 *     SET @outputString = '54321'
				 * END
				 */

				db
					.SetSpCommand("Scalar_OutputParameter",
						db./*[a]*/OutputParameter/*[/a]*/("@outputInt",    1),
						db./*[a]*/OutputParameter/*[/a]*/("@outputString", "1"))
					.ExecuteNonQuery();

				Assert.AreEqual(12345,   (int)   db./*[a]*/Parameter("@outputInt").   Value/*[/a]*/);
				Assert.AreEqual("54321", (string)db./*[a]*/Parameter("@outputString").Value/*[/a]*/);
			}
		}
开发者ID:MajidSafari,项目名称:bltoolkit,代码行数:25,代码来源:Parameter.cs


示例14: Delete

 public void Delete(DeliveryReceipt DeliveryReceipt)
 {
     using (DbManager db = new DbManager())
     {
         Accessor.Query.Delete(db, DeliveryReceipt);
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-WAREHOUSE,代码行数:7,代码来源:DeliveryReceiptManager.cs


示例15: ConfirmCustomerReturnSlip

 public void ConfirmCustomerReturnSlip(CustomerReturnSlipConfirmation crs)
 {
     using (DbManager dbm = new DbManager())
     {
         Accessor.Query.Insert(dbm, crs);
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-WAREHOUSE,代码行数:7,代码来源:CustomerReturnSlipManager.cs


示例16: Delete

 public void Delete(SalesInvoice SalesInvoice)
 {
     using (DbManager db = new DbManager())
     {
         Accessor.Query.Delete(db, SalesInvoice);
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-WAREHOUSE,代码行数:7,代码来源:SalesInvoiceManager.cs


示例17: FullSqlQuery

        public FullSqlQuery(DbManager dbManager, bool ignoreLazyLoad = false, MappingOrder mappingOrder = MappingOrder.ByColumnIndex)
            : base(dbManager)
        {
            dbManager.MappingSchema = new FullMappingSchema(dbManager, ignoreLazyLoad: ignoreLazyLoad, mappingOrder: mappingOrder, parentMappingSchema: dbManager.MappingSchema);

            _ignoreLazyLoad = ignoreLazyLoad;
        }
开发者ID:sscctech,项目名称:bltoolkit,代码行数:7,代码来源:FullSqlQuery.cs


示例18: SetCommandWorksCorrectlyWithSprocParameterPrefixSet

		public void SetCommandWorksCorrectlyWithSprocParameterPrefixSet()
		{
			var oldPrefix = MySqlDataProvider.SprocParameterPrefix;
			MySqlDataProvider.SprocParameterPrefix = "_";

			try
			{
				using (var db = new DbManager(ProviderName.MySql))
				{
					var person = db.SetCommand(
							"SELECT * FROM Person WHERE PersonID = ?PersonID",
							db.Parameter("?PersonID", 1))
						.ExecuteObject<Person>();

					Assert.IsNotNull(person);
					Assert.AreEqual(1, person.ID);

					var person2 = db.SetCommand(
							"SELECT * FROM Person WHERE FirstName = ?firstName AND LastName = ?lastName",
							db.CreateParameters(person))
						.ExecuteObject<Person>();

					Assert.IsNotNull(person2);
					Assert.AreEqual(person, person2);
				}
			}
			finally
			{
				MySqlDataProvider.SprocParameterPrefix = oldPrefix;
			}
		}
开发者ID:Gremlin2,项目名称:bltoolkit,代码行数:31,代码来源:MySqlSprocParameterPrefixTests.cs


示例19: Delete

 public void Delete( GeneralMemoConcessionDetail GMConcessionDetail )
 {
     using (DbManager dbm = new DbManager())
     {
         Accessor.Query.Delete(dbm,GMConcessionDetail);
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-MARKETING,代码行数:7,代码来源:GeneralMemoConcessionDetailManager.cs


示例20: Delete

 public void Delete(Size size)
 {
     using (DbManager db = new DbManager())
     {
         Accessor.Query.Delete(db, size);
     }
 }
开发者ID:DennisPitallano,项目名称:IRMS-ACCOUNTING,代码行数:7,代码来源:SizeManager.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Mapping.MapMemberInfo类代码示例发布时间:2022-05-24
下一篇:
C# BLL.ReceiveDoc类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap