DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Securing Your Software Supply Chain with JFrog and Azure
Register Today

Trending

  • Part 3 of My OCP Journey: Practical Tips and Examples
  • Transactional Outbox Patterns Step by Step With Spring and Kotlin
  • What Is Envoy Proxy?
  • Breaking Down the Monolith

Trending

  • Part 3 of My OCP Journey: Practical Tips and Examples
  • Transactional Outbox Patterns Step by Step With Spring and Kotlin
  • What Is Envoy Proxy?
  • Breaking Down the Monolith

Frictionless development: Web.config and connection strings

Oren Eini user avatar by
Oren Eini
·
Nov. 15, 11 · News
Like (0)
Save
Tweet
Share
3.02K Views

Join the DZone community and get the full member experience.

Join For Free

this is something that i actually run into a lot at customer sites. they have a lot of friction during development between different connection strings that developers use during development. for example, we may have one developer using:

<add name="ravendb" connectionstring="url=http://localhost:8080" />

while another is using:

<add name="ravendb" connectionstring="url=http://localhost:8191;database=theapp" />

this usually causes a hell of a lot of trouble in most teams (or maybe you have developers that use sql express, and some who installed sql development, etc).

that is friction, and you want to deal with that as soon as possible. the easiest thing to do is actually:

<add name="ayende-pc" connectionstring="url=http://localhost:8080" />
<add name="ayende-laptop" connectionstring="url=http://localhost:8191;database=theapp" />

this works, because the connection string name is now the machine name (system.environment.machinename). that is a great first step, because it means that you can get things done without fighting over the connection string in the web.config.

another alternative is to have a default connection string, and allow to “override” it with the specification of a connection string specific for the machine.

it is a small thing, but it actually helps quite a lot. you can extend this to other settings as well. for apps that have a lot of settings, i usually take them out of the web.config into a default.config file, and the configuration reader is set to look for [machinename].config first, and only then at the default.config file.

Connection string

Published at DZone with permission of Oren Eini, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • Part 3 of My OCP Journey: Practical Tips and Examples
  • Transactional Outbox Patterns Step by Step With Spring and Kotlin
  • What Is Envoy Proxy?
  • Breaking Down the Monolith

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: