I'm trying to use the CodeFirst data migrations in EF5 with a table that has a composite natural key. Is it possible to specify this in the first argument to DbSet.AddOrUpdate, like
context.Table1.AddOrUpdate(
t=>t.Column1 && t.Column2,
new Table1 { properties... }
);
How would one specify using more than one property in this case?
Thanks, Matthew
Turns out I had to use an anonymous type in the first argument, e.g.
t => new { t.Column1, t.Column2 }
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