IdeaBlade.EntityModel Assembly > IdeaBlade.EntityModel Namespace > EntityManager Class : TrySaveChanges Method |
'Declaration
Public Function TrySaveChanges( _ Optional ByVal saveOptions As SaveOptions _ ) As SaveResult
'Usage
Dim instance As EntityManager Dim saveOptions As SaveOptions Dim value As SaveResult value = instance.TrySaveChanges(saveOptions)
public SaveResult TrySaveChanges( SaveOptions saveOptions )
A SaveResult is always returned. The SaveResult will indicate if the save was successful, if processing was cancelled, or it an error occurred.
private void SaveSample() { DomainModelEntityManager mgr = new DomainModelEntityManager(); // Retrieve a single Order and its Customer OrderSummary order = mgr.ExecuteQuery<OrderSummary>(new entityKey(typeof(OrderSummary), 1)); Customer cust = order.Customer; // Change the address in both Order and Customer order.ShipAddress = "100 Broadway"; cust.Address = "100 Broadway"; // Now save SaveResult sr = mgr.TrySaveChanges(); if (sr.Ok) { MessageBox.Show("Changes saved to database."); } }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2