-2

what can be a easy way to create new db when we create new customer record?

Scenario:

  1. I have list of customers [may be upto 500 customers] in master database
  2. Whenever I add new customer in my application, I would like to create new separate database to each client [just to separate respective clients' data entirely from each other]
  3. Application will connect to master database and respective client db as per login credential.

    • No of customers may be upto 500,
    • I am planning to add only 50 dbs per server instance, after that again will be adding to next server instance

Options I have selected:

  1. Use Code first approach of ef6.0 to create and seed primary data of each client when new client is added
  2. Use Custom "Create database script" and import seed data from custom script.sql file
7
  • How many customers are you anticipating? Commented Jun 4, 2017 at 11:56
  • upto 500 customers Commented Jun 4, 2017 at 12:00
  • You may want to test how your SQL Server performs if it has 500 databases on it. And you may find stackoverflow.com/questions/21844479/… of use. Commented Jun 4, 2017 at 12:01
  • of course i will be seperating 50 dbs per instance of sql server. Commented Jun 4, 2017 at 12:03
  • Have a look at this Commented Jun 4, 2017 at 13:38

1 Answer 1

1

Copy SQL Server database in code would be a reasonable option for backing up and restoring an existing 'vanilla' (i.e. with no customer data in it) database.

Of course you only need to backup once - you just restore for each new customer.

Sign up to request clarification or add additional context in comments.

2 Comments

seems good and easy option... trying it right now... btw i miss creating blank db to new customer before restoring it with backup of existing db
Excellent - I am glad I could be of assistance!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.