Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem refreshing tables in the LINQ to SQL designer

I have been using LINQ to SQL for a while, and there is one thing that has always bothered me. Whenever I modify the schema of a table, in order to refresh it in the designer, I have to delete it and then add it back. That's fine, but this means I have to actually find the table in the designer. I have about 100+ tables in my database, and every time I do this, it's like finding a needle in a haystack. Well, maybe it's not that bad, but seriously, it takes way longer than it should.

Is there another option for refreshing tables that I am unaware of?

like image 253
jeremcc Avatar asked Dec 05 '08 21:12

jeremcc


3 Answers

Some people use SqlMetal to 'refresh/update' their Linq2Sql designer. The designer does not have support for refreshing the schema, when the DB changes. You have to manually drop the table and re-add it back in.

ADO Entity Framework i believe can refresh. I've not used it, but I think I saw this at a TechEd demo this year.

Helpful Info: Google's results for SqlMetal.

like image 97
Pure.Krome Avatar answered Sep 27 '22 15:09

Pure.Krome


This is not possible using the VS linq to sql designer.

You can do this using LLBLGEN PRO, a third party tool, instead of the built-in linq to sql designer. It isn't free but it does do a ton of other stuff as well, which of course you may or may not need.

LLBLGEN PRO is actually a full set of ORM tools, but also includes an enhanced linq-to-sql designer with 'refresh model from SQL' functionality.

See here for description of the issue - http://weblogs.asp.net/fbouma/archive/2008/05/01/linq-to-sql-support-added-to-llblgen-pro.aspx And here for the tool - http://www.llblgen.com/

like image 40
Christopher Edwards Avatar answered Sep 27 '22 17:09

Christopher Edwards


I don't do any customization of the content on the designer so after table changes I just hit CTRL+A followed by DEL. Then shift-select all of my tables and slap them back onto the designer. I don't have 100s of tables yet so not sure if things slow down at some point but with 20+ tables it just takes a second.

like image 21
Todd Smith Avatar answered Sep 27 '22 16:09

Todd Smith