So I currently have a master DAO class ITrackingToolDAO that has all the Service Contracts for each of my business entities.
public partial interface ITrackingToolDAO {
void Open(string connectionString);
void Close();
IBusinessFunctionDAO BusinessFunction { get; }
IBusinessUnitDAO BusinessUnit { get; }
IProgramBudgetDAO ProgramBudget { get; }
IProjectDAO Project { get; }
...
}
My Service Contract looks like so
[ServiceContract(Namespace="http://bmgops.qintra.com/Tracking/v1/BusinessFunction")]
public partial interface IBusinessFunctionDAO {
[OperationContract]
BusinessFunction GetBusinessFunction(Int32 businessFunctionId);
[OperationContract]
IEnumerable<BusinessFunction> Find(string filter);
[OperationContract]
SaveEventArgs<BusinessFunction>Save(BusinessFunction businessFunction);
}
I currently have 2 concrete implementations of my ITrackingToolDAO interface. The first one is TrackingToolSqlDAO which instantiates a concrete SQL DAO for each entity. i.e) BusinessFunctionSqlDAO, ProjectSqlDAO, etc.
The second one is a TrackingToolWCFDao which creates WCF proxys using ChannelFactory<T> to create an implementation for all my DAO members.
Now, I want to start using the Windsor WCF facility instead of CreateChannel. What would be the best way to accomplish this ?
I was thinking of creating a dummy implementation of ITrackingToolDAO that took in an IKernel parameter in the constructor.
public class DummyDAO: ITrackingToolDAO {
public DummyDAO(IKernel kernel) {
_ProjectDAO = kernel.Resolve<IProject>();
....
}
}
This way i could use the WCF Facility to create all my channels. I just don't like it cuz it's using the container as a service locator which is a code smell. Ideally I would also like it if I could have my SQL DAO and new WCF DAo both registered in the container so I could create either one by just referencing them by name.
Any thoughts ?