Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 568355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:10:48+00:00 2026-05-13T13:10:48+00:00

i’m having a issue with the T4 templates for generating code. I’m wondering if

  • 0

i’m having a issue with the T4 templates for generating code.

I’m wondering if anyone can help me with an issue I have.
I want to store the connection string for use with SubSonic 3.0 in a default location such as the root of the website (Web.Config or a seperate .config file).

This is fine providing the t4 Templates are “run” within the project that has the config file.

What I want to do is seperate them out from the initial project into seperate class/project files and run the templates from there.

This all works fine providing I place a App.Config file in those projects also with the connection string but this is not what I want as this will then hardcode those connection strings within those class files. (Note the other class file projects are in a seperate location altogether)

Best way I can describe the setup (Web Application) is as follows:

  • DB Class (Project)
    |
    —- Models > T4 Templates (NOTE1)
    |
  • Core Class (Project)
    |
  • CMS class (Project)
    |
  • Website (Project)
    |
    —- Web.Config <<< ConnectionString

NOTE1:
The T4 Templates in that directory need to read from any centeral file in the Website (Project) root folder. Since the database server could change this needs to happen.

The DB Class (Project) is in a different location altogether from the Website (Project).

This has been accomplished in dashCommerce but using SubSonic 2.0 (which was most likely the command line compiler that did it, i’m not too sure)

Just incase anyone is wondering why I am doing this like this. I am compiling a set of base DLLs to be used in many projects.

The DB Class will be unique to each project and will be compiled based on that project’s database using the T4 teplates in that DLL. The other DLLs will reference the DB class DLL and these will be common among projects.

Basically, the DB class is literally the gateway to my database for any other DLLs I write and hence why the DB class needs to reference the connection string in the root project.

(I realise I can just create and compile the DB DLL to be used BUT in development/testing the project will hang on the other DLLS as they too need to reference the connection string IF I include a reference to SubSonic which I need to to access the table objects etc from those DLLs UNLESS I create all the bridge code in the DB class which will just be crazy and pointless for this exercise)

EDIT:

I admit it is hard to explain. I’ll base on a simpler example. I have two locations:
A.- D:\Web Application\Core.DLL AND
B.- D:\Web Application\Website
I create a new C#.net “Web Application” solution in the “Web Application” folder and add the two projects above to it. (Note that it is one solution containing two seperate projects in different directories, which could be anywhere) I need the connection string data to be stored in the “Website” project and have the Core.DLL project reference it from there.

The Core.Dll will store the ttfiles and corresponding code generated for use with SubSonic 3.0. The tt files will be “run” from within Visual Studio within Core.Dll project. The two problems are:

  • A.- The tt files can’t reference the web.config file (or can they?) AND
  • B.- The SubSonic code still needs to be able to read a connection string at run time. Can I have App.config read a web.config connectionstring section? Or how would I do this.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:10:48+00:00Added an answer on May 13, 2026 at 1:10 pm

    OK I’m not sure I’m 100% on what you’re asking here but I’ll do my best

    • A.- The tt files can’t reference the web.config file (or can they?) AND

    No, but they really don’t need to. The App.config for D:\Web Application\Core.DLL can contain the connection string. If you’re worried about having the connection string duplicated in both web.config and app.config then you could add a custom build event that copies the connection string from one to the other.

    • B.- The SubSonic code still needs to be able to read a connection string at run time. Can I have App.config read a web.config connectionstring section? Or how would I do this.

    At runtime the app.config won’t be referenced by your website the web.config will.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 326k
  • Answers 326k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try this: <Popup StaysOpen=”False“> May 14, 2026 at 1:47 am
  • Editorial Team
    Editorial Team added an answer You can use the jQuery load() method to load an… May 14, 2026 at 1:47 am
  • Editorial Team
    Editorial Team added an answer Yes, you can use the join mapping element for this.… May 14, 2026 at 1:47 am

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want use html5's new tag to play a wav file (currently only supported
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I've got a string that has curly quotes in it. I'd like to replace
In order to apply a triggered animation to all ToolTip s in my app,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.