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?