Ejemplo n.º 1
0
 /// <summary>
 /// Purge object state cache and detach all objects added/updated/deleted from the system in current context.SaveChanges() call
 /// </summary>
 /// <param name="apiContext"></param>
 /// <param name="entities"></param>
 protected static void DetachObjects(Helpers.ApiContext apiContext, System.Collections.Generic.IEnumerable <Entities.EntityObject> entities)
 {
     Model.OrmsContext context = (Model.OrmsContext)apiContext.CurrentContext;
     foreach (var entity in entities)
     {
         context.Detach(entity);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Purge object state cache and detach all objects added/updated/deleted from the system in current context.SaveChanges() call
 /// </summary>
 /// <param name="apiContext"></param>
 /// <param name="entity"></param>
 protected static void DetachObject(Helpers.ApiContext apiContext, Entities.EntityObject entity)
 {
     Model.OrmsContext context = (Model.OrmsContext)apiContext.CurrentContext;
     try
     {
         context.Detach(entity);
     }
     catch (System.InvalidOperationException) { } // NOTE : we do intentionally suppressing this exception
 }