简体   繁体   English

创建新数据库还是使用现有的ASP.NET Identity数据库?

[英]Create new database or use the existing ASP.NET Identity database?

I have been teaching myself ASP.NET MVC5 development and I have a problem determining the best practice in this situation. 我一直在自学ASP.NET MVC5开发,在确定这种情况下的最佳实践时遇到了问题。

I am using the ASP.NET Identity system which created a database for me. 我正在使用ASP.NET Identity系统,该系统为我创建了一个数据库。 Now I want to add more tables and things to it. 现在,我想添加更多的表和东西。 Should I create a new database or should I add to the existing database? 我应该创建一个新数据库还是应该将其添加到现有数据库中? What is best practice in this situation? 在这种情况下最佳做法是什么?

Use the same database . 使用相同的数据库

There's no real reason to separate the different types of data into different databases. 没有真正的理由将不同类型的数据分为不同的数据库。 And if you were to split up the different data, that would complicate a lot of things unnecessarily (ie unable to have foreign key constraints across databases, making referential integrity a nightmare ). 如果你分裂的不同的数据,这将很多东西不必要的复杂(即不能有跨数据库外键约束,使得参照完整性的噩梦 )。 And especially if the multiple databases don't live in the same instance, you'll deal with an even larger headache. 特别是如果多个数据库不在同一个实例中,您将面临更大的麻烦。 Other things that would pose extra consideration would be having to include ownership chaining planning across the database. 其他需要特别考虑的事情是必须包括整个数据库的所有权链计划。

In short, I don't see a reason to split the data into a different database. 简而言之,我看不出将数据拆分到另一个数据库的理由。 And there are a few reasons that would make multiple databases a pain, so I'd steer clear from that without an actual justifiable reason. 并且有一些原因会使多个数据库陷入困境,因此我将在没有实际正当理由的情况下避免这一点。

try using same database rather creating new database for each new table. 尝试使用相同的数据库,而不是为每个新表创建新数据库。 One database can have as many tables as you need to have. 一个数据库可以具有所需数量的表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM