AnantLabs / codesmith

Automatically exported from code.google.com/p/codesmith
1 stars 0 forks source link

ADOHelper class ConnectionString #541

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1.Create a new Visual Studio 2010 project (C#)
2.Add a CSP file to the project and add the Entity.cst to the outputs
3.Select the MS SQL provider and generate a test entity
4.Open the ADOHelper.cs code file that was generated, and look at the 
ConnectionString property.

What is the expected output? What do you see instead?

The generated ConnectionString will look like this:

_connectionString = 
System.Configuration.ConfigurationManager.ConnectionStrings["VittoriaSecurityCon
nectionString"].ConnectionString;

But if you use Visual Studio's built-in settings editor (the Settings.settings 
file), it is expecting the ConnectionString to llok like this:

_connectionString = 
System.Configuration.ConfigurationManager.ConnectionStrings["CSG532.Properties.S
ettings.VittoriaSecurityConnectionString"].ConnectionString; 

The Settings.settings file will generate a Connection String in the App.config 
file which key is not only the name of the Connection String, but it has a 
namespace prefixed to it.

I'm expecting the template to take this prefix into account and generate the 
ConnectionString property accordingly as this will most probably be the basic 
scenario for new users.

What version of the product are you using?

CodeSmith Generator 5.3.2 + CSLA templates 3.0.2 + Visual Studio 2010

Please provide any additional information below.

Original issue reported on code.google.com by mrlucmo...@gmail.com on 10 Jan 2011 at 2:43

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 10 Jan 2011 at 3:18

GoogleCodeExporter commented 9 years ago
Hello,

We will not be making this change to the templates at this time. Currently all 
new EF, Linq-To-SQL, MVC projects create a connection string that is located in 
the app.config or web.config. This code is stored in a preserved region so you 
can modify this code and it will be preserved.

Original comment by bniemyjski on 9 Mar 2012 at 1:04