I have multiple DAL classes which perform CRUD and take an transaction object.
I want to assign transaction object only to one class, so it's set into all DAL classes..
Public Class Employee{
Transactions trans = null
public List<Emp> Save(){
// Transaction Will Use There So It can Save
}
}
Public Class Customer{
Transactions trans = null
public List<Cst> Save(){
// Transaction Will Use There So It can Save
}
}
Public Static Void Main(String[] args ){
SqlTransaction trans = db.BeginTransactions();
Employee emp = new Employee();
emp.trans;
Customer cst = new Customer();
cst.trans;
}
In the code above you can see all Instances I have to pass to transaction object. Every instance of DAL I create like Shop, Company etc..
I want to get rid off this.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…