I'm new to stackoverflow an I've searched the whole site and the msdn and found nothing. I hope you can help me!
I want to have a Linq-to-SQL database in an .sdf
file. So I designed the database sheme in the ORM designer for Linq-to-SQL and wrote the following code:
DataShemeDataContext context = new DataShemeDataContext("Data Source=database.sdf");
if (!context.DatabaseExists())
context.CreateDatabase();
Console.ReadLine();
My problem is the following:
- when I run the program and exit it by pressing the Enter key, everything is fine
- But if I click on the "X" button in the top of the console window, the database file is only 20kb size (instead of 84kb) and it is empty.
Using this line:
context.SubmitChanges();
makes no difference.
I hope you can help me!