For the reason why we want to do this, please read it here and I believe it is what many people want.
Http://www.cnblogs.com/mimijidi/archive/2009/05/01/1447493.html
This solution is extracted from a previous project.
The company name will not be mentioned, and you will know it at a glance.
The following is an example of the business-layer call code:
Code
using System;
using Demo.DAL;
using Framework.Service;
namespace Demo.BLL
{
public class ProductBll : ServiceBase
{
public void Update()
{
BeginTransaction();
try
{
ProductDal pd = new ProductDal();
pd.Update1();
pd.Update2();
Commit();
}
catch (Exception e)
{
Rollback();
throw new Exception(e.Message, e);
}
}
}
public static class ProductBll2
{
public static void Update()
{
ServiceBase.BeginTransaction();
try
{
ProductDal pd = new ProductDal();
pd.Update1();
pd.Update2();
ServiceBase.Commit();
}
catch (Exception e)
{
ServiceBase.Rollback();
throw new Exception(e.Message, e);
}
}
}
}
:
Http://files.cnblogs.com/builderman/Framework.rar
You are welcome to discuss this solution.