I am planning to create different layers, so in my Visual Studio Project, I will have:
BusinessLayer: Contains Business objects (entities) i.e User, Employee, Products etc
DataAccessLayer: Entity Framework
Presentation Layers: The Views & ViewModels
So say for example, I want to let user login to this application.
- View will display the UI to let User to enter information.
- When User press enter, execute command => ViewModel
- ViewModel will use Entity Framework to query the User data from database, then ViewModel will initalize an User object (from BusinessObject ), and maps the User data to the User object.
- This User object then will store into a static parameter for future use.
So what I really concern is:
- Is this correct way to design N-layers?
- Should I sperate each layers to different Visual Studio project? (i.e Business objects will be inside another project)
- Is it better to let Business Object to query the data it self? So in Business Object construtor will calls entity framework?
- Should I write a Repository class for use entity framework?
I don't mind if this is complicated, because from what I have been told, this application will be huge. So I want to design it properly, to make it flexible and extendable.
Any advice will be great, thanks.