How many objects should the RIA domain service include?

I was wondering how to accurately implement the domain service in the RIA. Is it customary to include all objects in the entire domain model in the service of a single domain, which makes the service responsible for the entire database? Is this usually done? I really have no reason to share data access between services, but I was wondering if this is considered good practice and what are the pros and cons of this approach.

In addition, is it considered good or bad practice to register a domain context as a singleton with IOC so that the entire application works with the same data set while avoiding concurrency problems and similar problems?

Thoughts?

thanks

+6
c # dns wcf-ria-services
source share
2 answers

We have two separate services in our application: one for the data model and one strictly used for authentication. We took this project from the application structure of the MS business sample.

We considered the possibility of breaking our data domain service into smaller components, but decided against it because it did not seem to add any advantages (other than reducing the size of the class of service). If you have separate data models that are completely independent of each other, then the transition along this path may make sense. Intuitively, a domain service must represent the entire domain. If your domains are independent (with a random need for a crossover ), then it is logical to separate them this way.

Regarding using context like Singleton: I tried this and eventually instantiated the class. We had no problems with this, as they all use the same basic connection. I donโ€™t know what the โ€œofficialโ€ best practice is, but thatโ€™s how I saw it in numerous RIA applications.

+1
source share

Thanks Nick. I actually did the same thing as you, I built two services: one for authentication and one for accessing data. This seems to me the most logical.

As for creating a datacontext a singleton, I tried this too, and it works well. No need to constantly reload and update data and worry about concurrency issues in other classes :)

0
source share

All Articles