Breeze.ContextProvider.SaveWorkState.BeforeSave C# (CSharp) Method

BeforeSave() public method

public BeforeSave ( ) : void
return void
    public void BeforeSave() {
      SaveMap = new Dictionary<Type, List<EntityInfo>>();
      EntityInfoGroups.ForEach(eg => {
        var entityInfos = eg.EntityInfos.Where(ei => ContextProvider.BeforeSaveEntity(ei)).ToList();
        SaveMap.Add(eg.EntityType, entityInfos);
      });
      SaveMap = ContextProvider.BeforeSaveEntities(SaveMap);
      EntitiesWithAutoGeneratedKeys = SaveMap
        .SelectMany(eiGrp => eiGrp.Value)
        .Where(ei => ei.AutoGeneratedKey != null && ei.EntityState != EntityState.Detached)
        .ToList();
    }

Usage Example

Exemplo n.º 1
0
 private void OpenAndSave(SaveWorkState saveWorkState)
 {
     OpenDbConnection(); // ensure connection is available for BeforeSaveEntities
     saveWorkState.BeforeSave();
     SaveChangesCore(saveWorkState);
     saveWorkState.AfterSave();
 }
All Usage Examples Of Breeze.ContextProvider.SaveWorkState::BeforeSave