2

I am working on an ASP.net group project of 5 people and we all have an identical database in all of our machine's SQL Server. I'm trying to implement ADO.Net Entity Framework for that database. But how can my other partners use my solution to their machine since the Data Source will be different for everyone? Is there a way to make entity framework supporting all other Data Source on different machines?

For example, My project's web.config file contains a connection string where Data Source = XYZ/ABC. Though my partners have the same database named "PQR", their "Data Source" will be different.

What should I do in this situation?

  • Take a look [here](https://stackoverflow.com/questions/3707749/developer-specific-app-config-web-config-files-in-visual-studio) – Christian Gollhardt Jun 09 '17 at 17:21
  • 1
    Simplest would probably be to have the Data Source be localhost. But there's really an infinite number of solutions to this. You could have a script that modifies the web.config. You could store the connection string in an environment variable. You could have each developer have a configuration file outside of source control it reads for the config. It's really whatever you find works best for your team. – mason Jun 09 '17 at 17:24
  • Not sure why this is a problem. You all have Data Sources with the same connection string name, right ? If you are using some source control like TFS etc you may not check in the web.config and exclude it from getting latest as well – Rey Jun 09 '17 at 17:37
  • @mason , I have tried `localhost`; which gave me a `timeout error`. And I didn't understand the second approach you mentioned. Can you provide some online documentations/links for that approach? – Ahashan Alam Sojib Jun 30 '17 at 18:19
  • You know what an environment variable is? You know how to use C# to read environment variables? – mason Jun 30 '17 at 18:31
  • I know what is an environment variable but never read them from c#... – Ahashan Alam Sojib Jun 30 '17 at 19:00

0 Answers0