I use LINQ to SQL in a WPF project. I have made small changes in the database (changed datatype of the fields, which contain no data).
Now I want to regenerate (refresh) the LINQ to SQL DataContext of this project (I use VS 2008). I try to right-click on .dbml item in my Solution Explorer and choose "Refresh", but nothing happens.
How could I update the DataContext in a Visual Studio 2008 WPF project?
The DataContext is the source of all entities mapped over a database connection. It tracks changes that you made to all retrieved entities and maintains an "identity cache" that guarantees that entities retrieved more than one time are represented by using the same object instance.
Without resorting to some 3rd party tools, the easiest way is just to delete the modified tables from the designer and drag them back in from Server Explorer.
Unfortunately, if you've made any manual modifications in the L2S designer they wont be preserved and you'll have to manually make the changes again.
huagati has a tool that claims to be able to refresh changes but I haven't tried it myself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With