I am developing a Data Access Layer with ADO.NET 2.0 and C #, Sql Server 2005. I often struggle with my brain about where to place these calls. Which of the methods below should I follow for supported reliable code.
Method 1
Public Class Company { public string CompanyId {get;set;} public string CompanyAddress {get;set;} public bool Create() { } public bool Update() { } public bool Delete() { } }
Method 2
Public Class Company { public string CompanyId {get;set;} public string CompanyAddress {get;set;} }
and I would use another class, as shown below, to access the main data. As below
Public Class CompanyRepository { public Company CreateCompany(string companyId,string companyDescription) { } public bool UpdateCompany(Company updateCompany) { } public bool DeleteCompany(string companyId) { } public List<Company> FindById(string id) { } }
source share