I'm working in VS2015 WCF service against a SQL Server 2012 db with Entity Framework 6.1.3
I started out with "Code First from Existing Database" and since then do all edits from CF.
I have basic read write operations working. I can .Add to a table fine and it works as expected but I can't .AddOrUpdate as I see people talking about because it's not in the intellisense dropdown as I type!?
Here's a screen grab...
That's an IDbSetExtensions
extension method.
You need to add a using System.Data.Entity.Migrations;
directive.
As explained here and in various other sources (just search the web for '"AddOrUpdate" entity framework') this method is meant to be used for seeding only. Don't use it in your application logic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With