Re: Typed DataSets in VS2005



If it was just for its internal use, I wouldn't be bothered. I've tried it
out, and there is no way of changing that setting via a configuration file
once the dll has been deployed (and put in the GAC in our case) that has
worked for me. If you can suggest a way, I'd be very grateful.


Peter

"Champika Nirosh" <test@xxxxxx> wrote in message
news:%23SfzONgcHHA.2268@xxxxxxxxxxxxxxxxxxxxxxx
So now let's come back again so the designer keep it in the
setting.Designer.cs for its internal use.. so what bother you there?

Nirosh.

"Peter Bradley" <pbradley@xxxxxxxxxx> wrote in message
news:%23BTOVHgcHHA.4260@xxxxxxxxxxxxxxxxxxxxxxx
Just in case anyone else has any doubts, here's the generated xsd file
(slightly anonymised):

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="ItregMailDetailsTypedDataSet"
targetNamespace="http://tempuri.org/ItregMailDetailsTypedDataSet.xsd";
xmlns:mstns="http://tempuri.org/ItregMailDetailsTypedDataSet.xsd";
xmlns="http://tempuri.org/ItregMailDetailsTypedDataSet.xsd";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:msprop="urn:schemas-microsoft-com:xml-msprop"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:annotation>
<xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
<DataSource DefaultConnectionIndex="0"
FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout,
AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema"
xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<Connections>
<Connection AppSettingsObjectName="Settings"
AppSettingsPropertyName="aservernamedevConnectionString"
ConnectionStringObject="" IsAppSettingsProperty="True"
Modifier="Assembly" Name="aservernamedevConnectionString (Settings)"
ParameterPrefix="@"
PropertyReference="ApplicationSettings.ItregMailDetailsTypedDataSet.Properties.Settings.GlobalReference.Default.aservernamedevConnectionString"
Provider="System.Data.SqlClient">
</Connection>
</Connections>
<Tables>
<TableAdapter BaseClass="System.ComponentModel.Component"
DataAccessorModifier="AutoLayout, AnsiClass, Class, Public"
DataAccessorName="atablenameTableAdapter"
GeneratorDataComponentClassName="atablenameTableAdapter"
Name="atablename" UserDataComponentName="atablenameTableAdapter">
<MainSource>
<DbSource ConnectionRef="aservernamedevConnectionString
(Settings)" DbObjectName="aservernamedev.dbo.atablename"
DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill"
GenerateMethods="Both" GenerateShortCommands="True"
GeneratorGetMethodName="GetData" GeneratorSourceName="Fill"
GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset"
ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
UseOptimisticConcurrency="True" UserGetMethodName="GetData"
UserSourceName="Fill">
<DeleteCommand>
<DbCommand CommandType="Text" ModifiedByUser="False">
<CommandText>DELETE FROM [dbo].[atablename] WHERE
(([mailbox] = @Original_mailbox) AND ([storage_group] =
@Original_storage_group) AND ([server] = @Original_server))</CommandText>
<Parameters>
<Parameter AllowDbNull="False" AutogeneratedName=""
DataSourceName="" DbType="AnsiString" Direction="Input"
ParameterName="@Original_mailbox" Precision="0" ProviderType="VarChar"
Scale="0" Size="0" SourceColumn="mailbox" SourceColumnNullMapping="False"
SourceVersion="Original">
</Parameter>
<Parameter AllowDbNull="False" AutogeneratedName=""
DataSourceName="" DbType="AnsiString" Direction="Input"
ParameterName="@Original_storage_group" Precision="0"
ProviderType="VarChar" Scale="0" Size="0" SourceColumn="storage_group"
SourceColumnNullMapping="False" SourceVersion="Original">
</Parameter>
<Parameter AllowDbNull="False" AutogeneratedName=""
DataSourceName="" DbType="AnsiString" Direction="Input"
ParameterName="@Original_server" Precision="0" ProviderType="VarChar"
Scale="0" Size="0" SourceColumn="server" SourceColumnNullMapping="False"
SourceVersion="Original">
</Parameter>
</Parameters>
</DbCommand>
</DeleteCommand>
<InsertCommand>
<DbCommand CommandType="Text" ModifiedByUser="False">
<CommandText>INSERT INTO [dbo].[atablename]
([mailbox], [storage_group], [server]) VALUES (@mailbox, @storage_group,
@server);
SELECT mailbox, storage_group, server FROM atablename WHERE (mailbox =
@mailbox)</CommandText>
<Parameters>
<Parameter AllowDbNull="False" AutogeneratedName=""
DataSourceName="" DbType="AnsiString" Direction="Input"
ParameterName="@mailbox" Precision="0" ProviderType="VarChar" Scale="0"
Size="0" SourceColumn="mailbox" SourceColumnNullMapping="False"
SourceVersion="Current">
</Parameter>
<Parameter AllowDbNull="False" AutogeneratedName=""
DataSourceName="" DbType="AnsiString" Direction="Input"
ParameterName="@storage_group" Precision="0" ProviderType="VarChar"
Scale="0" Size="0" SourceColumn="storage_group"
SourceColumnNullMapping="False" SourceVersion="Current">
</Parameter>
<Parameter AllowDbNull="False" AutogeneratedName=""
DataSourceName="" DbType="AnsiString" Direction="Input"
ParameterName="@server" Precision="0" ProviderType="VarChar" Scale="0"
Size="0" SourceColumn="server" SourceColumnNullMapping="False"
SourceVersion="Current">
</Parameter>
</Parameters>
</DbCommand>
</InsertCommand>
<SelectCommand>
<DbCommand CommandType="Text" ModifiedByUser="False">
<CommandText>SELECT mailbox, storage_group, server
FROM dbo.atablename</CommandText>
<Parameters>
</Parameters>
</DbCommand>
</SelectCommand>
<UpdateCommand>
<DbCommand CommandType="Text" ModifiedByUser="False">
<CommandText>UPDATE [dbo].[atablename] SET [mailbox] =
@mailbox, [storage_group] = @storage_group, [server] = @server WHERE
(([mailbox] = @Original_mailbox) AND ([storage_group] =
@Original_storage_group) AND ([server] = @Original_server));
SELECT mailbox, storage_group, server FROM atablename WHERE (mailbox =
@mailbox)</CommandText>
<Parameters>
<Parameter AllowDbNull="False" AutogeneratedName=""
DataSourceName="" DbType="AnsiString" Direction="Input"
ParameterName="@mailbox" Precision="0" ProviderType="VarChar" Scale="0"
Size="0" SourceColumn="mailbox" SourceColumnNullMapping="False"
SourceVersion="Current">
</Parameter>
<Parameter AllowDbNull="False" AutogeneratedName=""
DataSourceName="" DbType="AnsiString" Direction="Input"
ParameterName="@storage_group" Precision="0" ProviderType="VarChar"
Scale="0" Size="0" SourceColumn="storage_group"
SourceColumnNullMapping="False" SourceVersion="Current">
</Parameter>
<Parameter AllowDbNull="False" AutogeneratedName=""
DataSourceName="" DbType="AnsiString" Direction="Input"
ParameterName="@server" Precision="0" ProviderType="VarChar" Scale="0"
Size="0" SourceColumn="server" SourceColumnNullMapping="False"
SourceVersion="Current">
</Parameter>
<Parameter AllowDbNull="False" AutogeneratedName=""
DataSourceName="" DbType="AnsiString" Direction="Input"
ParameterName="@Original_mailbox" Precision="0" ProviderType="VarChar"
Scale="0" Size="0" SourceColumn="mailbox" SourceColumnNullMapping="False"
SourceVersion="Original">
</Parameter>
<Parameter AllowDbNull="False" AutogeneratedName=""
DataSourceName="" DbType="AnsiString" Direction="Input"
ParameterName="@Original_storage_group" Precision="0"
ProviderType="VarChar" Scale="0" Size="0" SourceColumn="storage_group"
SourceColumnNullMapping="False" SourceVersion="Original">
</Parameter>
<Parameter AllowDbNull="False" AutogeneratedName=""
DataSourceName="" DbType="AnsiString" Direction="Input"
ParameterName="@Original_server" Precision="0" ProviderType="VarChar"
Scale="0" Size="0" SourceColumn="server" SourceColumnNullMapping="False"
SourceVersion="Original">
</Parameter>
</Parameters>
</DbCommand>
</UpdateCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="mailbox" DataSetColumn="mailbox" />
<Mapping SourceColumn="storage_group"
DataSetColumn="storage_group" />
<Mapping SourceColumn="server" DataSetColumn="server" />
</Mappings>
<Sources>
<DbSource ConnectionRef="aservernamedevConnectionString
(Settings)" DbObjectName="aservernamedev.dbo.usp_itreg_roundrobin"
DbObjectType="StoredProcedure" FillMethodModifier="Public"
FillMethodName="FillBy" GenerateMethods="Both"
GenerateShortCommands="True" GeneratorGetMethodName="GetDataBy"
GeneratorSourceName="FillBy" GetMethodModifier="Public"
GetMethodName="GetDataBy" QueryType="Rowset"
ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
UseOptimisticConcurrency="True" UserGetMethodName="GetDataBy"
UserSourceName="FillBy">
<SelectCommand>
<DbCommand CommandType="StoredProcedure"
ModifiedByUser="False">
<CommandText>dbo.usp_itreg_roundrobin</CommandText>
<Parameters>
<Parameter AllowDbNull="True" AutogeneratedName=""
DataSourceName="" DbType="Int32" Direction="ReturnValue"
ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0"
Size="4" SourceColumnNullMapping="False" SourceVersion="Current">
</Parameter>
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
</Sources>
</TableAdapter>
</Tables>
<Sources>
</Sources>
</DataSource>
</xs:appinfo>
</xs:annotation>
<xs:element name="ItregMailDetailsTypedDataSet" msdata:IsDataSet="true";
msdata:UseCurrentLocale="true";
msprop:Generator_UserDSName="ItregMailDetailsTypedDataSet"
msprop:Generator_DataSetName="ItregMailDetailsTypedDataSet">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="atablename"
msprop:Generator_UserTableName="atablename"
msprop:Generator_RowDeletedName="atablenameRowDeleted"
msprop:Generator_RowChangedName="atablenameRowChanged"
msprop:Generator_RowClassName="atablenameRow"
msprop:Generator_RowChangingName="atablenameRowChanging"
msprop:Generator_RowEvArgName="atablenameRowChangeEvent"
msprop:Generator_RowEvHandlerName="atablenameRowChangeEventHandler"
msprop:Generator_TableClassName="atablenameDataTable"
msprop:Generator_TableVarName="tableatablename"
msprop:Generator_RowDeletingName="atablenameRowDeleting"
msprop:Generator_TablePropName="atablename">
<xs:complexType>
<xs:sequence>
<xs:element name="mailbox"
msprop:Generator_UserColumnName="mailbox"
msprop:Generator_ColumnVarNameInTable="columnmailbox"
msprop:Generator_ColumnPropNameInRow="mailbox"
msprop:Generator_ColumnPropNameInTable="mailboxColumn">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="15" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="storage_group"
msprop:Generator_UserColumnName="storage_group"
msprop:Generator_ColumnVarNameInTable="columnstorage_group"
msprop:Generator_ColumnPropNameInRow="storage_group"
msprop:Generator_ColumnPropNameInTable="storage_groupColumn">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="10" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="server"
msprop:Generator_UserColumnName="server"
msprop:Generator_ColumnVarNameInTable="columnserver"
msprop:Generator_ColumnPropNameInRow="server"
msprop:Generator_ColumnPropNameInTable="serverColumn">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="15" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="Constraint1">
<xs:selector xpath=".//mstns:atablename" />
<xs:field xpath="mstns:mailbox" />
</xs:unique>
</xs:element>
</xs:schema>

"Peter Bradley" <pbradley@xxxxxxxxxx> wrote in message
news:ePvmAEgcHHA.4260@xxxxxxxxxxxxxxxxxxxxxxx
Nirosh. That's what we've done. That's why I'm asking the question.


Peter

"Champika Nirosh" <test@xxxxxx> wrote in message
news:ubhnSBgcHHA.4260@xxxxxxxxxxxxxxxxxxxxxxx
I am pretty sure that you are doing some thing wrong here.. can you just
create a seperate type dataset and confirm that it add a connection
string too?? Why it need to have a connection string hradcoded to create
a typed dataset for you.. but it you select the optipon of autocreating
the DAL then yes it does add a hardcoded connection string to the
dataset..

Nirosh.

"Peter Bradley" <pbradley@xxxxxxxxxx> wrote in message
news:uHJh0kfcHHA.3644@xxxxxxxxxxxxxxxxxxxxxxx
Thanks Nirosh, but I'm not sure I understood all that.

I'm only talking about a typed DataSet: not about the entire data
access layer - which we code ourselves and which uses many typed
datasets. At least that was the case until now. If typed datasets
now have the connection string hard coded into them, we'll definitely
not be using them any more - for security reasons apart from anything
else.


Peter

"Champika Nirosh" <test@xxxxxx> wrote in message
news:eLAvOUfcHHA.3960@xxxxxxxxxxxxxxxxxxxxxxx
VSS 2005 support auto generating the dataaccess layer .. and in that
case you are free to change the code where it hardcode the connection
string so that it will read it from a config file (obviously you have
to change the code again if you have to create/ edit the dataset
again.

In my view point the automatically generated code is very good if you
are heading toward a quick concept demo or a working prototype.. but
if you are looking to develop a real extensible large-scale system,
then I rather advice you to have your own data access layer, indeed
you may have some assistance from the Data access Applcation Blocks
or enterprise library. There you will get that chance of developing a
flexible dataaccess layer.. I am telling this with my experience and
if you go with the auto geneated code you will at times drive in to
bottleneck of your code..

Nirosh.


"Peter Bradley" <pbradley@xxxxxxxxxx> wrote in message
news:eLioYLfcHHA.2404@xxxxxxxxxxxxxxxxxxxxxxx
Hi all,

This post is sort of tangentially related to my earlier posts on
configuration files for DLLs.

Does anyone know how to create typed DataSets using VS2005's new
DataSet designer, but with the ability to configure the connection
string via a config file? The designer seems to hard-code the
connection string into the dataset itself, which just can't be
right.

The typed DataSets created by VS2005 comes with a dll.config file
that looks as though it's trying to do something like that, and
which is put with the executable at compile time, but altering the
connection string in there doesn't appear to have any effect. We've
seen lots of people asking this question, but haven't found anyone
answering it yet.


Thanks in advance





Peter
















.



Relevant Pages

  • Re: Typed DataSets in VS2005
    ... SELECT mailbox, storage_group, server FROM atablename WHERE (mailbox = ... Why it need to have a connection string hradcoded to create ... Does anyone know how to create typed DataSets using VS2005's new ... DataSet designer, but with the ability to configure the connection ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Typed DataSets in VS2005
    ... (scroll down to "Connection string pangs") ... layer - which we code ourselves and which uses many typed datasets. ... string so that it will read it from a config file (obviously you have ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Typed DataSets in VS2005
    ... Or are you talking about another config file? ... I always taken the connection string via the ... SELECT mailbox, storage_group, server FROM atablename WHERE (mailbox = ... that chance of developing a flexible dataaccess layer.. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Typed DataSets in VS2005
    ... (scroll down to "Connection string pangs") ... string so that it will read it from a config file (obviously you have ... then I rather advice you to have your own data access layer, ... Does anyone know how to create typed DataSets using VS2005's new ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Typed DataSets in VS2005
    ... (scroll down to "Connection string pangs") ... layer - which we code ourselves and which uses many typed datasets. ... string so that it will read it from a config file (obviously you have to ...
    (microsoft.public.dotnet.languages.csharp)