LINQ Confusion - Database not saved after application close?

I am making a WinForms application in C #. When I go to create my database object, I am presented with two options:

  • Local database
  • Service Based Database

All I want is a simple local database for my project.

However, if I select "Local Database (Compact Edition)", then after creating my tables and dragging them to the creator of the LINQ-To-SQL class, he says:

The selected object uses an unsupported data provider.

So, I don’t know why creating a local database would be considered an unsupported provider when dragging and dropping into tables in an object relational constructor.

So, I'm trying the second type, "Service Based Base." I lay out my tables as I want for my main application, and make my tables. The LINQ-To-SQL constructor works fine when I drag and drop these tables, and I move on to writing my own code in my application to insert and update database records.

However, when using this second “service-based database”, my inserts and updates work as long as the application is running. However, as soon as I close it, he returns to what was before. If I manually add data through Server Explorer, it is saved, but any inserts I make are not saved.

Why can't I create and use a local database with LINQ?

, " " ( , ), ?

!


: , LINQ-To-SQL Compact Edition. , SqlMetal dmbl.

+3
1

, bin. ( linq) bin. connectionString.

+5

Source: https://habr.com/ru/post/1707132/


All Articles