I am currently stumbling across some C# Linq to SQL DataContext misbehavior when retrieving a data set, changing it and invoking SubmitChanges to save the changes back to the database.
I searched around and found this SO-Question pointing out pretty much my exact problem.
Short outline:
- I am using Linq to SQL with SQLite, therefore without the Designer offered by VisualStudio
- I am creating a connection to an In-Memory-Database
- I am using a class derived from DataContext taking the connection to the base class and a Table property mapping the real table
I have used the Log Property to retrieve the actual command send to the database, which is as follows:
UPDATE [Roles] SET WHERE ([Id] = @p0) AND ([Name] = @p1) -- @p0: Input String (Size = 4000; Prec = 0; Scale = 0) [ea34d99e-8ad5-4fa7-83f3-5cf3ac282da6] -- @p1: Input String (Size = 4000; Prec = 0; Scale = 0) [Role 1] -- Context: SqlProvider(Sql2008) Model: AttributedMetaModel Build: 4.7.3056.0
As you can see, the SET clause is empty, which is what I cannot understand at this point.
Since I am pretty sure that more information are required to understand the issue, feel free to ask me anything about it, I would be more than happy to get you aboard.
Any chance to get the code up here as a zip file or similar?
Moving to Entity Framework has solved the problem.