Change Namespace of typed DataSet?

R

Rainer Queck

Hallo NG,

how can I change the NameSpace of a DataSet generated by the VS2008
DataSet-Designer.
I tried to modify the NameSpace in the <ds>.Designer.cs, but when ever I
make a change to the DataSet in the designer the Namespace gets "reset".

Thanks for hints and Infos.

Regards
Rainer Queck
 
M

Marc Gravell

Not too familiar with dataset specifically (I rarely use them), but
you might have to change the default project namespace (project
properties); for sub-namespaces within that, try adding folders to
suit and locating your dataset at the appropriate level; I've seen
this work for other designers...

Marc
 
M

Marc Gravell

(by the way, I'm assuming that you mean the .NET namespace to the
classes, not the xsd namespace uri, which is a property in the
designer)
 
R

Rainer Queck

Hello Marc,

thanks for helping!
(by the way, I'm assuming that you mean the .NET namespace to the
classes, not the xsd namespace uri, which is a property in the
designer)
<
Yes, I mean the .NET namespace.
Not too familiar with dataset specifically (I rarely use them), but
you might have to change the default project namespace (project
properties); for sub-namespaces within that, try adding folders to
suit and locating your dataset at the appropriate level; I've seen
this work for other designers...
<
I have tried to use Folders to get the desired namespace. Unfortunately VS
always adds the project name to the namespace.
The automatically namespace currently looks like
<prjName>.<folderName>.<subFolderName>
what I want is a namespace only with <folderName>.<subFolderName> without
<prjName> since I plan to use the dataSet later on in a Library.
Is there any possibillity to tell VS how to build subnamespaces?

Regards
Rainer
 
M

Marc Gravell

The automatically namespace currently looks like
<prjName>.<folderName>.<subFolderName>
what I want is a namespace only with <folderName>.<subFolderName>
without <prjName>

Well, you can change the project namespace to something less
assembly-specific via the "Default namespace" option (project
properties page) - however, you can't blank it; I'd perhaps put
something in there that describes the overall project:

FooCorp.Finance

[or whatever]

Marc
 
S

Steven Cheng[MSFT]

Hi Rainer,

Yes, Visual Studio will automatically add the Project's Root namespace to
its auto-generated code. For your scenario, I think move the dataset (or
any other components you want to fully control the namespace naming) into a
separate class library project. You can remove the default root namespace
of that project and add DataSet or other component in that class library
and reference this library in the main project.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
R

Rainer Queck

Hello Marc,

thanks for your responds.
As it is not possible to "decouple" the data set from the project inside the
project, I think I will follow Stevens suggestion and move this dataset to a
seperat classs library project.

Regards
Rainer
 
R

Rainer Queck

Hello Steven,

Steven Cheng said:
Yes, Visual Studio will automatically add the Project's Root namespace to
its auto-generated code. For your scenario, I think move the dataset (or
any other components you want to fully control the namespace naming) into
a
separate class library project. You can remove the default root namespace
of that project and add DataSet or other component in that class library
and reference this library in the main project.
This is what I well do then.
Thanks for your help!

Regards
Rainer
 
M

Michael Iben

to change the namespace of your xsd file and class, rename the xsd file
to <namespace>.<classname>.xsd

so, if you want to add an xsd file named "mappings" to the "database"
namespace: "database.mappings.xsd"

you may rename the file as deep into the namespace tree as you like.
 
C

Chris Voon

1. Click on the DataSet.xsd.
2. Under Properties, Set the desired namespace under 'Custom Tool Namespace'.
For e.g., if you want the it to be Data.XXXDataSet, set 'Custom Tool Namespace' to Data.
Note that the project namespace will come as prefix for VB.NET.

Hope this works!



Rainer Queck wrote:

Change Namespace of typed DataSet?
07-Feb-08

Hallo NG

how can I change the NameSpace of a DataSet generated by the VS2008
DataSet-Designer
I tried to modify the NameSpace in the <ds>.Designer.cs, but when ever I
make a change to the DataSet in the designer the Namespace gets "reset"

Thanks for hints and Infos

Regard
Rainer Queck

Previous Posts In This Thread:

Change Namespace of typed DataSet?
Hallo NG

how can I change the NameSpace of a DataSet generated by the VS2008
DataSet-Designer
I tried to modify the NameSpace in the <ds>.Designer.cs, but when ever I
make a change to the DataSet in the designer the Namespace gets "reset"

Thanks for hints and Infos

Regard
Rainer Queck

Not too familiar with dataset specifically (I rarely use them), but you might
Not too familiar with dataset specifically (I rarely use them), but
you might have to change the default project namespace (project
properties); for sub-namespaces within that, try adding folders to
suit and locating your dataset at the appropriate level; I've seen
this work for other designers..

Marc

(by the way, I'm assuming that you mean the .
(by the way, I am assuming that you mean the .NET namespace to th
classes, not the xsd namespace uri, which is a property in th
designer)

Hello Marc,thanks for helping!
Hello Marc

thanks for helping

(by the way, I'm assuming that you mean the .NET namespace to th
classes, not the xsd namespace uri, which is a property in th
designer

Yes, I mean the .NET namespace

Not too familiar with dataset specifically (I rarely use them), bu
you might have to change the default project namespace (projec
properties); for sub-namespaces within that, try adding folders t
suit and locating your dataset at the appropriate level; I've see
this work for other designers..

I have tried to use Folders to get the desired namespace. Unfortunately VS
always adds the project name to the namespace
The automatically namespace currently looks like
<prjName>.<folderName>.<subFolderName
what I want is a namespace only with <folderName>.<subFolderName> without
<prjName> since I plan to use the dataSet later on in a Library
Is there any possibillity to tell VS how to build subnamespaces

Regard
Rainer

Well, you can change the project namespace to something less assembly-specific
Well, you can change the project namespace to something less
assembly-specific via the "Default namespace" option (project
properties page) - however, you can't blank it; I'd perhaps put
something in there that describes the overall project

FooCorp.Financ

[or whatever

Marc

Hi Rainer,Yes, Visual Studio will automatically add the Project's Root
Hi Rainer

Yes, Visual Studio will automatically add the Project's Root namespace to
its auto-generated code. For your scenario, I think move the dataset (or
any other components you want to fully control the namespace naming) into a
separate class library project. You can remove the default root namespace
of that project and add DataSet or other component in that class library
and reference this library in the main project

Sincerely

Steven Chen

Microsoft MSDN Online Support Lea


This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

Hello Marc,thanks for your responds.
Hello Marc,

thanks for your responds.
As it is not possible to "decouple" the data set from the project inside the
project, I think I will follow Stevens suggestion and move this dataset to a
seperat classs library project.

Regards
Rainer

Re: Change Namespace of typed DataSet?
Hello Steven,

This is what I well do then.
Thanks for your help!

Regards
Rainer

to change the namespace of your xsd file and class, rename the xsd fileto
to change the namespace of your xsd file and class, rename the xsd file
to <namespace>.<classname>.xsd

so, if you want to add an xsd file named "mappings" to the "database"
namespace: "database.mappings.xsd"

you may rename the file as deep into the namespace tree as you like.




Submitted via EggHeadCafe - Software Developer Portal of Choice
Crypto Obfuscator for .NET - Product Review
http://www.eggheadcafe.com/tutorial...f8-f5fd987fafb1/crypto-obfuscator-for-ne.aspx
 

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