0

I'm trying to change the schema name for my app when a schema name is passed as a command line argument.

I have read this solution Changing schema name on runtime - Entity Framework, but it seems needlessly complicated.

Can anyone tell me whether there is a simpler solution or whether this is the best way to do it?

So just to reiterate, I want to use the default dbo schema name unless a command line argument is passed such as --schema = abc, and in this case I want to use the abc schema. I'm using EF6.

Thanks

Community
  • 1
  • 1
SwimmingG
  • 654
  • 2
  • 9
  • 29
  • isnt the schema mapped in your context? in this case you could build the model for all schemas, let the database build and call the schema necessary for your query. – DevilSuichiro Jul 28 '16 at 20:35

1 Answers1

0

The easiest solution I found was to just create a separate database and then pass a command line argument (boolean) which allows you to pick which database to use, there are plenty of resources on here on how to change the DB at runtime.

SwimmingG
  • 654
  • 2
  • 9
  • 29