c# - LINQ to SQL architecture. What is best? -


This question is like a pool, trying to identify the best architecture while using ORM like SQL from LINQ Are there. The drawings we are defining for are outlined, which refer to other applications directly or via webservice through DPLL. We have .NET apps and PHP applications.

The possibilities are:

Multiple data references: Separating databases into units of work and creating separate references for each one.

Professionals:

  • Easy to Use
  • Classes will be divided into separate names
  • Small domain to maintain

Cons:

  • If relevant, maintenance must be duplicated objects when creating hell
  • Any other hits in the context of the data With the need of creating the object, the object can not be used in the context. Base

Single Data Reference: All tables, ideas, processes, live in the same huge context.

Professionals:

  • No Repetition
  • Managing relationships is easy, by default LINQ takes care of it.
  • Better performance on DB, less hits.
  • All tables are in the same name space, the code is completed
  • Not the best for the designer (at least VS 2008)
  • Can not choose whether to save one, be selective d? Save all, or delete all the modes.

Okay, they came to my mind, so if there is any other professional or bad, please tell me and I will include them in the post.

I understand your doubts. I had this when I started using LinqToSql

During this exercise I came to know that only one reference approach is most useful, I was started to create a personal project, where I I can check all the approaches. This solution seems easy to maintain and if you need to recreate the domain, then you will only manage one file in a single project.

During other aspects, I realized that the use of LinqToSql is not directly efficient. In case of organization, if you have a project where a team will do development instead of only one person, then you LinqToSql should have "shield" from them to be a "sheriff" who will handle with the domain and you should use some abstract mechanism to protect the model from misuse (I apply a repository pattern Ia and it worked well, but you can find different ways).

I had to face the problem of creating some logical groups within the domain. What I did was the same, which is called set to use some DDD (domain driven design) techniques. Set up is a logical system of entities within such a domain, where you have a root unit (which acts as an aggregator) and there are many other satellite organizations related to them. You can create some new entities in the LinqToSql domain. These new institutions will be disconnected from the database and will work as aggregators. This approach will help you create "subdomains" within your domain and design your better.

In the end, I realized that the best way to use LinqToSql is to reference a simple DAL like a reference

to expose the data to some extensions (where we create our code Use T4 to help) Re-use your domain, where the institutions are converted to DTO (Data Transfer Object).

I am publishing the steps I took during my blog (it has not been completed yet):


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -