FilterQueryResult <T>?CombineFilterResult <T>(FilterQueryResult <T>?one, FilterQueryResult <T> two) where T : Entity { if (one == null) { return(two); } if (two == null) { return(one); } return(new FilterQueryResult <T>( a => one !.InDatabaseExpresson.Evaluate(a) && two.InDatabaseExpresson.Evaluate(a), a => one !.InMemoryFunction !(a) && two !.InMemoryFunction !(a))); }
internal FilterQueryResult <T> OnFilterQuery <T>() where T : Entity { AssertAllowed(typeof(T), inUserInterface: false); EntityEvents <T> ee = (EntityEvents <T>)entityEvents.TryGetC(typeof(T)); if (ee == null) { return(null); } FilterQueryResult <T> result = null; foreach (var item in ee.OnFilterQuery()) { result = CombineFilterResult(result, item); } return(result); }
FilterQueryResult <T> CombineFilterResult <T>(FilterQueryResult <T> result, FilterQueryResult <T> expression) where T : Entity { if (result == null) { return(expression); } if (expression == null) { return(result); } if (result.InMemoryFunction == null || expression.InMemoryFunction == null) { return(new FilterQueryResult <T>(a => result.InDatabaseExpresson.Evaluate(a) && expression.InDatabaseExpresson.Evaluate(a), null)); } return(new FilterQueryResult <T>( a => result.InDatabaseExpresson.Evaluate(a) && expression.InDatabaseExpresson.Evaluate(a), a => result.InMemoryFunction(a) && expression.InMemoryFunction(a))); }