I work wpf application by using mvvm pattern. I have model with classes which implement INotifyPropertyChanged. How to insert some data in database using LinqToSql? I also added LinqToSql class in my model.I watched for Repository pattern and Unit of Work, but I need help
0
votes
1 Answers
0
votes
your question isn't very specific, but there are a few steps you need to take:
create an object model that resembles your data model (i.e. you need to create a class for each of your tables, declare their keys etc) - this can be automated (see here)
create a
DataContextclass that represents your database - you will need this to get and submit your changes to the databaseafter you've made changes to your object model, submit the changes to the database using the data context.
there are plenty of examples on the web, such as this one