使用LINQ2SQL或Entity Framework时,是否为大型数据库创建多个.dbml / .edmx文件?

时间:2021-03-18 09:37:14

When creating .dbml/.edmx for a database which has a lot of tables, do you use multiple .dbml /.edmx file or just a single giant file?

为具有大量表的数据库创建.dbml / .edmx时,是使用多个.dbml /.edmx文件还是只使用一个巨大的文件?

Any pro/cons for splitting the model into multiple file?

将模型拆分成多个文件的任何利弊?

Thanks, J.W.

2 个解决方案

#1


For Linq-to-SQL, there are a number of alternatives which allow you to create more granular sets of files, rather than one single HUGE file.

对于Linq-to-SQL,有许多替代方法允许您创建更精细的文件集,而不是一个单个HUGE文件。

Check out PLINQO - a CodeSmith template set - http://www.plinqo.com - very well done, allows you to update your model from the database, and creates one code file per object class.

查看PLINQO - CodeSmith模板集 - http://www.plinqo.com - 做得非常好,允许您从数据库更新模型,并为每个对象类创建一个代码文件。

Marc

#2


I just go for one per database. Then there are less contexts to manage and you won't ever face the scenario of realising that you need to create a relationship on two entities that you've put in separate files.

我只是为每个数据库找一个。然后,管理的上下文越来越少,您将不会面临这样的情况,即您需要在两个已放入单独文件的实体上创建关系。

#1


For Linq-to-SQL, there are a number of alternatives which allow you to create more granular sets of files, rather than one single HUGE file.

对于Linq-to-SQL,有许多替代方法允许您创建更精细的文件集,而不是一个单个HUGE文件。

Check out PLINQO - a CodeSmith template set - http://www.plinqo.com - very well done, allows you to update your model from the database, and creates one code file per object class.

查看PLINQO - CodeSmith模板集 - http://www.plinqo.com - 做得非常好,允许您从数据库更新模型,并为每个对象类创建一个代码文件。

Marc

#2


I just go for one per database. Then there are less contexts to manage and you won't ever face the scenario of realising that you need to create a relationship on two entities that you've put in separate files.

我只是为每个数据库找一个。然后,管理的上下文越来越少,您将不会面临这样的情况,即您需要在两个已放入单独文件的实体上创建关系。