Multiple/single instance of Linq to SQL DataContext

后端 未结 5 690
遥遥无期
遥遥无期 2020-12-01 00:04

I have a project with a number of different classes querying and modifying data in a common set of tables. I\'ve set up a .dbml file which provides us with a DataContext cla

5条回答
  •  萌比男神i
    2020-12-01 00:38

    I've always heard that you should use a single instance of the DataContext. I usually create a singleton instance of my DC in my business logic class, and use it for all my linq queries.

    I'm sure some of the linq gurus on here might be able to give you exact reasons as to why you should only have on instance of your data context class... I'm not quite certain.

提交回复
热议问题