Extending the WCF sample

Posts   
 
    
methodman
User
Posts: 194
Joined: 24-Aug-2009
# Posted on: 10-Nov-2009 15:02:35   

I took a look at the WCF sample available on your page. The WCF service class NorthwindService is in one class and INorthwindService is also defined in one interface.

So my questions are:

1. My question is how should I continue in case of implementing more functionality? Should I implement the WCF classes per entity or per aggregate root or for the whole system (this last option seems to me inacceptable)?

2.This question depends partially on the answer of the first but I'll ask anyway :-) Should I create one ServiceHost instance for every Service class like this


host1 = new ServiceHost(typeof(MyService1));
host2 = new ServiceHost(typeof(MyService2));
.
.
.
host1.Open();
host2.Open();
.
.
.
public class MyService1 : IMyService1
{
    #region IMyService1
    #endregion
}

public class MyService2 : IMyService2
{
    #region IMyService2
    #endregion
}
.
.
. 

Would be this ok for a larger solution ? I'm running a Windows Service.

Thx in advance for a comment!