Error while injecting logWriter

Topics: Logging Application Block, Policy Injection Application Block
Jan 8, 2010 at 4:00 AM

Hi All,

I have a Windows Forms application which perform CRUD operations to a database. Nothing fancy, very simple. To enable logging, i am using Logging Application block in conjunction with Unity.

I have a class named ServiceLocator.vb, which initializes the container with the dependent objects. I have two client objects, Form1.vb and Form2.vb that act as user interfaces. Everything worked as i expected.

 

I eventually had to convert my Form1.vb and Form2.vb into two Windows Service components, where the user interface is replaced with other form of input.

So, this is what i did. I put the forms into two independent windows service projects.

To the Windows service projects i included Core (which is my original project) as a reference.

When i try to run this, i get errors that i cant seem to understand. the details are below.

 

Dim batch As Batch = Core.ServiceLocator.Container.Resolve(Of IData)(Constants.BATCH)

Error i get here is -

Resolution of the dependency failed, type = "Core.IData", name = "BATCH". Exception message is: The current build operation (build key Build Key[Core.Batch, BATCH]) failed: The parameter logWriter could not be resolved when attempting to call constructor Core.Batch(Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter logWriter). (Strategy type BuildPlanStrategy, index 3)

 

I believe i am missing something very basic. Could someone please highlight?

 

thanks, Hari.

Jan 8, 2010 at 4:33 AM

Please post this in the Unity forum - http://www.codeplex.com/unity/Thread/List.aspx

 

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.

entlib.support@avanade.com