Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I am building a multi-tendent mode saas application using Asp.net(MVC) with SQL database.

Every week i want to release new version for users, so my application url will look like
v1.mydomain.com, v2.mydomain.com, v3.mydomain.com and etc.

User can use any versions, based on their need.
if newer version has bugs, he can go to previous versions
if user is ok with V1, then he will use Version1 (v1.mydomain.com)

But we have only one database for all versions, the problem is **SQL server table changes and procedure changes**

For example :
In V1, customers table we have 15 columns.
In V2, we have added 5 columns
In V3, we have added 3 columns

we are using stored procedure to execute all of our database operations.
In V1,

from code we are passing 15 parameters => db also have 15 parameters
In V2,

from code we are passing 15 parameters => we need to alter the related stored proceudre as 15 parameters.

Here V1 application will pass only 11 parms, now V1 app gets error.

I haven't been able to find what I'm looking for.

How can we use the single database for multiple application versions, is there any way to do this.

What I have tried:

what is the best way for this?
Posted
Updated 10-Aug-18 11:46am
Comments
Nathan Minier 9-Aug-18 8:31am    
The only way to do this safely is if you never actually remove or re-cast columns. If you don't, you can just scope your queries to the appropriate application version.

Honestly, though, your continual release strategy sounds like something that I would actively avoid as a consumer.

1 solution

Use a different "data access layer" (DAL) for each version.

Same calls; same stored procedures (SP).

The v1 and v2 DAL's provide SP parameter defaults to the ORM / physical layer for those parms they don't support.

The DALs are provided as separate DLL's; with matching interfaces and data transfer objects (at least in "name").

(Or change your current "data access" methods to allow for "default parameters"; meaning, the caller code doesn't change, just the called method signatures).
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900