コード例 #1
0
        // selectedOnly == true - list of selected items only (selectedIDlist)
        // otherwise - list of all items from the set
        public static async Task <MultiSelectList> ToMultiSelectListAsync <TEntity>(this IQueryable <TEntity> set, IList selectedIDlist, bool selectedOnly, Expression <Func <TEntity, object> > customOrderBySelector = null)
            where TEntity : class
        {
            IList ids = (selectedOnly) ? selectedIDlist : null;

            if (IDNameObjectType <TEntity> .IsSimplifiable)
            {
                var list = await MultiSelectListManager <TEntity> .SimpleINOQuery(set, ids, customOrderBySelector).ToEntityListAsync();

                return(MultiSelectListManager <SimpleIDNameObject> .FromList(list, selectedIDlist));
            }
            else
            {
                var list = await MultiSelectListManager <TEntity> .Query(set, ids, customOrderBySelector).ToEntityListAsync();

                return(MultiSelectListManager <TEntity> .FromList(list, selectedIDlist));
            }
        }