/// <summary> /// Saves all changes made in this context to the underlying database. /// </summary> /// <returns> /// 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). /// </returns> /// <exception cref="DbUpdateException">An error occurred sending updates to the database.</exception> /// <exception cref="DbUpdateConcurrencyException"> /// A database command did not affect the expected number of rows. This usually indicates an optimistic /// concurrency violation; that is, a row has been changed in the database since it was queried. /// </exception> /// <exception cref="DbEntityValidationException"> /// The save was aborted because validation of entity property values failed. /// </exception> /// <exception cref="NotSupportedException"> /// An attempt was made to use unsupported behavior such as executing multiple asynchronous commands concurrently /// on the same context instance.</exception> /// <exception cref="ObjectDisposedException">The context or connection have been disposed.</exception> /// <exception cref="InvalidOperationException"> /// Some error occurred attempting to process entities in the context either before or after sending commands /// to the database. /// </exception> public virtual int SaveChanges() { return(InternalContext.SaveChanges()); }