如何处理超过100个表的数据库

时间:2022-07-06 19:30:42

I have a database with over a 100 tables, 30 of them are lookup tables with lookup Language tables. each table links back to one or three tables. but there are around 20 different web forms that needs to interlink for a registered user.

我有一个包含超过100个表的数据库,其中30个是具有查找语言表的查找表。每个表链接回一个或三个表。但是有大约20种不同的Web表单需要为注册用户链接。

My question is, do i create one connection string with one Model, or do i break them up into individual models?

我的问题是,我是否使用一个模型创建一个连接字符串,或者我将它们分解为单个模型?

I've tried the breaking up into individual models based on the page that they are required for, but this just throws up validation and reference errors looking for the same field.

我已经尝试根据它们所需的页面分解成单个模型,但这只会引发查找相同字段的验证和引用错误。

I don't have any errors to show at the moment, but i can provide if necessary.

我此刻没有任何错误,但如有必要,我可以提供。

2 个解决方案

#1


0  

Sounds like you need to create some views so that you can consolidate the queries coming from the database. Try to think of logical groupings of the tables (lookup and otherwise) that you have and create a view for each logical grouping. Then, have your application query against those views to retrieve data.

听起来您需要创建一些视图,以便您可以合并来自数据库的查询。尝试考虑您拥有的表(查找和其他)的逻辑分组,并为每个逻辑分组创建一个视图。然后,让您的应用程序查询这些视图以检索数据。

As for connection strings, I don't see why you would need more than one if all of the tables are in the same database.

至于连接字符串,如果所有表都在同一个数据库中,我不明白为什么你需要多个连接字符串。

#2


0  

If you have the possibility to create only one connection string, that is what you should do.

如果您有可能只创建一个连接字符串,那么您应该这样做。

When you create a second connection string, it's because you have no choice. Having many different connections strings is just going to add to the confusion you migth already be in.

当您创建第二个连接字符串时,这是因为您别无选择。拥有许多不同的连接字符串只会增加migth已经存在的混乱。

The number of tables you have in a data base is never going to influence how many connection string you should have. I would even say : having acces to all the information of your database through one single object is an advantage. Now, the way you are going to organise the impressive amount of informations is crucial, and there is a lot of way to accomplish that. You need to find out yours.

您在数据库中拥有的表数永远不会影响您应该拥有的连接字符串数。我甚至会说:通过一个对象访问数据库的所有信息是一个优势。现在,您要组织大量信息的方式至关重要,并且有很多方法可以实现这一点。你需要找到你的。

#1


0  

Sounds like you need to create some views so that you can consolidate the queries coming from the database. Try to think of logical groupings of the tables (lookup and otherwise) that you have and create a view for each logical grouping. Then, have your application query against those views to retrieve data.

听起来您需要创建一些视图,以便您可以合并来自数据库的查询。尝试考虑您拥有的表(查找和其他)的逻辑分组,并为每个逻辑分组创建一个视图。然后,让您的应用程序查询这些视图以检索数据。

As for connection strings, I don't see why you would need more than one if all of the tables are in the same database.

至于连接字符串,如果所有表都在同一个数据库中,我不明白为什么你需要多个连接字符串。

#2


0  

If you have the possibility to create only one connection string, that is what you should do.

如果您有可能只创建一个连接字符串,那么您应该这样做。

When you create a second connection string, it's because you have no choice. Having many different connections strings is just going to add to the confusion you migth already be in.

当您创建第二个连接字符串时,这是因为您别无选择。拥有许多不同的连接字符串只会增加migth已经存在的混乱。

The number of tables you have in a data base is never going to influence how many connection string you should have. I would even say : having acces to all the information of your database through one single object is an advantage. Now, the way you are going to organise the impressive amount of informations is crucial, and there is a lot of way to accomplish that. You need to find out yours.

您在数据库中拥有的表数永远不会影响您应该拥有的连接字符串数。我甚至会说:通过一个对象访问数据库的所有信息是一个优势。现在,您要组织大量信息的方式至关重要,并且有很多方法可以实现这一点。你需要找到你的。