Multiple LLBLGen Projectes & Injectables

Posts   
 
    
gabrielk avatar
gabrielk
User
Posts: 231
Joined: 01-Feb-2005
# Posted on: 17-Sep-2008 11:18:02   

Hi,

We've got 2 data projects in our solution which work on different databases. We have a generic AuditorInjectable, which is only meant for 1 of these projects, but related to IEntity.

The problem is that the Auditor also gets injected in the Entities of the 2nd project what we wouldn't want to happen. Is this a configuration problem, or how can we otherwise prevent this from happening?

Cheers, Gab

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 17-Sep-2008 11:41:04   

This is configurable in tha application config file, either by auto discovery or manually by using the <dependencyInjectionInformation> section. Please check the Generated code - Setting up and using Dependency Injection

gabrielk avatar
gabrielk
User
Posts: 231
Joined: 01-Feb-2005
# Posted on: 17-Sep-2008 11:52:19   

Ofcourse I checked that section but I could not determine what to do.

I have 2 generated projects with entities: Application.User.Data (I want injectables here) Application.Master.Data (I don't want injectables here)

I have 1 injectables project: Application.Injectables

This is in my configuration file:


  <dependencyInjectionInformation>
    <additionalAssemblies>
      <assembly fullName="Application.Injectables, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
    </additionalAssemblies>
    <instanceTypeFilters>
      <instanceTypeFilter namespace="Application.Injectables" />
    </instanceTypeFilters>
  </dependencyInjectionInformation>

Please give a hint on what to do where.

Cheers, Gab

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 17-Sep-2008 12:27:09   

I have 2 generated projects with entities: Application.User.Data (I want injectables here) Application.Master.Data (I don't want injectables here)

In the AuditorInjectable class modify the DependencyInjectionInfo attribute to set the TargetNamespaceFilter:

[DependencyInjectionInfo(typeof(IEntity2), "AuditorToUse", ContextType = DependencyInjectionContextType.Singleton, TargetNamespaceFilter = "Application.User.Data")]