Linq-to-SQL: how many datacontexts?

I have a SQL Server 2008 database with tables> 300. The application I need to develop is a Windows Forms, .NET 3.5, C # application.

What is the best way to work with Linq-to-SQL?

I intend to make a datacontext for each business object.

Is there a problem?

I need to know if this way of working with Linq-to-SQL has any flaw or may cause performance issues?

Thank.

+3
source share
4 answers

DBML (= ). DataContext -, LINQ to SQL, ( ), LINQ .

(+300 ), . , LINQ to SQL. . ( DBML ), , , . , L2S .

, +150 5 DBML, DBML. , DataContext , .

+8

-, datacontext .

+6

, , , . , : , .

0

Now I use 1 for the entire database, but there are legal ways to use more. For example, I run a script when I install my site, which connects to a remote database, and imports and converts the data into a new format for deployment. The process uses several temporary tables.

Having placed the temporary tables in a separate context, after deploying the site, I can simply delete these contexts and code, since they are independent objects.

0
source

Source: https://habr.com/ru/post/1747669/


All Articles