Mapping to Interface without singleton

matej's Avatar

matej

19 Nov, 2013 08:46 AM

Hello,

I want to map ClassA to IClassA but I want it to be instantiated a new on every inject.

How to do that?

thanks

  1. Support Staff 1 Posted by Ondina D.F. on 19 Nov, 2013 09:32 AM

    Ondina D.F.'s Avatar

    Have you tried this?

    injector.map(ISomeClass).toType(SomeClass);

  2. Support Staff 2 Posted by creynders on 19 Nov, 2013 09:39 AM

    creynders's Avatar

    injector.map(IClassA).toType(ClassA)

  3. Support Staff 3 Posted by creynders on 19 Nov, 2013 09:40 AM

    creynders's Avatar

    Ah Ondina beat me to it. Of course. :)

  4. 4 Posted by matej on 19 Nov, 2013 10:05 AM

    matej's Avatar

    Yes,

    just tried it, works brilliantly.

    Cheers

  5. Support Staff 5 Posted by Ondina D.F. on 19 Nov, 2013 11:30 AM

    Ondina D.F.'s Avatar

    @creynders My day starts earlier than yours:)

    @matey great!

  6. Ondina D.F. closed this discussion on 19 Nov, 2013 11:30 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac