AutoHistory icon indicating copy to clipboard operation
AutoHistory copied to clipboard

Query against AutoHistories with combining actual tables

Open fabercs opened this issue 6 years ago • 0 comments

I would like to use AutoHistory in my project where I need to query some history data with joining current data. Let's say I have an Order table

public class Order
{
    public int Id { get; set; }
    public OrderState OrderState { get; set; }
    public int ProductId { get; set; }
    public int UserId { get; set; }

    public DateTime CreatedOn { get; set; }
    public DateTime ModifiedOn { get; set; }
}
public enum OrderState
{
    Set=1,
    OnTheWay=2,
    Canceled=3
}

And I have an order record that is OnTheWay state. How can I query that what was the ModifiedOn column value before the state changed to OnTheWay from Set. This is just a simple case, we may have a lots of conditions depends on other columns, do you think it is costly to make use of this AutoHistory table like that?

fabercs avatar Sep 11 '19 05:09 fabercs