I think you can consider it that when you create an account, you should save related data contents inside the same db but with different kinds of primary key or foreign key together, we don't suggest you using "Each Account" for "Each person", which isn't
a good design.
But——of course,if you insist doing so, I think you can:
1) If your structure is the same, I think you can use 2nd way.
2) If your structure isn't the same, you have to use 1st way to create different kinds of db tables.
As you know EF codefirst generated databasen by convert the code to SQL Script. Which ways you choose I believe the code will be convert to SQL script.
yangwulong19...
Member
20 Points
114 Posts
which is the best way to create a new database
Nov 29, 2012 02:17 AM|LINK
what is the best way to achieve below case.
in our web page, When user register, system will create a new database for him.
there are two ways to do that.
1. we pre -generate a sql script, and create a store procedure , to use this store procedure to create a new database
2. programming directly copy database structure from an existing database in sql server
I dont know which is the best way to achieve that? and how to achieve the second one?
oned_gk
All-Star
31463 Points
6422 Posts
Re: which is the best way to create a new database
Nov 29, 2012 02:23 AM|LINK
I think not good idea to create db when registering user.
Why not using existing db with User column?
yangwulong19...
Member
20 Points
114 Posts
Re: which is the best way to create a new database
Nov 29, 2012 03:05 AM|LINK
it is a accounting software, every company's database should be seperate. actually it is decided by boss.
I just need to consider what is the best way to ceate a new database.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: which is the best way to create a new database
Nov 30, 2012 12:44 AM|LINK
Hi,
I think you can consider it that when you create an account, you should save related data contents inside the same db but with different kinds of primary key or foreign key together, we don't suggest you using "Each Account" for "Each person", which isn't a good design.
But——of course,if you insist doing so, I think you can:
1) If your structure is the same, I think you can use 2nd way.
2) If your structure isn't the same, you have to use 1st way to create different kinds of db tables.
Reguards!
thaicarrot
Contributor
5130 Points
1464 Posts
Re: which is the best way to create a new database
Nov 30, 2012 09:13 AM|LINK
As you know EF codefirst generated databasen by convert the code to SQL Script. Which ways you choose I believe the code will be convert to SQL script.
That is depending on your decision .
Weera
Shailendra S...
Member
551 Points
145 Posts
Re: which is the best way to create a new database
Dec 01, 2012 11:37 AM|LINK
I think you should have 1 database and
in tables you can have key as company_name to distinguish the data for each company.
this way you can show the data.
www.techaray.com