100 comments

  1. This is the best video about dependency injection I have found out there.
    Your videos are very educational and keep up the good work. Congratulations !!!

  2. Hi,
    Here you can you use a simple Conditionnal Resolution via Unity, related to the example of the above nice Video:

    IUnityContainer objContainer= new UnityContainer();
    objContainer.RegisterType<customer>();
    objContainer.RegisterType<Idal,SQLServerDAL>("sql");
    objContainer.RegisterType<Idal, OracleDAL>("oracle");

    var Sql = objContainer.Resolve<Idal>("sql");
    var cust= objContainer.Resolve<customer> (new DependencyOverride(typeof(Idal), Sql));
    cust.CustomerName = "inject Dependances";
    cust.add();

  3. Hi. Very grateful for your efforts. I can say I understood right from the first video. Please consider doing the next installment. it would be very helpful for a lot of us. Thanks again.

  4. Do I have to register both IDal implementation and how does the UnityContainer decide which IDal implementation to inject to the Customer constructor???

  5. hi brother it's nice explanation… in mycompany I need to implement this concept as per my architecture advice .. could you please share second part of this video for condition resolve

  6. Great Video , But I need to look into second part when I visit http://www.questpond.com/ it just show me list of video but where is exact location of second part , i think this is same like any discount on any product , if you look any product then one is free but for most like product you have to pay , but that also fine but give me exact link..

    Thanks a lot for sharing such a lovely video… Thanks a lot.

  7. Nice video.
    Basically you need to 1) nuget unity, 2) register types somewhere at your startup and 3) use Resolve instead of new()… and that´s it

  8. Hi how do i call SQL or Oracle Add Method when calling Customer Class Add Method, because at now it will call only last register IDal Add method

  9. One small comment: If you stop repeating same and quite obvious things you can make more efficient videos. Keep doing good work !!

  10. Hello nice turorial, but a very simple and maybe stupid question for advanced developers, How can we create a condition to choose Oracle or SQL object? becase I don't see the advantage of this, I would like to use same interface for diferent classes using Unity but in this example Oracle will be always selected, I dont see the advantage. Please help a beginner programer
    . Thanks

  11. hi can you tell me – from where obj.container.resolve<customer> came to know that it is calling sql or Oracle???? it is used defined classes… how does utility came to know these??

  12. Doesn't registertype basically new up the classes? So why not create a class that returns each type of interface? It seems like unity is doing the same thing just behind the scenes.

  13. According to DI every module should be decoupled, it has been achieved through the above example but its not a good architecture here. As in Main method i.e. UI project they will require the SQLServerDal and OracleDAL class references, these class references should be in BAL only, it should not be extended till UI, and UI project should have only BAL reference.

  14. Not dividing the project into separate projects for the different application layers significantly reduces the effectiveness of this video. New users need to understand what references need to be set in each of the different layers.

  15. Question –
    at 26:20 mins — instead hwy not it create a customer object without constructor ?- why it automaticlly created with constrcuor and that to with OracleDal- we disn't called any injection for the constructor param wight ?

  16. Beginning of this video was too good but at the end confused totally !! At least you should make us clear why it is calling last registered and how to control it. Frankly speaking it's confusing us. Will you be able to make a fresh video and explain clearly.

  17. You say GO and watch IOC first! Go ! then when i search for it in your list nothing comes up…. ? Pleas add a link of what you refer too.

  18. how to handle many business objects such as customers, suppliers, agents etc in dependency injection? Should we add every object in the container

  19. IDal Idal = new SqlServerDel();

    a parent class reference variable can point to child class object is called polymorphism

  20. thank you so much it was a pretty good tutorial and i learned how to decouple an application by implementing DI IOC injections

  21. This helped me understand Unity and Dependency Injection better than most of the explanations found on the web. Simple and straight to the point.
    Thank you.

  22. IUnityContainer objContainer = new UnityContainer();

    objContainer.RegisterType<Customer>("IDal");

    objContainer.RegisterType<IDal,EmployeeSQLServerDB>();

    objContainer.RegisterType<IDal, EmployeeOracleDB>();

    From the above how can I have to use SQL Server DB connection how should I gain control over it.

    I've tried some modification as below:
    objContainer.RegisterType<IDal,EmployeeSQLServerDB>("EmployeeSQLServerDB");

    objContainer.RegisterType<IDal, EmployeeOracleDB>("EmployeeOracleDB");

    But how Customer object knows which DB connection to select as it is returning lastly added Class in the container ?

  23. Hi, thanks for making this video. I finally learned how DI works. But now I want to learn more and I can't find the next part of this video. Could you please share it?

  24. Dependency Injection Lay Man Terms. A charging adapter with usb port has inverse dependency with pendrive. Direct dependency means only a pendrive can be plugged into the charging adapter. Usb (universal serial bus technology is called the interface) . The company that made the adapter exposed an interface. Pendrive making company injected the dependency which is the pendrive device. Since the charging adapter has reversed or inversed the dependency you can now plugin a mouse or a keyboard or anything to this adapter. Thats it

Leave a Reply

(*) Required, Your email will not be published