Esempio n. 1
0
        public int Should_filter_by_isin_when_isin_only_is_set(string isinCode)
        {
            var fastSearch = new FastSearch <OrderAdapter>();

            fastSearch.AddPredicate(o => o.Security.IsinCode == isinCode);
            return(orders.Count(s => fastSearch.Predicate(s)));
        }
Esempio n. 2
0
        public int Should_filter_by_isin_when_isin_only_is_set_in_string(string filterSearch)
        {
            var fastSearch = new FastSearch <OrderAdapter>();

            fastSearch.AddPredicate(filterSearch);
            return(orders.Count(s => fastSearch.Predicate(s)));
        }
Esempio n. 3
0
        public async Task <List <T> > FastSearchAsync(FastSearch search, bool enableTracking = false)
        {
            List <T> searchResult = new List <T>();

            if (search != null)
            {
                if (!string.IsNullOrWhiteSpace(search.SearchString))
                {
                    IQueryable <T> query = dbset;
                    if (!enableTracking)
                    {
                        query = query.AsNoTracking();
                    }
                    foreach (var prop in typeof(T).GetProperties())
                    {
                        var attr = prop.GetCustomAttribute <FastSearchAttribute>();
                        if (attr == null)
                        {
                            continue;
                        }
                        string crit = $"{prop.Name}.Contains(@0)";
                        query        = query.Where(crit, search.SearchString).Take(10);
                        searchResult = await query.ToListAsync();
                    }
                }
            }
            return(searchResult);
        }
 public SearchSummaryItemBuilder(FastSearch.SearchResult searchResult, Predicate<ChangeType> changeTypeSelector)
 {
    this.m_searchResult = searchResult;
     m_changeTypeSelector = changeTypeSelector;
 }