Currently I am working on the design of my degree project. Some days ago I began studying LINQ. I found it was interesting and planned to use it in my project but now I am getting confused at some point.
When I add the LINQ to SQL class it auto generates entities classes against each table in database.
Suppose I have two tables in database:
User
Projects
UserProjects (joint table)
and a joint table that represents which user is associated with which project.
LINQ to SQL class auto generates these three classes for me. Now shall I create separate (User and Project) classes as Business Object or use these auto generated entities?
Also, to use database functionality we are required to use 3 tier architecture. Can I directly call LINQ DAL method from my BLL or do I need to create separate DAL which will call a method of the LINQ DAL??
class UserBLL
{
public void saveUser(String username, String password)
{
// here I am calling LINQ DAL from by BLL
UserDataContext db = new UserDataContext();
User u =new User {Username = username, Password = password};
db.user.InsertOnSubmit(u);
db.SubmitChanges();
}
}
Is the above method calling sequence fine?