I am new to Linq to Entities and I am trying to insert a record using the linq syntax.
I have created the edmx file and instatiated it in a class with:
PasswordEntities db = new PasswordEntities();
I have a method that looks like this:
public void InsertRecord(Password record)
{
db.AddToPasswords(record);
}
But intellisense tells me that AddToPasswords is a deprecated method and to consider using the .Add method of the associated ObjectSet property instead.
I am running VS 2010 under Framework 4.0.
What would be the syntax to do this?
How about:
db.Passwords.AddObject(record);
Aside: It seems foolish to me to use the word Object in naming classes and methods in an OO world as the EF designers have done. Of course I'm adding an object, that's all we have around here. Does ObjectContext really tell me more about what the context is about than Context?
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