public Result <IEnumerable <TDataObject> > ListBy <TDataObject>(params KeyValuePair <String, Object>[] keyValuePairs)
            where TDataObject : class, Data.IDataObjectBase, new()
        {
            if (keyValuePairs == null || keyValuePairs.Length < 1)
            {
                throw new InvalidOperationException(ErrorMessages.ListByArgumentError);
            }

            Result <DataSet> readResult = null;
            Result <IEnumerable <TDataObject> > returnValue = null;
            List <SqlParameter> parameterList = new System.Collections.Generic.List <SqlParameter>( );
            String     commandText            = String.Empty;
            String     prefix  = String.Empty;
            SqlCommand command = null;

            parameterList.AddRange(SqlServerHelper.GetSqlParameters(keyValuePairs));
            commandText = SqlServerHelper.PrepareCommandText <TDataObject>(CommonCommands.RecordList, parameterList.ToArray( ));
            prefix      = SqlServerHelper.GetFieldNamePrefix(new TDataObject( ));
            command     = SqlServerHelper.GetSqlCommand(commandText, parameterList.ToArray( ));

            readResult = SqlServerHelper.ExecuteFill(ref command);
            if (!readResult.IsSuccess)
            {
                returnValue = Result.ErrorResult <IEnumerable <TDataObject> >(readResult.Message, readResult.Exception);
            }
            else
            {
                List <TDataObject> returnObjs = new System.Collections.Generic.List <TDataObject>( );
                for (int i = 0; i < readResult.ReturnValue.Tables[0].Rows.Count; i++)
                {
                    TDataObject dataObj = new TDataObject( );
                    dataObj.Adapter = this;
                    dataObj.Load(prefix, false, 0, i, readResult.ReturnValue);
                    returnObjs.Add(dataObj);
                }

                if (command != null)
                {
                    if (command.Connection.State != ConnectionState.Closed)
                    {
                        command.Connection.Close( );
                    }
                    command.Connection.Dispose( );
                    command.Dispose( );
                }
                returnValue = Result.SuccessResult <IEnumerable <TDataObject> >(returnObjs);
            }

            return(returnValue);
        }
        public Result <IEnumerable <TDataObject> > List <TDataObject>( )
            where TDataObject : class, Data.IDataObjectBase, new()
        {
            String     prefix      = SqlServerHelper.GetFieldNamePrefix(new TDataObject( ));
            String     commandText = SqlServerHelper.PrepareCommandText <TDataObject>(CommonCommands.RecordList);
            SqlCommand command     = SqlServerHelper.GetSqlCommand(commandText);
            Result <IEnumerable <TDataObject> > returnValue = null;
            Result <System.Data.DataSet>        readResult  = SqlServerHelper.ExecuteFill(ref command);

            if (!readResult.IsSuccess)
            {
                returnValue = Result.ErrorResult <IEnumerable <TDataObject> >(readResult.Message, readResult.Exception);
            }
            else
            {
                List <TDataObject> returnObjs = new List <TDataObject>( );
                for (int i = 0; i < readResult.ReturnValue.Tables[0].Rows.Count; i++)
                {
                    TDataObject dataObj = new TDataObject( );
                    dataObj.Adapter = this;
                    dataObj.Load(prefix, false, 0, i, readResult.ReturnValue);
                    returnObjs.Add(dataObj);
                }

                if (command != null)
                {
                    if (command.Connection.State != System.Data.ConnectionState.Closed)
                    {
                        command.Connection.Close( );
                    }
                    command.Connection.Dispose( );
                    command.Dispose( );
                }

                returnValue = Result.SuccessResult <IEnumerable <TDataObject> >(returnObjs);
            }
            return(returnValue);
        }