|
-
Mar 19th, 2011, 08:47 AM
#1
[RESOLVED] MVC and IoC
Hello,
I have still not as yet attempted a complete ASP.Net MVC Project, but I am toying with the idea of recreating my own website using ASP.Net MVC. I have been reading a lot lately about Inversion of Control (IoC) and Dependency Injection (DI), and I was looking for recommendations about which technologies I should use.
Do anyone of you use IoC and DI with your ASP.Net MVC applications?
Also, MVC obviously give you the separation of concerns for the UI perspecitive, but what techniques do you use for separation of concerns with regard to the Database, i.e the traditional BLL and DAL. How are those implemented in an MVC application?
Thanks in advance!
Gary
-
Mar 20th, 2011, 08:10 PM
#2
Re: MVC and IoC
 Originally Posted by gep13
Do anyone of you use IoC and DI with your ASP.Net MVC applications?
I'm currently using Castle Windsor in one project because it's part of the client's own application development framework. We're also using Autofac in a WPF MVVM project. I'm planning on looking at others in my spare time too, when I get some. Those two seem OK but I don't have to much to compare with at this point.
 Originally Posted by gep13
Also, MVC obviously give you the separation of concerns for the UI perspecitive, but what techniques do you use for separation of concerns with regard to the Database, i.e the traditional BLL and DAL. How are those implemented in an MVC application?
Service layer, repository, data transfer objects (DTOs).
-
Mar 21st, 2011, 12:30 AM
#3
Hyperactive Member
Re: MVC and IoC
While I eventualy moved to StructureMap (had to for work) I used to use Castle also.
Back then this kid got me going with his articles. Good stuff
-
Mar 21st, 2011, 02:42 AM
#4
Re: MVC and IoC
Hello there,
Castle Windsor is the one that I keep hearing about, so I think I will run with this one to start with. It just feels like there is SO much new technology out there just now, that it is difficult to know where to start.
John, are you using Entity Framework at all at the back end, or do you find that you don't need it?
Krok, thanks for the link, I have bookmarked it 
Gary
-
Mar 21st, 2011, 03:30 AM
#5
Re: MVC and IoC
We're not using EF in either of the two projects I mentioned earlier because the client framework for the MVC project requires NHibernate and the MVVM project uses Oracle, for which there was no final EF provider available (and may still not be). The IoC container doesn't really affect the choice of data access technology anyway though.
-
Mar 21st, 2011, 04:58 AM
#6
Re: MVC and IoC
 Originally Posted by jmcilhinney
The IoC container doesn't really affect the choice of data access technology anyway though.
Oh yeah, totally agree. I guess my original question was actually two questions 
Typically, I have always had a DAL that talks to the SQL Database directly, and then a BLL to interface with the DAL, and so on. Having never played with EF, I can't picture in my head, how to separate the concerns once you have the DataContext model created.
(I realise this is getting off topic )
Gary
-
Mar 21st, 2011, 06:12 AM
#7
Re: MVC and IoC
Your EF data model or L2S data context or whatever is encapsulated in the repository. The demo project on the ASP.NET does just that.
-
Mar 21st, 2011, 06:38 AM
#8
Re: MVC and IoC
Hello,
Can you clarify which demo project you are referring to? Thanks.
Gary
-
Mar 21st, 2011, 06:50 AM
#9
Re: MVC and IoC
Hmmm... looks like the MVC 3 tutorial doesn't demonstrate implementing a service layer and repository, where the old MVC 1 & 2 tutorials did. I'm sure that you would be able to find examples though.
-
Mar 21st, 2011, 08:31 AM
#10
Re: MVC and IoC
Ok, I will have a dig around, and see what I can find.
Thanks
Gary
-
Mar 28th, 2011, 08:40 AM
#11
-
Mar 28th, 2011, 05:55 PM
#12
Re: MVC and IoC
 Originally Posted by gep13
Indeed.
-
Mar 29th, 2011, 01:34 AM
#13
Re: MVC and IoC
 Originally Posted by jmcilhinney
Indeed.
Noice! Thank you very much.
I have added this to my growing list of things to read up on. Thanks for your help!
Gary
-
Apr 14th, 2011, 09:14 AM
#14
Re: [RESOLVED] MVC and IoC
Thought I'd throw a couple other options out there for containers. I prefer Unity myself and a lot of the examples I see out there use MEF.
ASP.NET MVC 3 Service Location (Works with beta 1 but I believe anything that has changed has been noted.)
http://forums.asp.net/1146.aspx - Official MVC forums
-
Apr 15th, 2011, 09:15 AM
#15
Re: [RESOLVED] MVC and IoC
They had a session on using MVC 3 and MEF at MIX 11 yesterday. Should be beneficial even if you're using a different container.
Fun with ASP.NET MVC 3 and MEF
- Video and Code aren't posted yet (7:15 PST) but I'd expect them to be up in the next couple of hours.
-
Apr 15th, 2011, 04:04 PM
#16
Re: [RESOLVED] MVC and IoC
Hello there,
Thanks for the heads up, will be sure to take a look at that!
Gary
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|