Sono principiante presso WPF. Voglio sapere che cos'è la differenza tra dbcontext.Add
e dbcontext.AddObject
.Qual è la differenza tra dbcontext.Add e dbcontext.AddObject
private void AddButton_Click(object sender, RoutedEventArgs e)
{
Name employee = new Name();
employee.Name1 = "Test";
dataContext.Names.AddObject(employee);
}
Voglio raggiungere questo dbcontext.AddObject()
. Ma ottengo un errore:
'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`
Anche suggerire quale è meglio. Grazie.
Questo non ha nulla a che fare con WPF.È correlato a Entity Framework. – shahkalpesh