Base solution for your next web application
Open Closed

the priority of DI #947


User avatar
0
dashu created

if i implement IAuditingStore as myAuditingStore, SimpleLogAuditingStore will be overridden by myAuditingStore why SimpleLogAuditingStore be overridden? how it implemented? does DI have priority ?


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    If you want "simpleLogAuditingStore will be overridden by myAuditingStore", you need to register myAuditingStore in your module's PreInitialize method. Abp registers dependencies in Initialize method of modules.

    In Castle Windsor, by default first regitered dependency wins unless you use "IsDefault()". I dont remember the scenario if you use "IsDefault()" more than once, but you can test it :)

    You can check it here <a class="postlink" href="https://github.com/castleproject/Windsor/blob/master/docs/whats-new-3.0.md#component-can-now-force-being-default-for-its-services-without-needing-to-be-the-first-one-registered">https://github.com/castleproject/Windso ... registered</a>