I am using layered architecture in dotnet (mostly I work on web projects). I am confuse what layers should I use ?
I have small idea that there should be the following layers.
- user interface
- customer types (custom entities)
- business logic layer
- data access layer
My purpose is sure quality of work and maximum re-usability of code.
some one suggested to add common types layer in it. Please guide me what should be layers ? and in each layer what part should go ?
It depends on what data access technology you are using.
If you are using NHibernate, I would strongly recommend Repository-pattern along with some dependency Injection.
If you are using Linq-to-sql, you should be using Active Data Record-pattern. In this case you may or may not use dependency injection.
In case of Entity Framework, Unit-of-work-pattern can be used.
Generally I arrange my VS2005/2008 – solution like this:
And, I arrange my codes like this:
You can put
IMyInterface.csin a separate project namedMySolution.Contracs. And, then add a reference of it to the respective assembly.Please note that, this is called layered-design, not tiered-design.
You can also employ a simple framework for your business-entities like the one used in this example.
And finally employ MVC pattern in your Winforms UI layer. You can get the example here.
And I am not providing any link for ASP.NET MVC, coz there are numerous in the net.