Typed DataSets in VS2005

P

Peter Bradley

Champika Nirosh said:
Great to hear that you solve it..

Nirosh.

Thanks Nirosh, and thank you for sticking with it.

One interesting thing about the new Typed DataSets is that a dll.config file
is produced (as I have mentioned) when the assembly is compiled. If the
contents of that file are copied into the calling executable's App.config
file, connection strings can be accessed like this:
string cs =
ConfigurationManager.ConnectionStrings["ItregMailDetailsTypedDataSet.Properties.Settings.cimisdevConnectionString"].ConnectionString;
 
P

Peter Bradley

Champika Nirosh said:
Great to hear that you solve it..

Nirosh.

Thanks Nirosh, and thank you for sticking with it.

One interesting thing about the new Typed DataSets is that a dll.config file
is produced (as I have mentioned) when the assembly is compiled.

The contents of this file look like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add
name="ItregMailDetailsTypedDataSet.Properties.Settings.cimisdevConnectionString"
connectionString="Data Source=adatabaseserver;Initial
Catalog=adatabase;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>

If these contents are copied into the calling executable's App.config file,
connection strings can be accessed like this:

string cs =
ConfigurationManager.ConnectionStrings["ItregMailDetailsTypedDataSet.Properties.Settings.cimisdevConnectionString"].ConnectionString;

So you can set the TableAdapter's Connection property like this:

itregda.Connection = new SqlConnection(cs);

The only thing we remain unhappy about is that the Typed DataSets produced
by VS2005 appear to contain hard-coded connection details. We're going to
look at what's exposed in a dissassembler, and decide how safe/unsafe we
think it is, bearing in mind that the client needs to have the Typed DataSet
assembly in order to understand what it's getting back from its calls to the
Data Layer.

Cheers


Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top