Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
2.3k views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...