/// <summary> /// Returns the data instance that should be edited based on the given edit state and data /// type. /// </summary> private static Data.IData GetEditedData(IQueryableEntity entity, DataEditState editState, Type dataType) { var accessor = new DataAccessor(dataType); switch (editState) { case DataEditState.Current: return entity.Current(accessor); case DataEditState.Previous: return entity.Previous(accessor); } throw new InvalidOperationException("Unknown edit state"); }
public static T Previous <T>(this IQueryableEntity entity) where T : Data.IVersioned { return((T)entity.Previous(DataMap <T> .Accessor)); }
/// <summary> /// Returns the previous data value for the given data type. /// </summary> /// <typeparam name="TData">The type of data to retrieve. It has to be one of the generic /// parameters for this type; if it is not, then an exception is thrown.</typeparam> /// <returns>The current value for the given data type.</returns> public TData Previous <TData>() where TData : Data.IVersioned { VerifyRequest <TData>(); return(_provider.Previous <TData>()); }