Hi,
At work we use typed dataset in some projects for our DataAccess layer. Sometimes we extend them using the partial class feature : using View code on a dataset create a DataSetName.cs with the partial class declaration where you can add code. Inside this file we also add the TableAdapter partial class.
Recently we migrated on Visual Studio 2008 from VS 2005. The behavior of the dataset generator seems to be different in VS 2008. It removed a part in the TableAdapter namespace in the .cs file :
Example :
Original code :
namespace ClassLibrary1.Dataset.DataSet1TableAdapters
{
public partial class CategoriesTableAdapter
{
}
}
After migration in VS 2008 :
namespace ClassLibrary1.DataSet1TableAdapters
{
public partial class CategoriesTableAdapter
{
}
}
The namespace changed ! It has been replaced by the root namespace of the project.
Reproduction steps :
- Create a class library project.
- Add a folder called Dataset or whatever in the project.
- Add a dataset inside the folder (DataSet1).
- Drop a table in the dataset designer (I used a table from Northwind).
- Right click on the dataset in the Solution Explorer and choose View Code. It will create a DataSet1.cs file with a partial class of the dataset inside.
- Copy the namespace and class for the table adapter from DataSet1.Designer.cs and paste it inside DataSet1.cs.
- Run custom tool on the dataset, it works !
- Close solution
- Open the solution again
- Run custom tool on the dataset, namespace modified for the tableAdapter, very annoying :(
My Machine : Windows Server 2003 R2 Standard Edition SP2 Visual Studio 2008 Pro (9.0.21022.8 RTM) Also tested on a colleague's computer running XP.
Anyone already experiencied the same weird behavior ? Did I made something wrong ? Is there something new to configure inside Visual Studio 2008 to make it works like it did in VS 2005 ?