I am beginner at WPF. I want to know that what is difference between dbcontext.Add
and dbcontext.AddObject
.
private void AddButton_Click(object sender, RoutedEventArgs e)
{
Name employee = new Name();
employee.Name1 = "Test";
dataContext.Names.AddObject(employee);
}
I want to achieve this dbcontext.AddObject()
. But I get an error:
'System.Data.Entity.DbSet' does not contain a definition for 'AddObject' and no extension method 'AddObject' accepting a first argument of type 'System.Data.Entity.DbSet' could be found (are you missing a using directive or an assembly reference?) C:\Documents\Visual Studio 2012\Projects\WpfApplication9\WpfApplication9\MainWindow.xaml.cs 49 31 WpfApplication9`
Also suggest which one is better. Thank you.