Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 01, 2012 11:37 AM by Shailendra Saxena
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?
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?
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.
Nov 30, 2012 12:44 AM|LINK
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.
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 .
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.