1

I'm really new to VS C# and coming from JAVA(Spring) background I'v embark my self in doing a POC with Webapi 2 and VS2013.
So now I'm stuck at the DI container creation so I'm going to use dryIoc but I'm not sure exactly how to create one? even better how to do one that automatically scans your entire classes-models-repository and figures out what are the dependencies.

Any good Articles tutorials on how to do this, best practices patterns? What I've found in the docs is not completely clear on where exactly do I put this code or how to do it so that it scans folders/classes.

EDIT:
Clarifying: this is what I'm trying to accomplish :

  1. I need to create a DI IoC Container based on dryIoC. Why dryIoc
  2. Cannot use Unity.
  3. A way for the container to scan the classes and automatically register them, not one by one.
yokodev
  • 1,266
  • 2
  • 14
  • 28
  • Searching for tool/articles is off-topic on SO. You question is also very unclear in what you have problem with... – Alexei Levenkov Jan 14 '15 at 18:23
  • Ideally, you should be registering the mappings than scanning and loading. We've used Unity and configuration is best way to go – Saravanan Jan 14 '15 at 19:21
  • @AlexeiLevenkov I'm sorry just trying to learn, have not found other resource... – yokodev Jan 14 '15 at 19:50
  • @saravanan because of requirements we can't use Unity – yokodev Jan 14 '15 at 19:51
  • The idea was not to suggest unity, its about configuration of the mappings – Saravanan Jan 14 '15 at 19:52
  • WebAPI2 and ASP.NET MVC share a lot of common start up conventions. Try searching for DryIOC and MVC: https://bitbucket.org/dadhi/dryioc/issue/44/sample-use-with-aspnet-mvc – thorkia Jan 14 '15 at 19:58
  • @JAT2007 - "A way for the container to scan the classes and automatically register them" is very different from title of your post. You may actually want to ask 2 separate questions if you need help with 2 different aspects of using that library. – Alexei Levenkov Jan 14 '15 at 20:10

1 Answers1

0

Here is the sample with DryIoc, WebApi, and OWIN.

For batch / automatic registrations you may use RegisterMany.

dadhi
  • 4,807
  • 19
  • 25