LINQ to SQL FAQ – Designer Issues

Visual Studio Tools

LINQ to SQL has a pretty designer view in Visual Studio 2008 which allows users to create modify and delete tables, views and associations. However, it has several deficiencies. Some of the features not supported by the designer (but part of LINQ-to-SQL) are listed in Dinesh’s blog.

My biggest gripe with the designer is that ALL the tables and views must appear on the same design surface – there is no way to create subset views (like in SQL manager) of the data context.

This is fine for small databases (like when Northwind is used for demonstrations), but put any serious database into the designer (along with all the views) and it becomes a real nightmare. Look at this picture on the right – this is the designer view for my current Anvil application.

The first issue is finding a table in this mess. It’s not easy. The second is trying to create an association between a table and a view – trying to drag and association between two columns which may not be on the same part of the screen is almost impossible. You can redesign this view and move tables about but this is not an easy process – and if I amend the .dbml outside the designer it may not be retained anyway, leading to more frustration. Something akin to SQL Enterprise Managers subset views of the database would be more usable here.

Workaround

You can access the XML source of the .dbml by right-clicking the .dbml file in VS and select "Open With" and then select "XML editor", and you’ll see the .dbml as an XML document. Editing the XML directly isn’t great though, and it’s easy to break the model, e.g. by failing to create matching association pairs.

Another issue with the design is that if you need to use the very useful inheritance feature (see here) then you will have to edit the .dbml code by hand – the properties don’t support it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s