Jestem początkującym w WPF. Chcę wiedzieć, jaka jest różnica między dbcontext.Add
i dbcontext.AddObject
.Czym różni się dbcontext.Add i dbcontext.AddObject
private void AddButton_Click(object sender, RoutedEventArgs e)
{
Name employee = new Name();
employee.Name1 = "Test";
dataContext.Names.AddObject(employee);
}
Chcę to osiągnąć dbcontext.AddObject()
. Ale pojawia się błąd:
'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`
Również sugeruję, który z nich jest lepszy. Dziękuję Ci.
To nie ma nic wspólnego z WPF.Jest powiązany z Entity Framework. – shahkalpesh