I've been using this nifty LINQ to SQL tool for a data access layer in an asp.net project. I keep making changes to the underlying tables and in order for the data classes to recognize the change I have to delete and readd the table which has changed. Is there some shortcut to regenerating the data layer?
Sql – Linq to SQL Class Regeneration
- C# – Best way to update LINQ to SQL classes after database schema change
- Linq – Multiple “order by” in LINQ
- C# – When to use .First and when to use .FirstOrDefault with LINQ
- Sql – LINQ to SQL classes to the own classes
- .net – LINQ: When to use SingleOrDefault vs. FirstOrDefault() with filtering criteria
- C# – LINQ Aggregate algorithm explained
- C# – Group by in LINQ
I've run into this same problem and using sqlmetal is definitely a good way to solve it. One approach is to create a batch file that executes your sqlmetal command and that way you can just run the batch anytime you need update your Linq to SQL classes, but what is even slicker solution is to use Visual Studio's Tools->External Tools function to create a command in Visual Studio that runs sqlmetal with your parameters. This works great and you can even drop the created command onto your toolbar for single-click rebuilding.