How to register multiple IDbConnectionFactory instances using Funq in ServiceStack.net

前端 未结 4 563
暗喜
暗喜 2020-12-08 03:15

How would you go about registering diferent IDbConnectionFactory instances in Funq and then access them directly within your services? Do named instances somehow come into

4条回答
  •  孤街浪徒
    2020-12-08 03:54

    Although Funq doesn't support Auto wiring, ServiceStack implementation of it does. The latest version of ServiceStack includes the Funq.Container overloads:

    container.RegisterAutoWired();
    container.RegisterAutoWiredAs();
    container.RegisterAs();
    

    So in Steven's example you can also do:

    container.RegisterAs();
    

    And it will automatically register the dependencies for you.

提交回复
热议问题