private static ISourceFilter GetSourceFilter(SourceFilterDescriptor <Person> sr, SearchParam p) { if (p.isInclude) { if (p.sources == null || p.sources.Count == 0) { return(sr.ExcludeAll()); } else { return(sr.Includes(inc => inc.Fields(p.sources.Select(s => s.ToString()).ToArray()))); } } else { if (p.sources == null || p.sources.Count == 0) { return(sr.IncludeAll()); } else { return(sr.Excludes(exc => exc.Fields(p.sources.Select(s => s.ToString()).ToArray()))); } } }
public ISourceFilter GetSource(SourceFilterDescriptor <T> sr, QueryDes qd) { if (qd.Srcs == null || qd.Srcs.Count == 0) { return(qd.IsInclude ? sr.ExcludeAll() : sr.IncludeAll()); } var arr = qd.Srcs.Select(fld => fld.ToString()).ToArray(); return(qd.IsInclude ? sr.Includes(f => f.Fields(arr)) : sr.Excludes(f => f.Fields(arr))); }