Hi guys,
I am attempting to use the new SelectFilter as a blanket approach, with the following code in my AppHost.Configure:
OrmLiteConfig.SqlExpressionSelectFilter = q =>
{
if (q.ModelDef.ModelType.HasInterface(typeof(IBaseType)))
{
q.Where<IBaseType>(x => x.ValidTo == null);
}
};
This works fine for Selects but when my code hits:
var results = dbConn.SelectMulti<T, T2>(expression);
(where T : IBaseType where T2 : IBaseType
public interface IBaseType
{
....
DateTime? ValidTo { get; set; }
....
}
)
I get an error as follows:
Additional information: SQL logic error or missing database
no such column: IBaseType.ValidTo
If I set up the SelectFilters like the following it all works:
SqlExpression<SettlementTerm>.SelectFilter = q => q.Where(x => x.ValidTo == null);
SqlExpression<LinkSupplierToSettlementTerm>.SelectFilter = q => q.Where(x => x.ValidTo == null);
I am looking for a solution to get the blanket approach working so that the filter applies automatically to every call.
Forgive me if my formatting is incorrect, first post!
Thanks
Simon