I was wondering about if wcf would be kinda break down if mixed in with IRepository
because 2 different sources are going to be using the same contract: - 1 being used by WCF - another by Asp.net Nhibernate
So i wanted to reuse the same contract rather making another replica with one or 2 things out.
Easier understood by an example...
[ServiceContract]
public interface ITutorialService
{
[OperationContract]
void AddTutorial(Tutorial newTutorial);
[OperationContract]
List<Tutorial> GetTutorials();
[OperationContract]
void RemoveTutorial(string id);
Tutorial GetTutorialModel();
Tag GetTagModel();
Video GetVideoModel();
IRepository<Tutorial> GetTutorialRepository();
IRepository<Tag> GetTagRepository();
IRepository<Video> GetVideoRepository();
}
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
public class TutorialService : ITutorialService
{
private IRepository<Tutorial> _tutorial;
private IRepository<Tag> _tag;
private IRepository<Video> _video;......
in short would the wcf work fine as i didnt add any [OperationContract]
to the Irepository ?
Yes it will work. The methods without [OperationContract]
won't be WCF operations, but it sounds like that's what you want.
Another approach would be to have two interfaces and have one derive from the other so that you have separation of concerns, but do not have to define the methods twice.