private void button2_Click(object sender, EventArgs e)
        {
            int count = int.Parse(textBox1.Text);

            using (MB.Orm.Persistence.DatabaseConfigurationScope scope = new MB.Orm.Persistence.DatabaseConfigurationScope("SQL SERVER")) {
                using (MB.Util.MethodTraceWithTime t = new MB.Util.MethodTraceWithTime("BLUCK", count)) {
                    IList lstData = null;
                    if (chkDataTable.Checked)
                    {
                        DataTable dt = getDataTable(count, 1);
                        lstData = dt.Select();
                    }
                    else
                    {
                        lstData = getListData(count, 1);
                    }

                    using (MB.RuleBase.BulkCopy.IDbBulkExecute bulk = MB.RuleBase.BulkCopy.DbBulkExecuteFactory.CreateDbBulkExecute()) {
                        bulk.WriteToServer("MbfsFucDtl", "AddObject", lstData);
                    }

                    MessageBox.Show(string.Format("总共执行的时间有{0} 毫秒", t.GetExecutedTimes()));
                }
            }
        }
        private void button8_Click(object sender, EventArgs e)
        {
            string name  = "@Name";
            string name2 = "@Name";

            using (MB.Util.MethodTraceWithTime trace = new MB.Util.MethodTraceWithTime("")) {
                Microsoft.Practices.EnterpriseLibrary.Data.Database db = MB.Orm.Persistence.DatabaseHelper.CreateDatabase();
                if (db is Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDatabase)
                {
                    name = ":" + name.Substring(1, name.Length - 1);
                }

                double d1 = trace.GetExecutedTimes();
            }
            using (MB.Util.MethodTraceWithTime trace = new MB.Util.MethodTraceWithTime("")) {
                using (MB.Orm.Persistence.DatabaseConfigurationScope scop = new MB.Orm.Persistence.DatabaseConfigurationScope("SQL SERVER")) {
                    Microsoft.Practices.EnterpriseLibrary.Data.Database db2 = MB.Orm.Persistence.DatabaseHelper.CreateDatabase();
                    if (db2 is Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDatabase)
                    {
                        name = ":" + name.Substring(1, name.Length - 1);
                    }
                    else if (db2 is Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase)
                    {
                        name = "@" + name.Substring(1, name.Length - 1);
                    }
                    else
                    {
                    }
                }
                double d2 = trace.GetExecutedTimes();
            }
        }
        private void button6_Click(object sender, EventArgs e)
        {
            int count = int.Parse(textBox1.Text);
            List <MY_TABLE_MAINInfo> myEntitys = new List <MY_TABLE_MAINInfo>();
            int beginID = 1;

            for (int i = 0; i < 1000; i++)
            {
                myEntitys.Add(new MY_TABLE_MAINInfo()
                {
                    ID = beginID++, NAME = "CCCC", CODE = "BB", ADDRESS = "PPP"
                });
            }
            using (MB.Orm.Persistence.DatabaseConfigurationScope scope = new MB.Orm.Persistence.DatabaseConfigurationScope("MB.MBFS")) {
                Database db = MB.Orm.Persistence.DatabaseHelper.CreateDatabase();
                using (MB.Util.MethodTraceWithTime t = new MB.Util.MethodTraceWithTime("BLUCK", count)) {
                    //using (SqlConnection cn = new SqlConnection(db.ConnectionString)) {
                    //    cn.Open();
                    //    using (SqlTransaction tran = cn.BeginTransaction()) {
                    //        try {
                    using (TransactionScope scopeTran = new TransactionScope()) {
                        using (MB.RuleBase.BulkCopy.IDbBulkExecute bulk = MB.RuleBase.BulkCopy.DbBulkExecuteFactory.CreateDbBulkExecute()) {
                            bulk.WriteToServer("MY_TABLE_MAIN", "UpdateObject", myEntitys);
                        }
                        // string data = MB.RuleBase.Common.DatabaseExcuteByXmlHelper.NewInstance.ExecuteScalar<string>("MY_TABLE_MAIN", "SelectObject", 10);

                        scopeTran.Complete();
                        // throw new Exception("ERROR");
                    }
                    //        tran.Commit();
                    //        // throw new Exception();
                    //    }
                    //    catch {
                    //        tran.Rollback();
                    //    }
                    //}
                    MessageBox.Show(string.Format("总共执行的时间有{0} 毫秒", t.GetExecutedTimes()));
                }
            }
        }
        private void button4_Click(object sender, EventArgs e)
        {
            int count = int.Parse(textBox1.Text);

            using (MB.Orm.Persistence.DatabaseConfigurationScope scope = new MB.Orm.Persistence.DatabaseConfigurationScope("SQL SERVER")) {
                Database db = MB.Orm.Persistence.DatabaseHelper.CreateDatabase();
                using (MB.Util.MethodTraceWithTime t = new MB.Util.MethodTraceWithTime("BLUCK", count)) {
                    using (SqlConnection cn = new SqlConnection(db.ConnectionString)) {
                        cn.Open();
                        using (SqlTransaction tran = cn.BeginTransaction()) {
                            try {
                                IList lstData = null;
                                if (chkDataTable.Checked)
                                {
                                    DataTable dt = getDataTable(count, 1);
                                    lstData = dt.Select();
                                }
                                else
                                {
                                    lstData = getListData(count, 1);
                                }
                                using (MB.RuleBase.BulkCopy.IDbBulkExecute bulk = MB.RuleBase.BulkCopy.DbBulkExecuteFactory.CreateDbBulkExecute(tran)) {
                                    bulk.WriteToServer("MbfsFucDtl", "AddObject", lstData);
                                }
                                tran.Commit();
                                // throw new Exception();
                            }
                            catch {
                                tran.Rollback();
                            }
                        }
                    }
                    MessageBox.Show(string.Format("总共执行的时间有{0} 毫秒", t.GetExecutedTimes()));
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            int count = int.Parse(textBox1.Text);

            using (MB.Util.MethodTraceWithTime t = new MB.Util.MethodTraceWithTime("BLUCK", count)) {
                int   idC     = MB.Orm.Persistence.EntityIdentityHelper.NewInstance.GetEntityIdentity("MBFS_FUC_DTL", count);
                IList lstData = null;
                if (chkDataTable.Checked)
                {
                    DataTable dt = getDataTable(count, idC);
                    lstData = dt.Select();
                }
                else
                {
                    lstData = getListData(count, idC);
                }

                using (MB.RuleBase.BulkCopy.IDbBulkExecute bulk = MB.RuleBase.BulkCopy.DbBulkExecuteFactory.CreateDbBulkExecute()) {
                    bulk.WriteToServer("MbfsFucDtl", "AddObject", lstData);
                }

                MessageBox.Show(string.Format("总共执行的时间有{0} 毫秒", t.GetExecutedTimes()));
            }
        }
        /// <summary>
        /// 根据查询条件获取数据。
        /// </summary>
        /// <param name="dataInDocType"></param>
        /// <param name="filterParameters"></param>
        /// <returns></returns>
        public System.Collections.IList GetFilterObjects(int dataInDocType, List <MB.Util.Model.QueryParameterInfo> filterParameters)
        {
            if (_InvokeFilterParentFormHoster != null)
            {
                InvokeDataAssistantHosterEventArgs arg = new InvokeDataAssistantHosterEventArgs(_ClientRule, _ClumnEditCfgInfo, _CurrentEditObject, filterParameters);
                _InvokeFilterParentFormHoster.BeforeGetFilterData(_InvokeParentControl, arg);
                if (arg.Cancel)
                {
                    return(null);
                }
            }
            try
            {
                if (_QueryObject != null)
                {
                    return(_QueryObject.GetFilterObjects(filterParameters.ToArray()));
                }
                if (_InvokeDataSourceDesc == null)
                {
                    IList lstDatas = null;
                    try
                    {
                        using (MB.Util.MethodTraceWithTime timeTrack = new MB.Util.MethodTraceWithTime(null))
                        {
                            lstDatas = _ClientRule.GetObjects((int)_ClientRule.MainDataTypeInDoc, filterParameters.ToArray());

                            var msg = string.Format("查询花费:{0} 毫秒,返回 {1} 记录", timeTrack.GetExecutedTimes(), lstDatas.Count);
                            MB.WinBase.AppMessenger.DefaultMessenger.Publish(QUERY_REFRESH_MSG_ID, msg);
                        };
                    }
                    catch (Exception ex)
                    {
                        throw MB.Util.APPExceptionHandlerHelper.PromoteException(ex, " GetObjects 出错!");
                    }
                    return(lstDatas);
                }

                string[]  desc = _InvokeDataSourceDesc.Method.Split(',');
                ArrayList pars = new ArrayList();
                if (desc.Length > 1)
                {
                    string[] ss = desc[1].Split(';');
                    foreach (var s in ss)
                    {
                        //判断是否为
                        pars.Add(MB.WinBase.AppEnvironmentSetting.Instance.ConvertSystemParamValue(s));
                    }
                }
                if (filterParameters != null && filterParameters.Count > 0)
                {
                    pars.Add(filterParameters.ToArray());
                }
                else
                {
                    if (_InvokeDataSourceDesc.ExistsFilterParams)
                    {
                        //判断调用的方法是否存在过滤的参数,如果存在需要进行特殊的处理(默认情况下存在)
                        List <MB.Util.Model.QueryParameterInfo> filterParam = new List <MB.Util.Model.QueryParameterInfo>();
                        filterParam.Add(new MB.Util.Model.QueryParameterInfo("1", "1", MB.Util.DataFilterConditions.Special));
                        pars.Add(filterParam.ToArray());
                    }
                }
                //object val = MB.Util.MyReflection.Instance.InvokeMethod(_ClientRule, desc[0], pars.ToArray());
                // object val = MB.Util.MyReflection.Instance.InvokeMethodByName(_ClientRule, desc[0], pars.ToArray());
                object val = null;
                try
                {
                    using (MB.Util.MethodTraceWithTime timeTrack = new MB.Util.MethodTraceWithTime(null))
                    {
                        val = MB.Util.MyReflection.Instance.InvokeMethod(_ClientRule, desc[0], pars.ToArray());

                        var msg = string.Format("查询花费:{0} 毫秒,返回 {1} 记录", timeTrack.GetExecutedTimes(), (val as IList).Count);
                        MB.WinBase.AppMessenger.DefaultMessenger.Publish(QUERY_REFRESH_MSG_ID, msg);
                    };
                }
                catch (Exception ex)
                {
                    throw MB.Util.APPExceptionHandlerHelper.PromoteException(ex, desc[0] + " 出错!");
                }

                return(val as IList);
            }
            catch (Exception ex)
            {
                throw MB.Util.APPExceptionHandlerHelper.PromoteException(ex, "调用方法 MB.WinClientDefault.QueryFilter.FrmGetObjectDataAssistant::GetFilterObjects  获取数据有误");
            }
            return(null);
        }