Which layer does the dlinq *. dbml file belong?

Source: Internet
Author: User
Today, I tried to use the. net3.5 architecture website and found a problem. Which layer does the LINQ operation belong to when I use the LINQ to operate the database?

If you only use a database, it is no problem to put LINQ on the data layer. Then, you can use it to encapsulate the LINQ data. However, if you use a factory to deploy multiple types of databases, the problem arises. If you put LINQ on the data layer, idal will not be able to obtain the model type, and the factory will not be able to return the data type. Because the data layer must reference idal to implement the interface defined by idal, and the structure obtained by the factory in configuration is exactly the interface defined by idal. That is to say, the idal must be referenced by both the factory and the data layer at least, but the idal must reference the model so that the object can be used. The problem is that the LINQ model is encapsulated in the *. dbml file.

After some thought, I think *. dbml files can only be encapsulated in the model layer, although it brings adverse reactions-any layer has the ability to directly operate data. But there is really no way to do it, or you can only define another model, but it has brought a lot of extra work.

What do you think?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.