From 9e43f8dcbbef99841b8f776d23c7045b27271303 Mon Sep 17 00:00:00 2001 From: rowanmiller Date: Mon, 10 Nov 2014 15:15:17 -0800 Subject: [PATCH] SaveChanges return value docs Improving docs on the return value of SaveChanges Issue: 2529 --- .../Core/Objects/ObjectContext.cs | 64 +++++++++---------- src/EntityFramework/DbContext.cs | 17 ++++- 2 files changed, 46 insertions(+), 35 deletions(-) diff --git a/src/EntityFramework/Core/Objects/ObjectContext.cs b/src/EntityFramework/Core/Objects/ObjectContext.cs index 4d5c62f233..d5e7899b05 100644 --- a/src/EntityFramework/Core/Objects/ObjectContext.cs +++ b/src/EntityFramework/Core/Objects/ObjectContext.cs @@ -2922,10 +2922,10 @@ private static int RefreshEntitiesSize(IEnumerable collection) /// Persists all updates to the database and resets change tracking in the object context. /// - /// The number of objects in an , - /// , - /// or state when - /// was called. + /// The number of state entries written to the underlying database. This can include + /// state entries for entities and/or relationships. Relationship state entries are created for + /// many-to-many relationships and relationships where there is no foreign key property + /// included in the entity class (often referred to as independent associations). /// /// An optimistic concurrency violation has occurred while saving changes. public virtual int SaveChanges() @@ -2941,11 +2941,11 @@ public virtual int SaveChanges() /// that any asynchronous operations have completed before calling another method on this context. /// /// - /// A task that represents the asynchronous operation. - /// The task result contains the number of objects in an , - /// , - /// or state when - /// was called. + /// A task that represents the asynchronous save operation. + /// The task result contains the number of state entries written to the underlying database. This can include + /// state entries for entities and/or relationships. Relationship state entries are created for + /// many-to-many relationships and relationships where there is no foreign key property + /// included in the entity class (often referred to as independent associations). /// /// An optimistic concurrency violation has occurred while saving changes. public virtual Task SaveChangesAsync() @@ -2962,11 +2962,11 @@ public virtual Task SaveChangesAsync() /// A to observe while waiting for the task to complete. /// /// - /// A task that represents the asynchronous operation. - /// The task result contains the number of objects in an , - /// , - /// or state when - /// was called. + /// A task that represents the asynchronous save operation. + /// The task result contains the number of state entries written to the underlying database. This can include + /// state entries for entities and/or relationships. Relationship state entries are created for + /// many-to-many relationships and relationships where there is no foreign key property + /// included in the entity class (often referred to as independent associations). /// /// An optimistic concurrency violation has occurred while saving changes. public virtual Task SaveChangesAsync(CancellationToken cancellationToken) @@ -2984,10 +2984,10 @@ public virtual Task SaveChangesAsync(CancellationToken cancellationToken) /// method after . /// /// - /// The number of objects in an , - /// , - /// or state when - /// was called. + /// The number of state entries written to the underlying database. This can include + /// state entries for entities and/or relationships. Relationship state entries are created for + /// many-to-many relationships and relationships where there is no foreign key property + /// included in the entity class (often referred to as independent associations). /// /// An optimistic concurrency violation has occurred while saving changes. [EditorBrowsable(EditorBrowsableState.Never)] @@ -3006,10 +3006,10 @@ public virtual int SaveChanges(bool acceptChangesDuringSave) /// A value that determines the behavior of the operation. /// /// - /// The number of objects in an , - /// , - /// or state when - /// was called. + /// The number of state entries written to the underlying database. This can include + /// state entries for entities and/or relationships. Relationship state entries are created for + /// many-to-many relationships and relationships where there is no foreign key property + /// included in the entity class (often referred to as independent associations). /// /// An optimistic concurrency violation has occurred while saving changes. public virtual int SaveChanges(SaveOptions options) @@ -3055,11 +3055,11 @@ internal int SaveChangesInternal(SaveOptions options, bool executeInExistingTran /// A value that determines the behavior of the operation. /// /// - /// A task that represents the asynchronous operation. - /// The task result contains the number of objects in an , - /// , - /// or state when - /// was called. + /// A task that represents the asynchronous save operation. + /// The task result contains the number of state entries written to the underlying database. This can include + /// state entries for entities and/or relationships. Relationship state entries are created for + /// many-to-many relationships and relationships where there is no foreign key property + /// included in the entity class (often referred to as independent associations). /// /// An optimistic concurrency violation has occurred while saving changes. public virtual Task SaveChangesAsync(SaveOptions options) @@ -3079,11 +3079,11 @@ public virtual Task SaveChangesAsync(SaveOptions options) /// A to observe while waiting for the task to complete. /// /// - /// A task that represents the asynchronous operation. - /// The task result contains the number of objects in an , - /// , - /// or state when - /// was called. + /// A task that represents the asynchronous save operation. + /// The task result contains the number of state entries written to the underlying database. This can include + /// state entries for entities and/or relationships. Relationship state entries are created for + /// many-to-many relationships and relationships where there is no foreign key property + /// included in the entity class (often referred to as independent associations). /// /// An optimistic concurrency violation has occurred while saving changes. public virtual Task SaveChangesAsync(SaveOptions options, CancellationToken cancellationToken) diff --git a/src/EntityFramework/DbContext.cs b/src/EntityFramework/DbContext.cs index faaf339098..cace8ce7f7 100644 --- a/src/EntityFramework/DbContext.cs +++ b/src/EntityFramework/DbContext.cs @@ -305,7 +305,12 @@ public virtual DbSet Set(Type entityType) /// /// Saves all changes made in this context to the underlying database. /// - /// The number of objects written to the underlying database. + /// + /// The number of state entries written to the underlying database. This can include + /// state entries for entities and/or relationships. Relationship state entries are created for + /// many-to-many relationships and relationships where there is no foreign key property + /// included in the entity class (often referred to as independent associations). + /// /// An error occurred sending updates to the database. /// /// A database command did not affect the expected number of rows. This usually indicates an optimistic @@ -338,7 +343,10 @@ public virtual int SaveChanges() /// /// /// A task that represents the asynchronous save operation. - /// The task result contains the number of objects written to the underlying database. + /// The task result contains the number of state entries written to the underlying database. This can include + /// state entries for entities and/or relationships. Relationship state entries are created for + /// many-to-many relationships and relationships where there is no foreign key property + /// included in the entity class (often referred to as independent associations). /// /// An error occurred sending updates to the database. /// @@ -373,7 +381,10 @@ public virtual Task SaveChangesAsync() /// /// /// A task that represents the asynchronous save operation. - /// The task result contains the number of objects written to the underlying database. + /// The task result contains the number of state entries written to the underlying database. This can include + /// state entries for entities and/or relationships. Relationship state entries are created for + /// many-to-many relationships and relationships where there is no foreign key property + /// included in the entity class (often referred to as independent associations). /// /// Thrown if the context has been disposed. [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "cancellationToken")]