1

I want to implement IoC in my application, I've few queries regarding that

While binding Interfaces to Classes, i want to specify the scope of the object While resolving the class object, i want it to resolve all the dependencies automatically While passing the vaue type arguments to my binding, how could i use factory methods to pass the value as i don;t want to use constructor arguments for the same

I am using IoC in my WCF application, if i am doing something wrong please suggest some better approch to get best results

Thanks

manav inder
  • 3,531
  • 16
  • 45
  • 62
  • 1
    Instead of complaining at my answer, please edit your answer to make it better - it's been up for 4 hours and the 11 views include a lot of people who know the answers if the question is clear. Do you really believe this is the best possible way in which you can express your question? No code snippets? No explaining the sort of app you have? When you've done that, feel free to whinge. You didnt indicate whether you've looked at Ninject.Extensions.Wcf – Ruben Bartelink Aug 03 '11 at 06:59

1 Answers1

1

First of all, be sure to look at Ninject.Extensions.Wcf including the examples and the fact that you put a custom factory in the .svc file.

Then just issue Bind<>().To<>().InXyzScope().WithConstructrorArgument(...)calls in your Module Load.

You havent asked a structured question though so I doubt anyone else is going to be able to make a better stab at an answer than this, which probably isnt going to make you happy...

Ruben Bartelink
  • 59,778
  • 26
  • 187
  • 249
  • Thanks for your reply, but WithConstructorArgument is a big headache for me, i am binding my Kernel in my Global.asax.cs file. SO all the binding to the kernel is done prior to execution of the application, the constructor argument that i want to pass is dynamic not static, so how could your comment helps me, as i guess you are suggesting to pass constructor arguments while binding the kernel. Please suggest something better. – manav inder Aug 03 '11 at 06:16
  • 1
    I think the most important point of this answer is the last sentence. If you want a better answer you have to give more detailed information about your problem. E.g. Why have you to pass different value types for all the instances using constructor injection? Why can't they passed with the operation you execute on them? – Remo Gloor Aug 03 '11 at 06:37
  • Hi, i http://stackoverflow.com/questions/6924911/implement-scope-in-ninject-implementation repost the question, Please check and help me if you got – manav inder Aug 03 '11 at 10:19
  • 1
    @MSingh: I really prefer when people try to salvage a worthless question. I'd consider upvoting that. Right now, the question and whe answer together are not much use to anyone. – Ruben Bartelink Aug 03 '11 at 22:38