I'm using Linq to SQL for a project I'm working on lately and as you can imagine I've extended the partial classes that MSLinqToSQLGenerator creates to fit certain needs (basically enumerations).
After installing Visual Studio 2008 SP1 though I discovered that whenever I saved my model the above mentioned custom tool was failing to generate the LinqToSql classes. I had to, first delete my custom code file, run the custom tool to generate my LinqToSql classes and then add the custom code file again to get it working.
What I discovered after a few tests is that in order to get it working (without the work around mentioned earlier) you have to write the using statements inside the namespace block (aka first line should be the namespace) . So the extension model file should look something like that:
namespace SomeNamespace
{
using System.Configuration;
using System.Text;
public partial class BussinesObject
{
...
}
}
I don't know why the scope of the using statements could cause the MSLinqToSQLGenerator to fail, or even if this is intended or not. Does anyone have any ideas?