/// <summary>
        /// 
        /// </summary>
        /// <param name="parameter"></param>
        /// <returns></returns>
        public IPagingResult SelectFunction(SelectingEventArgs parameter)
        {
            lock (customDAO)
            {
                try
                {
                    DetachedCriteria criteria = DetachedCriteria.For(parameter.SourceType);
                    parameter.Parameters.All
                        (
                            sourceParameter =>
                                {
                                    criteria.Add(Restrictions.Eq(sourceParameter.Name, sourceParameter.Value));
                                    return true;
                                }
                        );

                    var res = customDAO.GetPagedResult(parameter.StartRowIndex, parameter.MaximumRows, criteria);
                    return new PagingResult(parameter.SourceType, res.StartIndex, res.Size) { Result = res.Result, TotalRowCount = res.Counter };
                }
                catch (Exception ex)
                {
                    return new PagingResult(parameter.SourceType, new ExecutionQueryException("Error on executing the select function.", "SelectFunction", ex));
                }
            }
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void CustomDataSource_Selecting(object sender, SelectingEventArgs e)
 {
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="arguments"></param>
        /// <returns></returns>
        protected override IEnumerable ExecuteSelect(DataSourceSelectArguments arguments)
        {
            if (owner.SelectFunction == null)
                throw new DelegateNotFoundException("SelectFunction", "The select function doesn't implemented.");

            arguments.RaiseUnsupportedCapabilitiesError(this);

            var eventArg = new SelectingEventArgs(arguments, this.GetSelectParameters(), owner.SourceType);
            owner.OnSelecting(eventArg);
            if (eventArg.Cancel)
                return null;

            var selectActionEvent = new ActionEventArgs<SelectingEventArgs, IPagingResult>(eventArg, owner.SelectFunction);

            IPagingResult paging = selectActionEvent.Execute();
            if (paging.QueryException != null)
            {
                owner.OnExecutionQueryError(new QueryResultEventArgs(paging));
                return null;
            }

            IEnumerable result = paging.Result;
            arguments.TotalRowCount = paging.TotalRowCount;
            owner.OnSelected(EventArgs.Empty);

            return result;
        }
 internal void OnSelecting(SelectingEventArgs e)
 {
     if (Selecting != null) Selecting(this, e);
 }