How can I update a single property of a record without retrieving it first? I\'m asking in the context of EF Code First 4.1
Says I have a class User
You can try a sort of hack: context.Database.ExecuteSqlCommand("update [dbo].[Users] set [LastActivity] = @p1 where [Id] = @p2", new System.Data.SqlClient.SqlParameter("p1", DateTime.Now), new System.Data.SqlClient.SqlParameter("p2", id));
context.Database.ExecuteSqlCommand("update [dbo].[Users] set [LastActivity] = @p1 where [Id] = @p2", new System.Data.SqlClient.SqlParameter("p1", DateTime.Now), new System.Data.SqlClient.SqlParameter("p2", id));