Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. LINQ to SQL in ASP.NET - moving connection string from app.config to web.config

LINQ to SQL in ASP.NET - moving connection string from app.config to web.config

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabaselinqtutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dominic Pettifer
    wrote on last edited by
    #1

    I'm using LINQ to SQL and putting the generated classes inside a separate assembly (not the website project), but it's all part of the same solution. When the tool generates the classes it places the connection string inside an app.config file in the project, but I'd rather have this connection string inside the web.config file for the website. I've been trying the figure out how to do this and have come across this inside the *.designer.cs file for the LINQ to SQL generated files... public TopicDatabaseDataContext() : base(global::TMS.Library.Properties.Settings.Default.TopicMappingSystemConnectionString, mappingSource) {     OnCreated(); } Now I could replace global::TMS.Library.Properties blah blah with some code to access the connection string in the web.config instead, but since this code is auto generated by a tool, I don't really want to do it this way. Is there a better way?

    Dominic Pettifer Blog: www.dominicpettifer.co.uk

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups