// Copyright (C) Stichting Deltares 2016. All rights reserved.
//
// This file is part of Ringtoets.
//
// Ringtoets is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
//
// All names, logos, and references to "Deltares" are registered trademarks of
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
using System.Collections.Generic;
using System.Data.Entity;
using Application.Ringtoets.Storage.DbContext;
using Core.Common.Base.Storage;
namespace Application.Ringtoets.Storage.Persistors
{
///
/// Interface that describes the methods that must be implemented on classes that are storage persistors.
///
public interface IPersistor where TEntity : class where TModel : IStorable
{
///
/// Ensures that the is set as in the .
/// All other in will be removed.
///
/// Collection where objects can be searched and added. Usually, this collection is a navigation property of a .
/// The to be saved in the storage.
/// Value used for sorting.
void UpdateModel(ICollection parentNavigationProperty, TModel model, int order);
///
/// Ensures that the is added as in the .
/// All other in will be removed.
///
/// Collection where objects can be added. Usually, this collection is a navigation property of a .
/// The to be saved in the storage.
/// Value used for sorting.
void InsertModel(ICollection parentNavigationProperty, TModel model, int order);
///
/// Removes all entities from that are not marked as 'updated'.
///
/// List where objects can be searched. Usually, this collection is a navigation property of a .
void RemoveUnModifiedEntries(ICollection parentNavigationProperty);
///
/// Perform actions that can only be executed after has been called.
///
void PerformPostSaveActions();
///
/// Loads the as from .
///
/// Collection where objects can be searched. Usually, this collection is a navigation property of a .
/// List of .
IEnumerable LoadModels(ICollection parentNavigationProperty);
///
/// Updates the children of , in reference to , in the storage.
///
/// The of which children need to be updated.
/// Referenced .
void UpdateChildren(TModel model, TEntity entity);
///
/// Inserts the children of , in reference to , in the storage.
///
/// The of which children need to be inserted.
/// Referenced .
void InsertChildren(TModel model, TEntity entity);
}
}