Linq to SQL vs. Entity Framework

0

What is the difference between Linq's SubmitChanges and Entity Framework%% co?

WTablasDataContext.AfipEscalaSuss.Add(obj)

WTablasDataContext.AfipEscalaSuss.SubmitChanges(obj)
    
asked by Federico Tomadin 06.09.2017 в 15:39
source

2 answers

1

When you execute SubmitChanges , you save the changes in the context in the database. While Add(T entity) adds the object to the track of the DbContext adding a state that is ready to be inserted but does not save it in the database until when the method SaveChanges() is executed.

    
answered by 06.09.2017 в 15:43
1

You are mixing two different things:

The Add in LINQ To SQL and Entity Framework add an entity to the context so they are marked to be inserted after their changes persist.

SubmitChanges of LINQ To SQL and SaveChanges of Entity Framework just execute all the pending changes in the context against the database, that is, they generate the SQL corresponding to the changes and execute it.

  

Note: The LINQ To SQL SubmitChanges parameter is not an entity but a ConflictMode . This parameter is used to indicate what to do in case of conflict. The possible values are: FailOnFirstConflict and ContinueOnConflict

    
answered by 06.09.2017 в 16:07