Share via


Metodo ObjectContext.SaveChanges (Boolean)

[Questa pagina è specifica della versione 6 di Entity Framework. La versione più recente è disponibile come pacchetto NuGet per "Entity Framework". Per ulteriori informazioni su Entity Framework, vedere la pagina msdn.com/data/ef.]

Nota: questa API è ora obsoleta.

Rende persistenti tutti gli aggiornamenti al database e reimposta facoltativamente il rilevamento delle modifiche nel contesto dell'oggetto.

Spazio dei nomi:  System.Data.Entity.Core.Objects
Assembly:  EntityFramework (in EntityFramework.dll)

Sintassi

'Dichiarazione
<ObsoleteAttribute("Use SaveChanges(SaveOptions options) instead.")> _
<BrowsableAttribute(False)> _
<EditorBrowsableAttribute(EditorBrowsableState.Never)> _
Public Overridable Function SaveChanges ( _
    acceptChangesDuringSave As Boolean _
) As Integer
'Utilizzo
Dim instance As ObjectContext 
Dim acceptChangesDuringSave As Boolean 
Dim returnValue As Integer 

returnValue = instance.SaveChanges(acceptChangesDuringSave)
[ObsoleteAttribute("Use SaveChanges(SaveOptions options) instead.")]
[BrowsableAttribute(false)]
[EditorBrowsableAttribute(EditorBrowsableState.Never)]
public virtual int SaveChanges(
    bool acceptChangesDuringSave
)
[ObsoleteAttribute(L"Use SaveChanges(SaveOptions options) instead.")]
[BrowsableAttribute(false)]
[EditorBrowsableAttribute(EditorBrowsableState::Never)]
public:
virtual int SaveChanges(
    bool acceptChangesDuringSave
)
[<ObsoleteAttribute("Use SaveChanges(SaveOptions options) instead.")>]
[<BrowsableAttribute(false)>]
[<EditorBrowsableAttribute(EditorBrowsableState.Never)>]
abstract SaveChanges : 
        acceptChangesDuringSave:bool -> int 
[<ObsoleteAttribute("Use SaveChanges(SaveOptions options) instead.")>]
[<BrowsableAttribute(false)>]
[<EditorBrowsableAttribute(EditorBrowsableState.Never)>]
override SaveChanges : 
        acceptChangesDuringSave:bool -> int
public function SaveChanges(
    acceptChangesDuringSave : boolean
) : int

Parametri

  • acceptChangesDuringSave
    Tipo: System.Boolean
    Questo parametro è necessario per il supporto delle transazioni lato client. Se true, il rilevamento delle modifiche in tutti gli oggetti viene reimpostato dopo il completamento di SaveChanges(Boolean). Se false, è necessario chiamare il metodo AcceptAllChanges() dopo SaveChanges(Boolean).

Valore restituito

Tipo: System.Int32
Il numero di oggetti che si trovano nello stato Added, Modified o Deleted al momento della chiamata a SaveChanges().

Eccezioni

Eccezione Condizione
OptimisticConcurrencyException

Si è verificata una violazione della concorrenza ottimistica durante il salvataggio delle modifiche.

Vedere anche

Riferimento

ObjectContext Classe

Overload SaveChanges

Spazio dei nomi System.Data.Entity.Core.Objects