System.Data.SQLite
View Ticket
Not logged in
Ticket UUID: 988e2d6107c786b9160a7fc0dcd4ecc6167bee50
Title: EF6 implementation does not work as expected
Status: Deferred Type: Incident
Severity: Important Priority: Medium
Subsystem: LINQ Resolution: Need_More_Info
Last Modified: 2019-01-15 15:56:33
Version Found In: 1.0.109
User Comments:
anonymous added on 2019-01-11 21:32:39:
Calling Find on a DBSet does not return results w/o calling ToList() first.

Example:
            using (var connection = new SQLiteConnection("Data Source=:memory:"))
            {
                connection.Open();
                var id = Guid.NewGuid();

                using (var context = new TestDBSQLiteContext(connection))
                {
                    var customer = new Customer {Id = id, SisNumber = "1234567"};
                    context.Customers.Add(customer);

                    context.SaveChanges();
                }

                using (var context = new TestDBSQLiteContext(connection))
                {
                    // this should write the sis number (but does not)
                    Console.WriteLine(context.Customers.Find(id)?.SisNumber ?? "<NULL>");
                }

                using (var context = new TestDBSQLiteContext(connection))
                {
                    var dummy = context.Customers.ToList();
                    // here it gets written
                    Console.WriteLine(context.Customers.Find(id)?.SisNumber ?? "<NULL>");
                }
            }

I can provide a complete test program, if required.