I am having a real problem, I created multiple users in sql server with different dbroles, and now im trying to check what’s the user role in db and connect to a connection string depending on their role as this will be more secure….. how can I choose between different connection strings and pass it to the model.edmx, remember I am working with 3 tier design.
here is how my login control works:
http://i40.tinypic.com/nvz6lt.jpg
here is my connectionclass:
http://i39.tinypic.com/34qmybs.jpg
here is my app.config file:
Thanks alot
There are multiple overloads for the ObjectContext constructor.
The default one just takes the connectionstring with a matching name from the config file. But you can also use a constructor where you specify the connection string yourself.
In your code you could maybe create a Authorization enum with values like BasicUser, Admin and pas that to your ConnectionClass. There you could do a switch and pick the right connection string from your config.