I'm now creating an application which creates database in runtime.
For example: User 'A' registers to my server will be provided a database A.sdf
.
After that, I want to create a connection to the newly created database file using Linq-to-SQL.
I'm wondering if I'll create that connection during design in Visual Studio, will the tables appears as classes of database context?
For example : A.sdf
has a table Inventory
with these columns:
- ID
- Name
So in Visual Studio, there will be a class named Inventory
that has 2 properties.
Can anyone show me the way how to do this, please?
If you using Entity Framework and your databases are equal in their structure, you can use same domain model (EF classes) to work with all databases. All you need is to create datacontext with different connection strings. For examlple:
In your method: