Exemple #1
0
        /// <summary>
        /// Construtor padrão.
        /// </summary>
        /// <param name="result"></param>
        public QueryResult(IQueryResult result)
        {
            if (result == null)
            {
                throw new ArgumentNullException("result");
            }
            _result = result;
            var ts = TypeBindStrategyCache.GetItem(typeof(TModel), t => new QueryResultObjectCreator(t));

            _objectCreator = ts;
            _bindStrategy  = ts;
        }
 public MultiQueryable Add <TModel>(Queryable query, QueryCallBack <TModel> callback, QueryFailedCallBack failedCallBack, IQueryResultBindStrategy bindStrategy, IQueryResultObjectCreator objectCreator)
 {
     _queries.Add(query);
     if (bindStrategy == null && objectCreator == null)
     {
         var ts = TypeBindStrategyCache.GetItem(typeof(TModel), t => new QueryResultObjectCreator(t));
         objectCreator = ts;
         bindStrategy  = ts;
     }
     if (bindStrategy == null)
     {
         bindStrategy = new TypeBindStrategy(typeof(TModel), objectCreator);
     }
     if (callback != null)
     {
         QueryCallBackWrapper <TModel> wrapper = new QueryCallBackWrapper <TModel>();
         wrapper.QueryCallBack       = callback;
         wrapper.QueryFailedCallBack = failedCallBack;
         wrapper.BindStrategy        = bindStrategy;
         wrapper.ObjectCreator       = objectCreator;
         _callbacks.Add(_queries.Count - 1, wrapper);
     }
     return(this);
 }