Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the x.designer.cs part of the LinqToSql dbml triad disappear after an edit in the visual editor?

I ran into a particularly annoying issue. I have a LinqToSql project up and running..

A X.dbml file has three dependent files an X.cs, X.dbml.layout and X.designer.cs
Now when I drop an additional table into the designer surface and rename the table, I get an property value is invalid 'unspecified error'.
Weird. But then somehow your X.designer.cs file disappears from your project. And now your build is broken. (If you're not using source control, god help you!)

I'm unable to make edits to my dbml file...

like image 946
Gishu Avatar asked Jan 29 '26 04:01

Gishu


1 Answers

Also, this has been raised as a Connect Bug, that they've marked as "Fixed in a later release", when ever that comes out.

There are also a couple of other workarounds:

If you have a partial class, make sure that any using statements are with the namespaces:

namespace cScape.PM.DataStore.DataContexts
{
  using System.Collections.Generic;
  using System.Linq;

  partial class ConfigDataContext
  {
    [...]
  }
}

And then right-click on the DBML file, and select "Run Custom Tool". This will re-generate your designer file, and you can then build your project - this worked better for me, especially as we're using TFS and that would cause rather odd check-ins.

The connect bug is linked to in the middle of that fourm discussion.

like image 134
Zhaph - Ben Duguid Avatar answered Feb 02 '26 20:02

Zhaph - Ben Duguid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!