Hi,
To keep up with the loose coupling rule in SCSF/CAB I wanted to use
RootWorkItem.Services.Add<SomeInterface>(someservice) ,where SomeInterface is the LLBLGen Pro generated interface, to keep the DALServic global to all modules. This wont go as Otis explained.
Now I have tried another road. I would be very happy if those of you who use LLBLGen with SCSF to comment on this if you use another and better way to do this.
- Make an assembly where I open the channel, tcpchannel. In this assembly is one method who returns the Dalservice.
-
This assemply is referenced only ones in the SCSF-project. (F.eks in Shell or login form)
and add the service to RootWorkItem. See further down.
- Make a service-module, name it RemoteService and one class:
public class RemoteDALService
{
private IAgnesService _dalservice;
public IAgnesService Dalservice
{
get { return _dalservice; }
set { _dalservice = value; }
}
}
(IAgnesService is the LLBLGen generated interface)
-
In the Shell I add this service to the RootWorkItem:
RemoteServiceHelper.Services.RemoteService rc = new Zeuss.RemoteServiceHelper.Services.RemoteService();
rc.TcpService();
IAgnesService DalService = rc.DalServices();
RemoteDALService context = RootWorkItem.Services.AddNew<RemoteDALService>();
context.Dalservice=DalService;
-
In every "Some"-viewpresenter I inject this service like that:
private RemoteDALService _remoteService;
[InjectionConstructor]
public Some_ViewPresenter
(
[ServiceDependency] RemoteDALService remoteService
)
{
_remoteService = remoteService;
}
Now I have access to Dalservice in all modules.
What I have seen and tested of LLBLGen Pro, I can say that SCSF and LLPLGen go together beautifully.
Thanks