I am going to start new project related to Accounts and I am confused which design pattern whould I use. 3 Tiers or MVC . I am new to MVC and l alwyas used 3 tiers design pettern in my application.
The following are some of the benefits of using ASP.NET MVC.
You get REST URLS like /category/1/7243
You don't have to use the ".aspx" extensions (you never really did, but now it is easier to avoid).
Very clean, controlled HTML output. Less of what will show up is hidden from you, so you have a lot more control over the generated HTML.
Client side code becomes much easier to use since you have more control over the HTML. One problem with using JavaScript with WebForms is that naming containers cause the controls on the page to have strange names.
Testing becomes much easier. Webforms where very difficult to test. Because of the controllers instead of the pages themselves handling things, testing becomes much easier.
It becomes far easier to optimize URLS for search engines. With WebForms one needed to use URL rewriters which merely hid what the real URL was.
With WebForms there was a sense of state. Pages maintained their state between posts. This made things a little bit easier, but this obfuscation hides how interactions between the client and the server actually occur. MVC gives you much more control
over the client-server interaction.
Please excuse my poor/bad English
***DON'T FORGET TO CLICK “MARK AS ANSWER” ON THE POST IF HELPED YOU.
MVC only lives in the presentation layer. You usually want to make a combination of a multilayered application and use MVC in the presentation layer (or tier).
Minhajul040182
l alwyas used 3 tiers design pettern in my application
I think you mean 3 layered architecture.
Layer = logical separation
Tier = physical separation
amount layers >= amount tiers
I would suggest you go for a 3 layered pattern with MVC in the presentation layer. (Likely it's going to be a 2 tiered application [tiere 1 = all the code on the application server, tier 2 = the database server])
Grz, Kris.
Read my blog | Twitter Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
One can still create complete penetratable applications even when using a multi layered and multi tiered application. Security is an important point to take care off and is usually done too late in the creative process.
Grz, Kris.
Read my blog | Twitter Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
Thanks for you post... but my problem is that... I already started a project and completed modules of Administrator. My project structure is 3 tiers ... as follows
--- BAL (Business Access Layer ) Separate Project and took reference of its .dll file
---- DAL (Data Access Layer) Separate Project and BAL took reference of this project's .dll files (This project also depends SQL Engine Project which generates SQL Quesries every time and same out time to create on every move.
------ Models also is a seperated prohject.
Now my project is taking reference from these .dll files to complete its transactions. Could you please help me how to embed it in MVS 2 design pattern that I can not rewrite the code for changing.
simply create a new MVC project. Reference the BAL and Models, not the DAL, projects and go with the flow.
In the Controllers you make calls to your BAL layer. Optionally you can transform your Models, which you pass around through all the layers, into ViewModels which are only there to be used for the Views in your MVC application. A great tool to help you with
that is Automapper.
Grz, Kris.
Read my blog | Twitter Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
But if you want to start from scratch I suggest you start a new MVC project and migrate your existing webforms. Certainly if they already make use of the 3 layered architecture then it should be a snap as most of the code can be recycled in the backend.
Grz, Kris.
Read my blog | Twitter Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
Marked as answer by Minhajul040182 on Dec 29, 2011 05:55 AM
Minhajul0401...
Member
77 Points
121 Posts
2 tier or MVC which one preffered
Dec 26, 2011 03:52 AM|LINK
Hi All
I am going to start new project related to Accounts and I am confused which design pattern whould I use. 3 Tiers or MVC . I am new to MVC and l alwyas used 3 tiers design pettern in my application.
Which one you will preffered to use and why?
Please Advise me
Thanks in Advance
simplefahad2...
Member
43 Points
42 Posts
Re: 2 tier or MVC which one preffered
Dec 26, 2011 03:57 AM|LINK
Use 3 tier beacuse it is more secure than other and easy to handle..
abiruban
All-Star
16072 Points
2736 Posts
Re: 2 tier or MVC which one preffered
Dec 26, 2011 08:11 AM|LINK
Hi
MVC
u can stat your project into MVC
The following are some of the benefits of using ASP.NET MVC.
You get REST URLS like /category/1/7243
You don't have to use the ".aspx" extensions (you never really did, but now it is easier to avoid).
Very clean, controlled HTML output. Less of what will show up is hidden from you, so you have a lot more control over the generated HTML.
Client side code becomes much easier to use since you have more control over the HTML. One problem with using JavaScript with WebForms is that naming containers cause the controls on the page to have strange names.
Testing becomes much easier. Webforms where very difficult to test. Because of the controllers instead of the pages themselves handling things, testing becomes much easier.
It becomes far easier to optimize URLS for search engines. With WebForms one needed to use URL rewriters which merely hid what the real URL was.
With WebForms there was a sense of state. Pages maintained their state between posts. This made things a little bit easier, but this obfuscation hides how interactions between the client and the server actually occur. MVC gives you much more control over the client-server interaction.
***DON'T FORGET TO CLICK “MARK AS ANSWER” ON THE POST IF HELPED YOU.
XIII
All-Star
182709 Points
23464 Posts
ASPInsiders
Moderator
MVP
Re: 2 tier or MVC which one preffered
Dec 26, 2011 08:21 AM|LINK
Hi,
MVC only lives in the presentation layer. You usually want to make a combination of a multilayered application and use MVC in the presentation layer (or tier).
I think you mean 3 layered architecture.
Layer = logical separation
Tier = physical separation
amount layers >= amount tiers
I would suggest you go for a 3 layered pattern with MVC in the presentation layer. (Likely it's going to be a 2 tiered application [tiere 1 = all the code on the application server, tier 2 = the database server])
Grz, Kris.
Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
XIII
All-Star
182709 Points
23464 Posts
ASPInsiders
Moderator
MVP
Re: 2 tier or MVC which one preffered
Dec 26, 2011 08:22 AM|LINK
Hi,
One can still create complete penetratable applications even when using a multi layered and multi tiered application. Security is an important point to take care off and is usually done too late in the creative process.
Grz, Kris.
Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
nirmal.bond
Member
290 Points
92 Posts
Re: 2 tier or MVC which one preffered
Dec 26, 2011 08:33 AM|LINK
Hello,
Go for MVC its good and easy to manage and a latest growing technology
Minhajul0401...
Member
77 Points
121 Posts
Re: 2 tier or MVC which one preffered
Dec 26, 2011 09:58 AM|LINK
HiAll
Thanks for you post... but my problem is that... I already started a project and completed modules of Administrator. My project structure is 3 tiers ... as follows
--- BAL (Business Access Layer ) Separate Project and took reference of its .dll file
---- DAL (Data Access Layer) Separate Project and BAL took reference of this project's .dll files (This project also depends SQL Engine Project which generates SQL Quesries every time and same out time to create on every move.
------ Models also is a seperated prohject.
Now my project is taking reference from these .dll files to complete its transactions. Could you please help me how to embed it in MVS 2 design pattern that I can not rewrite the code for changing.
Best Regards and waiting for respose.
XIII
All-Star
182709 Points
23464 Posts
ASPInsiders
Moderator
MVP
Re: 2 tier or MVC which one preffered
Dec 26, 2011 10:02 AM|LINK
Hi,
simply create a new MVC project. Reference the BAL and Models, not the DAL, projects and go with the flow.
In the Controllers you make calls to your BAL layer. Optionally you can transform your Models, which you pass around through all the layers, into ViewModels which are only there to be used for the Views in your MVC application. A great tool to help you with that is Automapper.
Grz, Kris.
Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!
Minhajul0401...
Member
77 Points
121 Posts
Re: 2 tier or MVC which one preffered
Dec 27, 2011 08:03 AM|LINK
Hi XIII
Thanks your valuable advise
But I am surprised that I created some webspages on my 3 layers sytem ...
I want to know that Can I keeep all the pages created before to use new MVC project in same project.
Thanks & Regards
XIII
All-Star
182709 Points
23464 Posts
ASPInsiders
Moderator
MVP
Re: 2 tier or MVC which one preffered
Dec 27, 2011 08:12 AM|LINK
Hi,
You can perfectly mix MVC with webforms in the same project yes: http://www.packtpub.com/article/mixing-asp.net-webforms-and-asp.net-mvc.
But if you want to start from scratch I suggest you start a new MVC project and migrate your existing webforms. Certainly if they already make use of the 3 layered architecture then it should be a snap as most of the code can be recycled in the backend.
Grz, Kris.
Interested in Azure, ASP.NET (MVC), jQuery, WCF, EF, MS SQL, ...
Keep the forums clean: report to the moderation team!