Persists all changed
IEntity objects within the EntityManager cache to the backend data source using the
DefaultSaveOptions.
Syntax
Visual Basic (Declaration) | |
---|
Public Overloads Function SaveChanges() As SaveResult |
Return Value
A
SaveResult object that contains a boolean indicating the result of the save as well as any errors encountered during the save.
Exceptions
Example
C# | Copy Code |
---|
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 -- using a save list and SaveOptions.
List<Entity> changedEntities = new List<Entity>();
changedEntities.Add(order);
changedEntities.Add(cust);
SaveOptions options = new SaveOptions();
SaveResult sr = mgr.SaveChanges(changedEntities, options);
if (sr.Ok) {
MessageBox.Show("Changes saved to database.");
}
} |
Remarks
Requirements
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family
See Also