Ejemplo n.º 1
0
        public static IEnumerable <T> QueryList <T>(Site site, string viewName, Func <Site, string, T> createModel)
            where T : IPersistable
        {
            var bucket = site.GetClient();

            if (bucket != null)
            {
                var view = GetView(bucket, site.GetBucketName(), viewName, viewName);

                var idList = view.Select(it => it.ItemId).ToArray();

                return(bucket.ExecuteGet(idList).Select(it => ModelExtensions.ToModel <T>(site, it.Key, it.Value.Value.ToString(), createModel)));
            }
            else
            {
                return(new T[0]);
            }
        }