Note that there are some explanatory texts on larger screens.

plurals
  1. POWCF Repository Service pattern with entity framework
    primarykey
    data
    text
    <p>I need presentation layer in silverlight, asp.net etc , so everything is through wcf services. I have number of doubts in my implementation of repository layer, service layer, wcf services</p> <p>things i currently do</p> <ol> <li>I have repository , its not per table its created per aggregate root</li> <li>I have service layer its for doing a group of actions involving multiple repository</li> <li>WCF service wraps the methods in service layer and repository layer</li> <li>The entities are auto generated by EF </li> <li>The entities are passed and returned to service layer as complete graph</li> </ol> <p>6.I have two concrete class with all repository , and service called repositorycontainer and service container , Repository container is passed to the service </p> <p>My repository base </p> <pre><code>public class RepositoryBase { public DataBaseContext _Context; public RepositoryContainer _RepositoryContainer; public RepositoryBase(RepositoryContainer repositoryContainer) { _RepositoryContainer = repositoryContainer; _Context = repositoryContainer.Context; } public RepositoryBase() { _RepositoryContainer = new RepositoryContainer(); _Context = _RepositoryContainer.Context; } } </code></pre> <p>My repository container</p> <pre><code>public class RepositoryContainer { public RepositoryContainer() { Context = new DataBaseContext(); } public RepositoryContainer(DataBaseContext context) { Context = context; } public DataBaseContext Context { get; set; } public SurveyRepository _SurveyRepository; public SurveyRepository SurveyRepository { get { return _SurveyRepository ?? (_SurveyRepository = new SurveyRepository(this)); } } } </code></pre> <p>My service container</p> <pre><code> public class ServiceContainer { public ServiceContainer() { RepositoryContainer = new RepositoryContainer(); } public ServiceContainer(RepositoryContainer container) { RepositoryContainer = container; } public RepositoryContainer RepositoryContainer { get; set; } public SurveyService _SurveyService; public SurveyService SurveyService { get { return _SurveyService?? (_SurveyService= new SurveyService(this)); } } } </code></pre> <p>To do an operation I just create RepositoryContainer or ServiceContainer</p> <p>then calls</p> <pre><code>RepositoryContainer.Repository.Method() ServiceContainer.Service.Method() </code></pre> <p>My doubts are</p> <ol> <li><p>Is that service / respository container fine ?</p></li> <li><p>I already have the service layer, so as i have wcf service what i call the current service layer servicewrapper or something ?</p></li> <li><p>I need to call repository methods itself eg: GetCategory() etc , also all methods in service layer, So i need to wrap both methods and service in wcf service, is it fine ?</p></li> <li><p>Where to do the caching ? as i am using EF i think there is something way to use a cache provider with EF ,</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. CO- Clients can access individual WCF methods directly, or via the service layer (which "aggregates" one or more WCF methods into a larger / more complex "method" - is that right? - Caching: Do you have performance issues? If so - where? - What's the difference between a ServiceContainer and a RepositoryContainer?
      singulars
    2. CORepositories do like GetCategories, Insert Delete etc, Operations / BL is done in service, for eg: I have user repository , Survey repository, When i update survey , i update a field in user(Logic) , So its are handled in surveyservice, where it calls user & survey repository methods , simply my repository doesn't conatin logic, all logic wrapped into service layer , Instead of creating each repository instances , it all wrapped into repository container, so i just need to create repository container (Creating an instance of it is not costly) ,
      singulars
    3. COSame way for services, When creating service container repository container is passed , its then passed to each service instances, so in each service there is no need to create each repository instances, Note: somhow i am not a fan of IoC. The problem is ,I like current things i do without WCF, means all residing in a single server , i need to seperate apllication server (BL) , If its all together i just reference the core dlls , create instance of repository container, service container call the methods, now i need WCF
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload