Enterprise Services

Posts   
 
    
SteelRat
User
Posts: 12
Joined: 11-Nov-2007
# Posted on: 23-Nov-2007 12:43:04   

I have an Enterprise Services component that is running in server mode. It exposes functions of my DataAccessAdapter like FetchEntity and SaveEntity to the client application.

I am using dependency injection to add Validators, Authorizers, Auditors etc to my entities. When I Fetch an entity via this server component these do not seem to come through with the entity. If I use the component in Library/In-Process mode its fine so obviously the validators etc are not being included in the object graph during serialization.

I can add them back again from inside the deserialization constructor but thise seems a bit messy and it rather defeats the purpose of dependency injection. I suppose it would also be possible to manually include them in the object graph.

Is there a better/recommended way of dealing with this ?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 23-Nov-2007 15:54:12   

Is there any exception thrown?

I guess the problem is not about the Serialization/deserialization code. As it succeeds in the In-Process mode .

So I guess that in the Server mode, the assemblies including those types (your validators Auditors..etc), were not found, by the deserialization code to create instances from them.

SteelRat
User
Posts: 12
Joined: 11-Nov-2007
# Posted on: 23-Nov-2007 19:48:56   

No there is no exception.

I have done a bit more debugging and actually it seems that the Validator, Auditor etc are added to the object graph if they are created. The problem is that when I use dependency injection in server mode they are not actually created in the first place.

When you use an enterprise services component in server mode it is placed in the GAC and activated as a COM+ Component. As a result it does not have an app.config file so the instructions relating to dependency injection in the app.config file :

<configSections>
        <section name="dependencyInjectionInformation" type="SD.LLBLGen.Pro.ORMSupportClasses.DependencyInjectionSectionHandler, SD.LLBLGen.Pro.ORMSupportClasses.NET20, Version=2.5.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27"/>
    </configSections>

    <dependencyInjectionInformation>
        <additionalAssemblies>
            <assembly filename="XaverModel.dll"/>
            <assembly fullName="XaverModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ece590f0ddbb5536"/>
        </additionalAssemblies>
        <instanceTypeFilters>
            <instanceTypeFilter namespace="XaverModel.AuditorClasses"/>
            <instanceTypeFilter namespace="XaverModel.AuthorizerClasses"/>
            <instanceTypeFilter namespace="XaverModel.ValidatorClasses"/>
            <instanceTypeFilter namespace="XaverModel.ConcurrencyFactories"/>
        </instanceTypeFilters>
    </dependencyInjectionInformation>

...get ignored. As a result none of my dependency injected classes were being created. For now I have reverted to overriding CreateValidator(), CreateAuditor() etc which works fine.

Any idea how to get round the other issue ?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 25-Nov-2007 19:40:16   

SteelRat wrote:

When you use an enterprise services component in server mode it is placed in the GAC and activated as a COM+ Component.

I think you could you consider to use _Application Root Directory _and per app config files if your server side is a Win2K3. (http://blogs.msdn.com/florinlazar/archive/2003/12/04/41369.aspx)

SteelRat wrote:

Any idea how to get round the other issue ?

Could you please refresh us about what the other issue is? simple_smile

David Elizondo | LLBLGen Support Team
SteelRat
User
Posts: 12
Joined: 11-Nov-2007
# Posted on: 26-Nov-2007 11:07:24   

I think you could you consider to use Application Root Directory...

I did try using an application root directory but without success. I will give it another go, maybe I didn't configure it correctly.

Could you please refresh us about what the other issue is?

Sorry, the other issue is the component dependency injection. I meant other in the sense of "not the original problem I had reported".

Thanks for the tips.