https://code.google.com/p/mybatisnet/source/checkout
http://blog.csdn.net/arvinstudy/article/details/7841020 (iBatis使用小例)
http://www.114xueche.com/video/
//服务层
public abstract class BaseService
{
#region
//实现事物处理
public virtual void BeginTransaction()
{
IBatisNet.DataMapper.Mapper.Instance().BeginTransaction();
}
public virtual void CommitTransaction()
{
IBatisNet.DataMapper.Mapper.Instance().CommitTransaction();
}
public virtual void RollBackTransaction()
{
IBatisNet.DataMapper.Mapper.Instance().RollBackTransaction();
}
#endregion
}
public class UserService : BaseService
{
private static UserService instance = new UserService();
private IUserDao userDao = null;
private UserService()
{
userDao = new UserSqlMapDao();
}
public static UserService GetInstance()
{
return instance;
}
public bool Update(User user)
{
if (user == null)
{
throw new ArgumentNullException("user");
}
base.BeginTransaction();
try
{
bool result = (userDao.Update(user) == 1);
base.CommitTransaction();
return result;
}
catch
{
base.RollBackTransaction();
throw;
}
}
}