On Aug 28 2014, we conducted a webinar titled “Introduction to IoC and Dependent Injection in ASP.NET”. This is part of the regular webinars that we i.e. Telerik India do every month. You can see the September/October webinar schedule here.
Slide Deck:
Following is the slide deck that we used as part of the webinar. You can view it online below or you can download to view it at your leisure time:
Video:
We record all our webinars so that people who missed attending live can view the recording on demand. Following is the video recording for this webinar:
Demo Source Code:
We had shown two demos as part of this webinar. It was divided as Part1 & Part 2. Part 1 talked about DI & IoC as a generic concept. Where as Part 2 we took a look at Di & IoC in ASP.NET MVC with Ninject as the container. Find the source code links below:
Part 1:
https://bitbucket.org/abhishekkant/survey-app-di-ioc-demo
Part 2:
http://1drv.ms/1rKBOm2
Q & A:
Q: what is ado.net?
A: You can read about ADO.NET here: http://msdn.microsoft.com/en-us/library/h43ks021(v=vs.110).aspx
Q: is there a ORM by Telerik to access data?
A: Yes we have. It is called Teleik DataAccess – http://www.telerik.com/data-access
Q: what is loosely coupling?
A: two classes are not directly coupled in dependency
Q: There are so many DI you mentioned , what are the most famous and used wide along?
A: NInject , Unity, StructureMap are some of the widely used ones
Q: Does ORM by telerik supports all database technologies?
A: Yes
Q: Is Telerik DataAcess open source ?
A: It is free to use commercially as well.
Q: Which is most useful, parameter injection or constructor injection?
A: Depends on your scenario. My personal pref is Constructor injection.
Q: what is high cohesion?
A: http://en.wikipedia.org/wiki/Cohesion_(computer_science)
Q: Which is best AutoFac or Ninject? As i have implmented the same with AutoFac
A: Doesnt matter. All the IoC containers are pretty much alike. Its just the ease of use for somebody. Ninject is a simple one too.
Q: from the Performance point of view , what you recommend?
A: All IoC containers out there in the market are more or less pretty good wuth respect to the perfrormance. so its just the ease of use that you need to pinpoint and use one
Q: Should we always think of getting on the interface way even when we are not sure if there could be multiple types of dependent class ?
A: Its always better to program to contract than a class.
Q: Can we achieve dependeny injection without an IoC?
A: Yes … its known as Poor Mans DI – where you hand craft everything that you need
Q: what is DI?
A: Dependency Injection. Making dependencies loosely coupled. A more formal definition can be found: http://en.wikipedia.org/wiki/Dependency_injection
Q: what is Ninject?
A: A DI Container. More details here: http://www.ninject.org/
Q: Hi, DI is always a combination of Poor Mans and IOC Container?
A: Not always. you can do DI with either approaches.
Q: How lifetime is managed in Ninject?
A: By specifying whether the object is created as Singelton or new object. fluent syntax .InSingletonScope()
Q: which container you would prefer Unity or Ninject or any other?
A: It is a matter of personal choice. All of them provide almost similar functionality.
Q: so who is taking the load of instanciating the object here- ninject or test app or both?
A: Ninject is responsible for creating the objects. It works with MVC pipeline to make it seamless.
Q: If we have difrent implementation of an interface, Can we decide on runtime which implementation to inject. Like getting from a web config file.
A: Yes possible. Ninject is meant for that :). You can use configuration settings in web.config for the same.
T-Shirt Giveaway:
If you are a regular to our webinars, then you know that we select 2 random attendees to receive our .NET Ninja T-Shirt. But we had a huge turnout for this particular webinar and we decided to pick 3 instead of 2 attendees from the webinar. Here are the lucky winners of our t-shirt:
- Inderpal Singh Uppal
- Vinay Bansal
- AjithKumar Rai
Congratulations to the winners. For the rest of you don’t worry. We still have a lots of webinars lined up. So be there and try your luck.
Till next time – Happy Coding.
Hi Lohith,
Hope you are doing great!!!
Could you please check the Link for the Demo Source Code for the Part – 1 i.e. being hosted on the Bitbucket as it shows an error message while accessing it on Bitbucket as “You do not have access to this repository”.
Thanks & Regards!!!
Hi
can you please check the link now. It should be working now. Thanks.