啊鑫
2024-07-11 afbf8700d137710713db61955879d0f5acb73738
测试
已添加27个文件
已修改1个文件
3031 ■■■■■ 文件已修改
.gitignore 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/App.config 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/CSFramework.DBTester.csproj 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/Class1.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/Program.cs 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/Properties/AssemblyInfo.cs 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/Properties/Resources.Designer.cs 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/Properties/Resources.resx 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/Properties/Settings.Designer.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/Properties/Settings.settings 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/_TestDataUpdate.cs 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/frmSQLConcurrentTester.Designer.cs 248 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/frmSQLConcurrentTester.cs 332 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/frmSQLConcurrentTester.resx 169 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/frmTestDB.Designer.cs 470 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/frmTestDB.cs 737 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/frmTestDB.resx 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/logo.ico 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/sys_AdminUser.cs 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/sys_Log.cs 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBTester/sys_RegisterLog.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFramework.DB.Source/CSFramework.DBV2.0.sln 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFrameworkV5.Core/CSFrameworkV5.Core.Tester/App.config 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFrameworkV5.Core/CSFrameworkV5.Core.Tester/CSFrameworkV5.Core.Tester.csproj 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFrameworkV5.Core/CSFrameworkV5.Core.Tester/Program.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFrameworkV5.Core/CSFrameworkV5.Core.Tester/Properties/AssemblyInfo.cs 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFrameworkV5.Core/CSFrameworkV5.Core.Tester/Tester.cs 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CSFrameworkV5.Core/CSFrameworkV5.Core.sln 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -184,3 +184,4 @@
# Microsoft Fakes
FakesAssemblies/
/CSFrameworkV5.ClientFoundation/.idea/.idea.CSFrameworkV5-ClientFoundation/.idea
CSFramework.DB.Source/CSFramework.DBTester/App.config
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
  </startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.data>
    <DbProviderFactories>
      <add name="SqlClient Data Provider" invariant="System.Data.SqlClient" description=".Net Framework Data Provider for SqlServer"
      type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL"
      type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
      <add name="OracleClient Data Provider" invariant="System.Data.OracleClient" description=".Net Framework Data Provider for Oracle"
      type="System.Data.OracleClient.OracleClientFactory, System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
      <add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET"
      type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
      <remove invariant="Oracle.ManagedDataAccess.Client"/>
      <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver"
      type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
      <add name="OleDb Data Provider" invariant="System.Data.OleDb" description=".Net Framework Data Provider for OleDb"
      type="System.Data.OleDb.OleDbFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite"
      type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.58.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/>
    </DbProviderFactories>
  </system.data>
</configuration>
CSFramework.DB.Source/CSFramework.DBTester/CSFramework.DBTester.csproj
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{EBE7B1E8-6D76-43A2-A765-653847F0CC8B}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>CSFramework.DBTester</RootNamespace>
    <AssemblyName>CSFramework.DBTester</AssemblyName>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <TargetFrameworkProfile />
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>..\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <PropertyGroup>
    <ApplicationIcon>logo.ico</ApplicationIcon>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Deployment" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Class1.cs" />
    <Compile Include="frmSQLConcurrentTester.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="frmSQLConcurrentTester.Designer.cs">
      <DependentUpon>frmSQLConcurrentTester.cs</DependentUpon>
    </Compile>
    <Compile Include="frmTestDB.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="frmTestDB.Designer.cs">
      <DependentUpon>frmTestDB.cs</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="sys_AdminUser.cs" />
    <Compile Include="sys_Log.cs" />
    <Compile Include="sys_RegisterLog.cs" />
    <Compile Include="_TestDataUpdate.cs" />
    <EmbeddedResource Include="frmSQLConcurrentTester.resx">
      <DependentUpon>frmSQLConcurrentTester.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="frmTestDB.resx">
      <DependentUpon>frmTestDB.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Resources.resx</DependentUpon>
      <DesignTime>True</DesignTime>
    </Compile>
    <None Include="App.config" />
    <None Include="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
    <Compile Include="Properties\Settings.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <Content Include="logo.ico" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\CSFramework.DB\CSFramework.DB.csproj">
      <Project>{8ae59d09-994c-4e82-bec7-69c5977b659f}</Project>
      <Name>CSFramework.DB</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
CSFramework.DB.Source/CSFramework.DBTester/Class1.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CSFramework.DBTester
{
    class Class1
    {
    }
}
CSFramework.DB.Source/CSFramework.DBTester/Program.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,87 @@
using CSFramework.DB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace CSFramework.DBTester
{
    static class Program
    {
        /// <summary>
        /// åº”用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.ThreadException += Application_ThreadException;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            ////isid是自增字段
            //sys_Log log = new sys_Log
            //{
            //    DocNo = "doc0123412341234",
            //    GUID32 = "2345234523452435",
            //    LogDate = DateTime.Now,
            //    LogUser = "admin",
            //    OPType = 1,
            //};
            var conn = "Server=.;Database=CSFrameworkV5_Normal;User ID=sa;Password=test; Max Pool Size=512; Pooling=true;Connect Timeout=30";
            IDatabase db = DatabaseFactory.CreateSqlDatabase(conn);
            var list = db.meta_GetStoreProcList();
            return;
            ////实例化DbCommand生成器
            //DbCommandGenerator g = new DbCommandGenerator(db);
            ////测试案例1 - èŽ·å–æ ‡è¯†æœ‰ç‰¹æ€§(Attribute)的字段
            //var list = g.GetAttributeFields(typeof(sys_Log), typeof(KeyField));
            //var list2 = g.GetAttributeFields(typeof(sys_Log), typeof(IgnoreField));
            ////测试案例2
            //var m5 = g.GetTableName(typeof(sys_Log));
            //var m1 = g.GetDeleteCommand(typeof(sys_Log));
            //var m2 = g.GetDeleteCommand<sys_Log>(log);
            //var m3 = g.GetInsertCommand(typeof(sys_Log));
            //var m4 = g.GetInsertCommand<sys_Log>(log);
            //var m6 = g.GetUpdateCommand(typeof(sys_Log));
            //var m7 = g.GetUpdateCommand<sys_Log>(log);
            //new DbFramework(db).AddObject<sys_Log>(log, new string[] { "isid", "DocNo" });//旧的使用方法
            //new DbFramework(db).AddObject<sys_Log>(log, "isid", "DocNo"); //新方法:params å‚数形式
            //List<sys_Log> list2 = new DbFramework(db).Select<sys_Log>();//新增功能:返回所有对象
            //sys_Log one = new DbFramework(db).Select<sys_Log>("isid", 1);//新增功能:根据关键字返回一个对象
            //byte[] ts = new byte[] { 0, 0, 0, 0, 0, 20, 12, 229 };
            //var s = TimeStampTool.TimestampToString(ts);
            //var st = TimeStampTool.strToHexByte(s);
            //var d1 = TimeStampTool.FromBytes(ts);
            //long lo = Math.Abs(BitConverter.ToInt64(ts, 0));
            //var ss = TimeSpan.FromTicks(lo);
            //string sql = "select * from aaa汉字表";
            //if (sql.Substring(sql.Length - 1, 1) != ";") sql = sql + ";";
            Application.Run(new frmTestDB());
            //Application.Run(new frmSQLConcurrentTester());
        }
        private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            MessageBox.Show(e.Exception.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }
}
CSFramework.DB.Source/CSFramework.DBTester/Properties/AssemblyInfo.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// æœ‰å…³ç¨‹åºé›†çš„一般信息由以下
// æŽ§åˆ¶ã€‚更改这些特性值可修改
// ä¸Žç¨‹åºé›†å…³è”的信息。
[assembly: AssemblyTitle("CSFramework.DBTester")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("CSFramework.DBTester")]
[assembly: AssemblyCopyright("Copyright Â© Microsoft 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//将 ComVisible è®¾ç½®ä¸º false å°†ä½¿æ­¤ç¨‹åºé›†ä¸­çš„类型
//对 COM ç»„件不可见。  å¦‚果需要从 COM è®¿é—®æ­¤ç¨‹åºé›†ä¸­çš„类型,
//请将此类型的 ComVisible ç‰¹æ€§è®¾ç½®ä¸º true。
[assembly: ComVisible(false)]
// å¦‚果此项目向 COM å…¬å¼€ï¼Œåˆ™ä¸‹åˆ— GUID ç”¨äºŽç±»åž‹åº“çš„ ID
[assembly: Guid("ebe7b1e8-6d76-43a2-a765-653847f0cc8b")]
// ç¨‹åºé›†çš„版本信息由下列四个值组成:
//
//      ä¸»ç‰ˆæœ¬
//      æ¬¡ç‰ˆæœ¬
//      ç”Ÿæˆå·
//      ä¿®è®¢å·
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// æ–¹æ³•是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
CSFramework.DB.Source/CSFramework.DBTester/Properties/Resources.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
//     æ­¤ä»£ç ç”±å·¥å…·ç”Ÿæˆã€‚
//     è¿è¡Œæ—¶ç‰ˆæœ¬:4.0.30319.42000
//
//     å¯¹æ­¤æ–‡ä»¶çš„æ›´æ”¹å¯èƒ½ä¼šå¯¼è‡´ä¸æ­£ç¡®çš„行为,并且如果
//     é‡æ–°ç”Ÿæˆä»£ç ï¼Œè¿™äº›æ›´æ”¹å°†ä¼šä¸¢å¤±ã€‚
// </auto-generated>
//------------------------------------------------------------------------------
namespace CSFramework.DBTester.Properties {
    using System;
    /// <summary>
    ///   ä¸€ä¸ªå¼ºç±»åž‹çš„资源类,用于查找本地化的字符串等。
    /// </summary>
    // æ­¤ç±»æ˜¯ç”± StronglyTypedResourceBuilder
    // ç±»é€šè¿‡ç±»ä¼¼äºŽ ResGen æˆ– Visual Studio çš„工具自动生成的。
    // è‹¥è¦æ·»åŠ æˆ–ç§»é™¤æˆå‘˜ï¼Œè¯·ç¼–è¾‘ .ResX æ–‡ä»¶ï¼Œç„¶åŽé‡æ–°è¿è¡Œ ResGen
    // (以 /str ä½œä¸ºå‘½ä»¤é€‰é¡¹),或重新生成 VS é¡¹ç›®ã€‚
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class Resources {
        private static global::System.Resources.ResourceManager resourceMan;
        private static global::System.Globalization.CultureInfo resourceCulture;
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resources() {
        }
        /// <summary>
        ///   è¿”回此类使用的缓存的 ResourceManager å®žä¾‹ã€‚
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CSFramework.DBTester.Properties.Resources", typeof(Resources).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }
        /// <summary>
        ///   ä½¿ç”¨æ­¤å¼ºç±»åž‹èµ„源类,为所有资源查找
        ///   é‡å†™å½“前线程的 CurrentUICulture å±žæ€§ã€‚
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }
    }
}
CSFramework.DB.Source/CSFramework.DBTester/Properties/Resources.resx
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
    Version 2.0
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    Example:
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
</root>
CSFramework.DB.Source/CSFramework.DBTester/Properties/Settings.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
//     æ­¤ä»£ç ç”±å·¥å…·ç”Ÿæˆã€‚
//     è¿è¡Œæ—¶ç‰ˆæœ¬:4.0.30319.42000
//
//     å¯¹æ­¤æ–‡ä»¶çš„æ›´æ”¹å¯èƒ½ä¼šå¯¼è‡´ä¸æ­£ç¡®çš„行为,并且如果
//     é‡æ–°ç”Ÿæˆä»£ç ï¼Œè¿™äº›æ›´æ”¹å°†ä¼šä¸¢å¤±ã€‚
// </auto-generated>
//------------------------------------------------------------------------------
namespace CSFramework.DBTester.Properties {
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
        public static Settings Default {
            get {
                return defaultInstance;
            }
        }
    }
}
CSFramework.DB.Source/CSFramework.DBTester/Properties/Settings.settings
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
  <Profiles>
    <Profile Name="(Default)" />
  </Profiles>
  <Settings />
</SettingsFile>
CSFramework.DB.Source/CSFramework.DBTester/_TestDataUpdate.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
/*===================================================================
 *   ç¨‹åºè¯´æ˜Ž: tb__TestDataUpdate的ORM模型
 *   ä½œè€…资料: å­™ä¸­å•
 *   åˆ›å»ºæ—¥æœŸ: 2021-06-11 02:13:50
 *   æœ€åŽä¿®æ”¹: 2021-06-11 02:13:50
 *
 *   æ³¨: æœ¬æ–‡ä»¶ç”±ä»£ç ç”Ÿæˆå™¨(Code Generator)自动生成。
 *   (此源码文件请放置在 YourProject.Models æ¨¡å—) 
 *   ç‰ˆæƒæ‰€æœ‰ Copyright 2006~2021, C/S框架网(www.cscode.net)
 *===================================================================*/
namespace CSFramework.DBTester
{
    ///<summary>
    /// ORM模型, æ•°æ®è¡¨:_TestDataUpdate,由ClassGenerator自动生成
    /// </summary>
    public class _TestDataUpdate
    {
        #region æ‰€æœ‰å­—段属性
        public System.Int32 isid { get; set; }
        public System.Byte[] _Binary { get; set; }
        public System.DateTimeOffset _DateTimeOffset { get; set; }
        public System.Object _Sql_variant { get; set; }
        public System.String _Xml { get; set; }
        public System.Guid _UniqueIdentifier { get; set; }
        public System.String _Geometry { get; set; }
        public System.DateTime _Timestamp { get; set; }
        public System.Int32 _Int { get; set; }
        public System.Byte[] _Varbinary { get; set; }
        public System.Boolean _Bit { get; set; }
        public System.Char _Char { get; set; }
        public System.DateTime _Datetime2 { get; set; }
        public System.String _Geography { get; set; }
        public System.String _Hierarchyid { get; set; }
        public System.Byte[] _Image { get; set; }
        public System.String _Ntext { get; set; }
        #endregion
    }
    /// <summary>
    /// mysql测试
    /// </summary>
    public class _testdataupdate
    {
        #region æ‰€æœ‰å­—段属性
        public System.Int32 isid { get; set; }
        public System.Byte[] _BinaryCHAR { get; set; }
        public System.Object _Sql_variant { get; set; }
        public System.String _Json { get; set; }
        public System.String _UniqueIdentifier { get; set; }
        public System.String _Geometry { get; set; }
        public System.DateTime _Timestamp { get; set; }
        public System.Int32 _Int { get; set; }
        public System.Byte[] _Varbinary { get; set; }
        public System.Boolean _Bit { get; set; }
        public System.Char _Char { get; set; }
        public System.DateTime _Datetime { get; set; }
        public System.String _Geography { get; set; }
        public System.String _Hierarchyid { get; set; }
        public System.Byte[] _Image { get; set; }
        public System.String _Ntext { get; set; }
        #endregion
    }
}
CSFramework.DB.Source/CSFramework.DBTester/frmSQLConcurrentTester.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,248 @@
namespace CSFramework.DBTester
{
    partial class frmSQLConcurrentTester
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmSQLConcurrentTester));
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.rbConnLocal = new System.Windows.Forms.RadioButton();
            this.radioButton2 = new System.Windows.Forms.RadioButton();
            this.chkPooling = new System.Windows.Forms.RadioButton();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.pb = new System.Windows.Forms.ProgressBar();
            this.lblTime = new System.Windows.Forms.Label();
            this.btnTest = new System.Windows.Forms.Button();
            this.label4 = new System.Windows.Forms.Label();
            this.txtResult = new System.Windows.Forms.TextBox();
            this.lblProgress = new System.Windows.Forms.Label();
            this.txtConns = new System.Windows.Forms.TextBox();
            this.txtThreads = new System.Windows.Forms.TextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.txtRunThreads = new System.Windows.Forms.TextBox();
            this.groupBox1.SuspendLayout();
            this.SuspendLayout();
            //
            // groupBox1
            //
            this.groupBox1.Controls.Add(this.chkPooling);
            this.groupBox1.Controls.Add(this.radioButton2);
            this.groupBox1.Controls.Add(this.rbConnLocal);
            this.groupBox1.Location = new System.Drawing.Point(12, 3);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(635, 63);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            //
            // rbConnLocal
            //
            this.rbConnLocal.AutoSize = true;
            this.rbConnLocal.Checked = true;
            this.rbConnLocal.Location = new System.Drawing.Point(18, 26);
            this.rbConnLocal.Name = "rbConnLocal";
            this.rbConnLocal.Size = new System.Drawing.Size(83, 16);
            this.rbConnLocal.TabIndex = 0;
            this.rbConnLocal.TabStop = true;
            this.rbConnLocal.Text = "本地数据库";
            this.rbConnLocal.UseVisualStyleBackColor = true;
            //
            // radioButton2
            //
            this.radioButton2.AutoSize = true;
            this.radioButton2.Location = new System.Drawing.Point(142, 26);
            this.radioButton2.Name = "radioButton2";
            this.radioButton2.Size = new System.Drawing.Size(113, 16);
            this.radioButton2.TabIndex = 1;
            this.radioButton2.Text = "阿里云ECS服务器";
            this.radioButton2.UseVisualStyleBackColor = true;
            //
            // chkPooling
            //
            this.chkPooling.AutoSize = true;
            this.chkPooling.Location = new System.Drawing.Point(281, 26);
            this.chkPooling.Name = "chkPooling";
            this.chkPooling.Size = new System.Drawing.Size(179, 16);
            this.chkPooling.TabIndex = 1;
            this.chkPooling.Text = "启用连接池(Pooling=True)";
            this.chkPooling.UseVisualStyleBackColor = true;
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(69, 79);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(83, 12);
            this.label1.TabIndex = 1;
            this.label1.Text = "SQL连接数据:";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(15, 105);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(137, 12);
            this.label2.TabIndex = 1;
            this.label2.Text = "模拟用户端(线程)数:";
            //
            // pb
            //
            this.pb.Location = new System.Drawing.Point(227, 74);
            this.pb.Name = "pb";
            this.pb.Size = new System.Drawing.Size(420, 49);
            this.pb.TabIndex = 2;
            //
            // lblTime
            //
            this.lblTime.AutoSize = true;
            this.lblTime.Location = new System.Drawing.Point(152, 415);
            this.lblTime.Name = "lblTime";
            this.lblTime.Size = new System.Drawing.Size(41, 12);
            this.lblTime.TabIndex = 1;
            this.lblTime.Text = "用时:";
            //
            // btnTest
            //
            this.btnTest.Image = ((System.Drawing.Image)(resources.GetObject("btnTest.Image")));
            this.btnTest.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.btnTest.Location = new System.Drawing.Point(227, 129);
            this.btnTest.Name = "btnTest";
            this.btnTest.Size = new System.Drawing.Size(119, 43);
            this.btnTest.TabIndex = 3;
            this.btnTest.Text = "    å¼€å§‹æµ‹è¯•";
            this.btnTest.UseVisualStyleBackColor = true;
            this.btnTest.Click += new System.EventHandler(this.btnTest_Click);
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(83, 181);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(65, 12);
            this.label4.TabIndex = 1;
            this.label4.Text = "线程信息:";
            //
            // txtResult
            //
            this.txtResult.Location = new System.Drawing.Point(154, 178);
            this.txtResult.Multiline = true;
            this.txtResult.Name = "txtResult";
            this.txtResult.ReadOnly = true;
            this.txtResult.Size = new System.Drawing.Size(493, 226);
            this.txtResult.TabIndex = 4;
            //
            // lblProgress
            //
            this.lblProgress.AutoSize = true;
            this.lblProgress.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.lblProgress.Location = new System.Drawing.Point(566, 129);
            this.lblProgress.Name = "lblProgress";
            this.lblProgress.Size = new System.Drawing.Size(28, 14);
            this.lblProgress.TabIndex = 1;
            this.lblProgress.Text = "0/0";
            //
            // txtConns
            //
            this.txtConns.Location = new System.Drawing.Point(154, 74);
            this.txtConns.Name = "txtConns";
            this.txtConns.Size = new System.Drawing.Size(67, 21);
            this.txtConns.TabIndex = 5;
            this.txtConns.Text = "10000";
            //
            // txtThreads
            //
            this.txtThreads.Location = new System.Drawing.Point(154, 102);
            this.txtThreads.Name = "txtThreads";
            this.txtThreads.Size = new System.Drawing.Size(67, 21);
            this.txtThreads.TabIndex = 5;
            this.txtThreads.Text = "150";
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(75, 132);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(77, 12);
            this.label3.TabIndex = 1;
            this.label3.Text = "已启动线程:";
            //
            // txtRunThreads
            //
            this.txtRunThreads.Location = new System.Drawing.Point(154, 129);
            this.txtRunThreads.Name = "txtRunThreads";
            this.txtRunThreads.ReadOnly = true;
            this.txtRunThreads.Size = new System.Drawing.Size(67, 21);
            this.txtRunThreads.TabIndex = 5;
            this.txtRunThreads.Text = "0";
            //
            // frmSQLConcurrentTester
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(699, 446);
            this.Controls.Add(this.txtRunThreads);
            this.Controls.Add(this.txtThreads);
            this.Controls.Add(this.txtConns);
            this.Controls.Add(this.txtResult);
            this.Controls.Add(this.btnTest);
            this.Controls.Add(this.pb);
            this.Controls.Add(this.lblProgress);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.lblTime);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.groupBox1);
            this.Name = "frmSQLConcurrentTester";
            this.Text = "C/S架构快速开发框架SQL并发测试压力测试(2021版)";
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();
        }
        #endregion
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.RadioButton chkPooling;
        private System.Windows.Forms.RadioButton radioButton2;
        private System.Windows.Forms.RadioButton rbConnLocal;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.ProgressBar pb;
        private System.Windows.Forms.Label lblTime;
        private System.Windows.Forms.Button btnTest;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.TextBox txtResult;
        private System.Windows.Forms.Label lblProgress;
        private System.Windows.Forms.TextBox txtConns;
        private System.Windows.Forms.TextBox txtThreads;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.TextBox txtRunThreads;
    }
}
CSFramework.DB.Source/CSFramework.DBTester/frmSQLConcurrentTester.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,332 @@
using CSFramework.DB;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CSFramework.DBTester
{
    /// <summary>
    /// C/S框架网,CSFramework.DB,C/S框架数据库并发测试
    /// </summary>
    public partial class frmSQLConcurrentTester : Form
    {
        static object _threadCount = 0;//线程数量
        static object _connCount = 0;//已建立的SQL连接数
        static List<object> _threadList = new List<object>();//线程数量
        static DateTime _startTime = DateTime.Now;
        static List<String> _DocNos = new List<string>();//本次测试生成的单据号码
        static object _ThreadFinish = 0;
        static object _Rows_Inserted = 0;
        static object _Rows_Updated = 0;
        static object _Rows_Deleted = 0;
        static object _Failed = 0;
        public frmSQLConcurrentTester()
        {
            InitializeComponent();
        }
        private void btnTest_Click(object sender, EventArgs e)
        {
            txtResult.Text = "";
            OnResult("开始测试...");
            btnTest.Enabled = false;
            _connCount = 0;
            _threadCount = 0;
            _Failed = 0;
            _ThreadFinish = 0;
            _Rows_Inserted = 0;
            _Rows_Updated = 0;
            _Rows_Deleted = 0;
            _startTime = DateTime.Now;
            _DocNos.Clear();
            //初始化进度条
            this.DoPrepareProgress();
            //启动多线程
            int t = int.Parse(txtThreads.Text);
            int count = 1;
            while (count <= t)
            {
                Task.Run(() => { DoThread(); });
                Application.DoEvents();
                count++;
            }
            //等待全部线程完成处理
            Thread.Sleep(1000); //必须等待第1个线程
            WaitThreads();
            OnResult($"本次测试用户数据, Insert={_Rows_Inserted},Update={_Rows_Updated},Delete={_Rows_Deleted},失败数={_Failed}");
            OnResult("测试结束...");
            TimeSpan ts = DateTime.Now - _startTime;
            lblTime.Text = "用时:" + ts.TotalSeconds.ToString() + "秒.";
            btnTest.Enabled = true;
            btnTest.Invalidate();
            GC.Collect();//回收垃圾
        }
        /// <summary>
        /// ç­‰å¾…线程
        /// </summary>
        private void WaitThreads()
        {
            while (int.Parse(_ThreadFinish.ToString()) < int.Parse(txtThreads.Text))
            {
                //处理线程....
                Application.DoEvents();
            }
        }
        /// <summary>
        /// å¯åŠ¨ä¸€ä¸ªçº¿ç¨‹
        /// </summary>
        private void DoThread()
        {
            try
            {
                //线程任务计数器
                lock (_threadCount)
                {
                    _threadCount = int.Parse(_threadCount.ToString()) + 1;
                }
                int currentID = int.Parse(_threadCount.ToString());
                if (currentID > int.Parse(txtThreads.Text)) return;
                lock (_threadList) _threadList.Add(currentID);
                this.Invoke(new SyncCall(this.OnResult), new object[] { "开始线程:" + currentID.ToString() });
                string connStr = "";
                //本地连接
                if (rbConnLocal.Checked)
                    connStr = "Server =.; Database = CSFrameworkV5_Normal; User ID = sa; Password = test;";
                else//远程连接
                    connStr = "Server =120.77.22.34; Database = CSFrameworkV5_Normal; User ID = sa; Password = test;";
                //启动线程池
                if (chkPooling.Checked)
                    connStr = connStr + "pooling = true; connection lifetime = 0; min pool size = 1; max pool size = 32767";
                else
                    connStr = connStr + "pooling = false; ";
                string SQL = "INSERT INTO tb_QO(QONO,DocDate,CustomerCode,RefPONO,Currency,Sales,CreationDate,CreatedBy,LastUpdateDate,LastUpdatedBy)" +
                             "VALUES(@QONO, @DocDate, @CustomerCode, @RefPONO, @Currency, @Sales, @CreationDate, @CreatedBy, @LastUpdateDate, @LastUpdatedBy)";
                string SQL1 = "UPDATE tb_QO SET Client=@Client,Remark=@Remark,LastUpdateDate=@LastUpdateDate WHERE QONO=@QONO";
                string SQL2 = "DELETE tb_QO WHERE QONO=@QONO";
                int sub_total = 0;
                int go = 0;
                CommandHelper cmd = null;
                while (int.Parse(_connCount.ToString()) < int.Parse(txtConns.Text))
                {
                    //锁定连接数计时器+1
                    lock (_connCount)
                    {
                        _connCount = int.Parse(_connCount.ToString()) + 1;
                        if (int.Parse(_connCount.ToString()) > int.Parse(txtConns.Text))
                            break;
                    }
                    IDatabase db = DatabaseFactory.CreateDatabase(DatabaseType.SqlServer, connStr);
                    //抽签,go<=10,模拟1个用户新增一条数据
                    //     go>10<=20,模拟1个用户随机更新一条数据
                    //     go>=20,模拟1个用户随机删除一条数据
                    Thread.Sleep(100);
                    go = new Random().Next(1, 30);
                    //新增记录
                    if (go <= 10 || _DocNos.Count < 1)
                    {
                        cmd = db.CreateCommand(SQL);
                        cmd.AddParam("@QONO", GetDocNo());
                        cmd.AddParam("@DocDate", DateTime.Now);
                        cmd.AddParam("@CustomerCode", DateTime.Now.ToString("yyyyMMddHHmmssfff"));
                        cmd.AddParam("@RefPONO", DateTime.Now.ToString("yyyyMMddHHmmssfff"));
                        cmd.AddParam("@Currency", "RMB");
                        cmd.AddParam("@Sales", "admin");
                        cmd.AddParam("@CreationDate", DateTime.Now);
                        cmd.AddParam("@CreatedBy", "admin");
                        cmd.AddParam("@LastUpdatedBy", "admin");
                        cmd.AddParam("@LastUpdateDate", DateTime.Now);
                        int i = db.ExecuteCommand(cmd.Command);
                        if (i > 0)
                        {
                            //执行命令:处理的记录数
                            lock (_Rows_Inserted)
                            {
                                _Rows_Inserted = int.Parse(_Rows_Inserted.ToString()) + 1;
                            }
                        }
                    }
                    //修改记录
                    if (go > 10 && go <= 20)
                    {
                        cmd = db.CreateCommand(SQL1);
                        cmd.AddParam("@QONO", GetDocNoExists());
                        cmd.AddParam("@Client", "csframework.com");
                        cmd.AddParam("@Remark", "用户更新了数据");
                        cmd.AddParam("@LastUpdateDate", DateTime.Now);
                        int i = db.ExecuteCommand(cmd.Command);
                        //执行命令:处理的记录数
                        lock (_Rows_Updated)
                        {
                            _Rows_Updated = int.Parse(_Rows_Updated.ToString()) + 1;
                        }
                    }
                    //删除记录
                    if (go > 20 && go <= 30)
                    {
                        cmd = db.CreateCommand(SQL2);
                        cmd.AddParam("@QONO", GetDocNoExists());
                        //执行命令:处理的记录数
                        int i = db.ExecuteCommand(cmd.Command);
                        lock (_Rows_Deleted)
                        {
                            _Rows_Deleted = int.Parse(_Rows_Deleted.ToString()) + 1;//仅统计删除成功的记录
                        }
                    }
                    sub_total++;
                    if (cmd != null) cmd.Command.Dispose();
                    db = null;
                    //通知处理1次
                    this.Invoke(new SyncCall(this.OnProgress), new object[] { 1 });
                }
                lock (_threadList) _threadList.Remove(currentID);
                lock (_ThreadFinish) _ThreadFinish = int.Parse(_ThreadFinish.ToString()) + 1;
                //通知事件:线程处理完成
                this.Invoke(new SyncCall(this.OnResult), new object[] { $"线程<{currentID}>结束,共处理:{sub_total}个SQL连接!" });
                Application.DoEvents();
            }
            catch (Exception ex)
            {
                this.Invoke(new SyncCall(this.OnResult), new object[] { "错误:" + ex.Message });
                lock (_ThreadFinish) _ThreadFinish = int.Parse(_ThreadFinish.ToString()) + 1;
                lock (_Failed) _Failed = int.Parse(_Failed.ToString()) + 1;
            }
        }
        private string GetDocNoExists()
        {
            lock (_DocNos)
            {
                int i = new Random().Next(1, _DocNos.Count);
                return _DocNos[i - 1];
            }
        }
        /// <summary>
        /// åˆå§‹åŒ–进度条
        /// </summary>
        private void DoPrepareProgress()
        {
            lblProgress.Text = "0/0";
            pb.Minimum = 0;
            pb.Maximum = int.Parse(txtConns.Text);
            pb.Value = 0;
        }
        /// <summary>
        /// èŽ·å–å•æ®å·ç 
        /// </summary>
        /// <returns></returns>
        private string GetDocNo()
        {
            Thread.Sleep(5);
            var docNo = DateTime.Now.ToString("yyyyMMddHHmmssfff") + Guid.NewGuid().ToString().ToLower().Replace("-", "").Substring(0, 10);
            lock (_DocNos)
            {
                _DocNos.Add(docNo);
            }
            return docNo;
        }
        /// <summary>
        /// æ˜¾ç¤ºç»“果信息
        /// </summary>
        /// <param name="value"></param>
        private void OnResult(object value)
        {
            string text = value.ToString();
            txtResult.AppendText(text + "\r\n");
            txtResult.ScrollToCaret();
            if (text.IndexOf("开始线程") >= 0)
                txtRunThreads.Text = _threadCount.ToString();
        }
        /// <summary>
        /// æ›´æ–°è¿›åº¦æ¡
        /// </summary>
        /// <param name="value"></param>
        private void OnProgress(object value)
        {
            if (pb.Value + 1 <= pb.Maximum)
            {
                pb.Value++;
                lblProgress.Text = pb.Value.ToString() + "/" + pb.Maximum.ToString();
                TimeSpan ts = DateTime.Now - _startTime;
                lblTime.Text = "用时:" + ts.TotalSeconds.ToString() + "秒.";
            }
            else
            {
            }
        }
    }
    /// <summary>
    /// å¼‚步调用过程
    /// </summary>
    /// <param name="value"></param>
    public delegate void SyncCall(object value);
}
CSFramework.DB.Source/CSFramework.DBTester/frmSQLConcurrentTester.resx
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,169 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
    Version 2.0
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    Example:
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  <data name="btnTest.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
    <value>
        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
        YQUAAAARdEVYdFRpdGxlAEJ1ZztSZXBvcnQ7sbAXPQAACbNJREFUWEfFV2lQVFcWfiCiSJQYkDWpmYwK
        9ArddDdNNw10g80WEFHZREChZZMtgCgCIiBhl5ZFRZElGJMYo8RCR0xcMJrEWHGcTBwTjYlxNJPFZGZ+
        TNWkkvrm3Ed0ujMVxn9zqj4e575zz/fd0/ee280B+L/C2pnBlEERINQHBBq8yLUh2FpC7K/1Evtp6oUS
        9cyJyKw4LZ2sDk8uvkjICeWx/wWF2iBSqMOZgAbKYU+YQ5j7M+aIpOoGgThwu48gQEy+zS/nR5l8aHja
        LDmtnMw2d677YC7nI1FxGuNaLiRmPaeP38DmsFXaSWS6QKki4r5AFnNGKIu5SYnBngJZ9FmBVHf/d0v9
        NBTHxM0i2ITGrue0xgw+36rNbjQ0bZacVk5Gizu3+/UCLi41kpMHx7PYh6W295ZErCTCb5ShyViWmI/Y
        tOexMrsaz6WV8b4yNAVCecy3S0T6ZIqfR7Bj8+XBy7mYJAO3umYhudNmyWnlpDe7cf1HCrjtfZks7hG5
        r39UpzRwOcJX5CEuvRzZFZ2oaB7Ctu7D9Bzm/bg15Yig9yzOR2rsonlPEGazPFs6k7hVWx5DwJomV67/
        tQKqQj6Lmyb3i9zhp16BZSsLEJ1SgrwtvahsHkNp4yg21g+htGmERIyhqG4AsamliKA4Fu8tXdZG85kI
        vhKJVY8hIK3BlTMajTZSpWb2U66u9iKVNl6sjIM+3kQCCrGurB2FdfuRW70XeVsHHoH5+TX7+PdMaBjF
        s3k+MlWSi7v7AqG/0pHysn3BmyWnlZNav4iTSNR22tDYf2kM+uIV5V635Zow6KIzEJ1cguyqPqyv6EH2
        pj6YNvXDVLUbOVX9yCF/XUUv/d+HmORS6KIyINOEIjrP/Y4yOLhapTX+oFSGOwRqjDMLSNrmwvn4qWap
        dVE5xlT5jxu7JOg+lAWNIRRG+nzXFncis3Qnssq6kVVufoTM57uRUdpF77v4uCB9CDoPpsG0wwf6lZIf
        6eiWLBEHzFVpls0sYHWNM3s/a6Gz+/zETS7fNI5Gwjy+HEferkBty2Z+ZWyFq0z1SM7bgfSidqTkNWN1
        znbaH9Mrr23ZhMNvl6D3eAK2DeoRW+D0YKGLh4ejoyM7nmxjW3FaO9MBdlG5TpGZDb/B9lE9usdjMXI+
        HVfvDOPKx6/BPNCGrPwiJKTlQG1YjRX0zCTfPNCKKzcP49oXwxi7kIHeiTg0jhmQssUD6kSHBMrrQGAb
        25rTypkWYB9b/GTDxk4p6kaCsPN4NIbOp+Dd22ZcuzeEm18fw53vT+Pe3y9ic58Bf/3HJXzxt0nc+vYo
        /nSfRH7Wi4MX09H/exJwUIecJm+ErXVopbzzCXyDsuK0cqYVOsSVOk2WmGWoHVWTACMJWIWpT5px5U4v
        /nh/ENe/GsPNb19H05gRt78bx8ffHMRHXw7h6t1+XPq0BWMXk9F3MoYEaFHYIUb4OocpysvOIX8krTit
        nGkBjnGl82+VdEtQO6xE53E9Bs8tx+RHVXjnszZ8cNeMP9zfg+tfj2DXGwm4QeQffrmXxnpw+U473rpR
        jdG3V6D3RAQJUKNoJwlYP+cvlNeFwDcmK05Lx9PTc7aLu6dzbPETDwo7Bage8UP7eDD2nInC0as5OPdJ
        DS591oj37pCQez0YOpdKFdmD9++2473Pm3HhVi2OX9uAA1OxME+Eof7FABR1C0mA/T8p72LKz1r0rwug
        4/JsoDYSsRvno6BLgKpBMZqPqNAzqcfIpeU4db0UZz7ehKlPt+Kdz5uwezIel79ow4XbdTh3swpv3ijD
        ofcSsffMMnSMa7CVFlC8SwTDOnvIVXqI/TW+/7sCHl6LogvmPcht9UHFPhHqX5Gh60QQ9p414PCVFEx8
        lItTfy7EuVsV2PlGBImpxuSNIpy8no8jH6Ri8IIRvZMhaHpNgS0HpLQQIcIy7KgCXkvd3NwcZxRAxnbp
        AuMGh083tAhQuluI2kN+eOFYAHad1mBgKgwvX0nEsWsZJMSE5le1RF6I8Q8zcfhqEg5cjED/GR06JpRo
        eEWOygEJ8lqE0K2ZdY/ysvuY7wVWnFbOtIAnwtfPPWvaIUJRjy+qRyVoPOKPjhNK7HqTKjGlw/C7kXj1
        ajJqR2Q4ei0dL16Oxv4Loeg/q0X3qUC0jCtQe9APpX0CZG/3hTbJ9iLlXUSYeROSsVMwLyTNvnVtzWLk
        dXqjclBIH4MfWt4IQNcp2g9n1Og/r8bgRQMKzL/lxeye0qDvXBDMbwbS6lVUfhk2D0tQ0O2LtKpnoXzO
        1kx5H/sYzlU8Nzt+eZELctsEKO73QfWLYjRQFVonmAglzG+psGcqFKaOZ0hIBHaRKPNpFTpOKrDjqBx1
        L0lRRh9ffocQMaYnIdLZpFBedjXzN6IVp5VD6ljPdn3a7enQ9LkPcpulVIWlKN8voL0gQdPrMrRMyNFx
        KgA9b2mR1eyFPecNJEqBthMBaD4mx7ZXpKg8IKLVeyOvWYKgVbO/d/FwFcyZM4e14pnvAkOWHcduLX9l
        aJk62vunlWWe2NAmRMGupagcIhEvS6gSfmg+TifjpBpr6j3QczoULxyXo+moP09eNSLCxh4fWr0ICUXu
        UIQ/+xMdvxq6ZVkFZhYQljGLk8l0jgEq/Q9+ysD6kDTbLzc0SZHd6o3CXm9UHBCg5iUR6kjIDtpoq6td
        0T6h4YlrDol5kUV9PjC1ecPUKIV6JfeVSCZvl8qCf1Ao9E4Sfy3jt+K0ckLSbTmFQmEnCVDPd/F4xtl/
        mW1GxLp52NiuQHbLUuSbl6JsgPrDsAB1h/yRUO6CxsNKVA4LadyXr1QOiS2ieEPGXAhDbPKd3bw8RTKV
        s0ajYUeQN0tOK0eXxt+WrEz8rUh4ShVn0x+ZswDFnWrktPgip2MJCVmC5wfEiC5ciM0HZLwwE42bWn1R
        QnHG9fMhj+b20Xx3AvvdwBLz5WdmyWnlBKfacuUdMSyGBfMngrBIFW8zYshwQG6THMU7VbRK2hed7JJx
        QjHdmqZWET/O3odTXEAsN0rzPAms9/PkmiT6+7NZclo56kSOK2uN5krbolicpQgXsYErCFrNfReb64x1
        28S00mAYs11R2R3G+2xcs4r7XhTKFVM8Wzkj5+9/U30w91gCBDqOK22J4kpeiORKWvgvkEwES8J+hj3p
        5MotlkZwWwJXcJdpg93VJnEIomdgAve+NJzbusCF86a4pwhM9DT5tmAup1b7eALcF3McJX2EnycxEQys
        i7Gz7ERgbZWV+GkC+7HK+jzrdGzVrN3yZX+Y42G+h2bJae3MbJZCGAmrykOwDcvGrTbbr9l/OMH9Gxl0
        JhVMD8wrAAAAAElFTkSuQmCC
</value>
  </data>
</root>
CSFramework.DB.Source/CSFramework.DBTester/frmTestDB.Designer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,470 @@
namespace CSFramework.DBTester
{
    partial class frmTestDB
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.dataGridView1 = new System.Windows.Forms.DataGridView();
            this.button1 = new System.Windows.Forms.Button();
            this.button2 = new System.Windows.Forms.Button();
            this.txtResult = new System.Windows.Forms.TextBox();
            this.button3 = new System.Windows.Forms.Button();
            this.button4 = new System.Windows.Forms.Button();
            this.button5 = new System.Windows.Forms.Button();
            this.button6 = new System.Windows.Forms.Button();
            this.button7 = new System.Windows.Forms.Button();
            this.button8 = new System.Windows.Forms.Button();
            this.button9 = new System.Windows.Forms.Button();
            this.button10 = new System.Windows.Forms.Button();
            this.button11 = new System.Windows.Forms.Button();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.button13 = new System.Windows.Forms.Button();
            this.button19 = new System.Windows.Forms.Button();
            this.button18 = new System.Windows.Forms.Button();
            this.button17 = new System.Windows.Forms.Button();
            this.button14 = new System.Windows.Forms.Button();
            this.button12 = new System.Windows.Forms.Button();
            this.txtConn = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.button16 = new System.Windows.Forms.Button();
            this.button15 = new System.Windows.Forms.Button();
            this.btnMSSQL = new System.Windows.Forms.Button();
            this.btnMySql = new System.Windows.Forms.Button();
            this.button20 = new System.Windows.Forms.Button();
            this.button21 = new System.Windows.Forms.Button();
            this.button22 = new System.Windows.Forms.Button();
            this.button23 = new System.Windows.Forms.Button();
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
            this.groupBox1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.SuspendLayout();
            //
            // dataGridView1
            //
            this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dataGridView1.Location = new System.Drawing.Point(15, 504);
            this.dataGridView1.Name = "dataGridView1";
            this.dataGridView1.Size = new System.Drawing.Size(543, 165);
            this.dataGridView1.TabIndex = 0;
            //
            // button1
            //
            this.button1.Location = new System.Drawing.Point(10, 20);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(103, 41);
            this.button1.TabIndex = 1;
            this.button1.Text = "IDatabase";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            //
            // button2
            //
            this.button2.Location = new System.Drawing.Point(254, 20);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(222, 41);
            this.button2.TabIndex = 1;
            this.button2.Text = "DataProviderFactory.GetFactory";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.button2_Click);
            //
            // txtResult
            //
            this.txtResult.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
            this.txtResult.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.txtResult.Location = new System.Drawing.Point(564, 265);
            this.txtResult.Multiline = true;
            this.txtResult.Name = "txtResult";
            this.txtResult.ReadOnly = true;
            this.txtResult.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
            this.txtResult.Size = new System.Drawing.Size(332, 404);
            this.txtResult.TabIndex = 2;
            //
            // button3
            //
            this.button3.Location = new System.Drawing.Point(119, 20);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(129, 41);
            this.button3.TabIndex = 3;
            this.button3.Text = "CreateDatabase";
            this.button3.UseVisualStyleBackColor = true;
            this.button3.Click += new System.EventHandler(this.button3_Click);
            //
            // button4
            //
            this.button4.Location = new System.Drawing.Point(10, 65);
            this.button4.Name = "button4";
            this.button4.Size = new System.Drawing.Size(103, 41);
            this.button4.TabIndex = 1;
            this.button4.Text = "GetTable";
            this.button4.UseVisualStyleBackColor = true;
            this.button4.Click += new System.EventHandler(this.button4_Click);
            //
            // button5
            //
            this.button5.Location = new System.Drawing.Point(119, 65);
            this.button5.Name = "button5";
            this.button5.Size = new System.Drawing.Size(129, 41);
            this.button5.TabIndex = 1;
            this.button5.Text = "SetTimeOut";
            this.button5.UseVisualStyleBackColor = true;
            this.button5.Click += new System.EventHandler(this.button5_Click);
            //
            // button6
            //
            this.button6.Location = new System.Drawing.Point(6, 33);
            this.button6.Name = "button6";
            this.button6.Size = new System.Drawing.Size(176, 41);
            this.button6.TabIndex = 3;
            this.button6.Text = "DbCommandGenerator-提交DataTable";
            this.button6.UseVisualStyleBackColor = true;
            this.button6.Click += new System.EventHandler(this.button6_Click);
            //
            // button7
            //
            this.button7.Location = new System.Drawing.Point(6, 80);
            this.button7.Name = "button7";
            this.button7.Size = new System.Drawing.Size(176, 41);
            this.button7.TabIndex = 3;
            this.button7.Text = "DbCommandGenerator-提交DataSet(事务)";
            this.button7.UseVisualStyleBackColor = true;
            this.button7.Click += new System.EventHandler(this.button7_Click);
            //
            // button8
            //
            this.button8.Location = new System.Drawing.Point(6, 127);
            this.button8.Name = "button8";
            this.button8.Size = new System.Drawing.Size(176, 41);
            this.button8.TabIndex = 3;
            this.button8.Text = "DbFramework.Add";
            this.button8.UseVisualStyleBackColor = true;
            this.button8.Click += new System.EventHandler(this.button8_Click);
            //
            // button9
            //
            this.button9.Location = new System.Drawing.Point(207, 33);
            this.button9.Name = "button9";
            this.button9.Size = new System.Drawing.Size(166, 41);
            this.button9.TabIndex = 3;
            this.button9.Text = "DbFramework.Update";
            this.button9.UseVisualStyleBackColor = true;
            this.button9.Click += new System.EventHandler(this.button9_Click);
            //
            // button10
            //
            this.button10.Location = new System.Drawing.Point(207, 127);
            this.button10.Name = "button10";
            this.button10.Size = new System.Drawing.Size(166, 41);
            this.button10.TabIndex = 3;
            this.button10.Text = "DbFramework.Delete";
            this.button10.UseVisualStyleBackColor = true;
            this.button10.Click += new System.EventHandler(this.button10_Click);
            //
            // button11
            //
            this.button11.Location = new System.Drawing.Point(207, 80);
            this.button11.Name = "button11";
            this.button11.Size = new System.Drawing.Size(166, 41);
            this.button11.TabIndex = 3;
            this.button11.Text = "DbFramework.UpdateList";
            this.button11.UseVisualStyleBackColor = true;
            this.button11.Click += new System.EventHandler(this.button11_Click);
            this.button11.ChangeUICues += new System.Windows.Forms.UICuesEventHandler(this.button11_ChangeUICues);
            //
            // groupBox1
            //
            this.groupBox1.Controls.Add(this.button6);
            this.groupBox1.Controls.Add(this.button7);
            this.groupBox1.Controls.Add(this.button13);
            this.groupBox1.Controls.Add(this.button19);
            this.groupBox1.Controls.Add(this.button8);
            this.groupBox1.Controls.Add(this.button18);
            this.groupBox1.Controls.Add(this.button17);
            this.groupBox1.Controls.Add(this.button14);
            this.groupBox1.Controls.Add(this.button9);
            this.groupBox1.Controls.Add(this.button10);
            this.groupBox1.Controls.Add(this.button12);
            this.groupBox1.Controls.Add(this.button11);
            this.groupBox1.Location = new System.Drawing.Point(14, 233);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(544, 265);
            this.groupBox1.TabIndex = 4;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "(MSSQL) DbCommandGenerator/DbFramework测试";
            //
            // button13
            //
            this.button13.Location = new System.Drawing.Point(6, 218);
            this.button13.Name = "button13";
            this.button13.Size = new System.Drawing.Size(176, 41);
            this.button13.TabIndex = 3;
            this.button13.Text = "DbFramework.AddList\r\n (事务)";
            this.button13.UseVisualStyleBackColor = true;
            this.button13.Click += new System.EventHandler(this.button13_Click);
            //
            // button19
            //
            this.button19.Location = new System.Drawing.Point(6, 171);
            this.button19.Name = "button19";
            this.button19.Size = new System.Drawing.Size(176, 41);
            this.button19.TabIndex = 3;
            this.button19.Text = "DbFramework.Add-Update";
            this.button19.UseVisualStyleBackColor = true;
            this.button19.Click += new System.EventHandler(this.button19_Click);
            //
            // button18
            //
            this.button18.Location = new System.Drawing.Point(378, 127);
            this.button18.Name = "button18";
            this.button18.Size = new System.Drawing.Size(159, 41);
            this.button18.TabIndex = 3;
            this.button18.Text = "mysql - æµ‹è¯•Timestamp主键并发";
            this.button18.UseVisualStyleBackColor = true;
            this.button18.Click += new System.EventHandler(this.button18_Click);
            //
            // button17
            //
            this.button17.Location = new System.Drawing.Point(378, 80);
            this.button17.Name = "button17";
            this.button17.Size = new System.Drawing.Size(159, 41);
            this.button17.TabIndex = 3;
            this.button17.Text = "mysql - DbFramework测试特殊数据类型";
            this.button17.UseVisualStyleBackColor = true;
            this.button17.Click += new System.EventHandler(this.button17_Click);
            //
            // button14
            //
            this.button14.Location = new System.Drawing.Point(379, 33);
            this.button14.Name = "button14";
            this.button14.Size = new System.Drawing.Size(159, 41);
            this.button14.TabIndex = 3;
            this.button14.Text = "DbFramework测试特殊数据类型";
            this.button14.UseVisualStyleBackColor = true;
            this.button14.Click += new System.EventHandler(this.button14_Click);
            //
            // button12
            //
            this.button12.Location = new System.Drawing.Point(207, 174);
            this.button12.Name = "button12";
            this.button12.Size = new System.Drawing.Size(166, 41);
            this.button12.TabIndex = 3;
            this.button12.Text = "DbFramework.DeleteList";
            this.button12.UseVisualStyleBackColor = true;
            this.button12.Click += new System.EventHandler(this.button12_Click);
            this.button12.ChangeUICues += new System.Windows.Forms.UICuesEventHandler(this.button11_ChangeUICues);
            //
            // txtConn
            //
            this.txtConn.Location = new System.Drawing.Point(13, 41);
            this.txtConn.Multiline = true;
            this.txtConn.Name = "txtConn";
            this.txtConn.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
            this.txtConn.Size = new System.Drawing.Size(862, 50);
            this.txtConn.TabIndex = 2;
            this.txtConn.Text = "Server=.;Database=CSFrameworkV5_Normal;User ID=sa;Password=test; Max Pool Size=51" +
    "2; Pooling=true;Connect Timeout=30";
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(13, 15);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(77, 12);
            this.label1.TabIndex = 5;
            this.label1.Text = "连接字符串:";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(564, 236);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(65, 12);
            this.label2.TabIndex = 5;
            this.label2.Text = "操作结果:";
            //
            // groupBox2
            //
            this.groupBox2.Controls.Add(this.button1);
            this.groupBox2.Controls.Add(this.button23);
            this.groupBox2.Controls.Add(this.button4);
            this.groupBox2.Controls.Add(this.button16);
            this.groupBox2.Controls.Add(this.button15);
            this.groupBox2.Controls.Add(this.button5);
            this.groupBox2.Controls.Add(this.button2);
            this.groupBox2.Controls.Add(this.button3);
            this.groupBox2.Location = new System.Drawing.Point(20, 97);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(661, 125);
            this.groupBox2.TabIndex = 6;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "IDatabase æµ‹è¯•";
            //
            // button16
            //
            this.button16.Location = new System.Drawing.Point(389, 65);
            this.button16.Name = "button16";
            this.button16.Size = new System.Drawing.Size(129, 41);
            this.button16.TabIndex = 1;
            this.button16.Text = "测试MySQLDateTime";
            this.button16.UseVisualStyleBackColor = true;
            this.button16.Click += new System.EventHandler(this.button16_Click);
            //
            // button15
            //
            this.button15.Location = new System.Drawing.Point(254, 65);
            this.button15.Name = "button15";
            this.button15.Size = new System.Drawing.Size(129, 41);
            this.button15.TabIndex = 1;
            this.button15.Text = "测试MySQLDateTime";
            this.button15.UseVisualStyleBackColor = true;
            this.button15.Click += new System.EventHandler(this.button15_Click);
            //
            // btnMSSQL
            //
            this.btnMSSQL.Location = new System.Drawing.Point(114, 6);
            this.btnMSSQL.Name = "btnMSSQL";
            this.btnMSSQL.Size = new System.Drawing.Size(63, 31);
            this.btnMSSQL.TabIndex = 7;
            this.btnMSSQL.Text = "MSSQL";
            this.btnMSSQL.UseVisualStyleBackColor = true;
            this.btnMSSQL.Click += new System.EventHandler(this.btnMSSQL_Click);
            //
            // btnMySql
            //
            this.btnMySql.Location = new System.Drawing.Point(183, 6);
            this.btnMySql.Name = "btnMySql";
            this.btnMySql.Size = new System.Drawing.Size(63, 31);
            this.btnMySql.TabIndex = 7;
            this.btnMySql.Text = "MySql";
            this.btnMySql.UseVisualStyleBackColor = true;
            this.btnMySql.Click += new System.EventHandler(this.btnMySql_Click);
            //
            // button20
            //
            this.button20.Location = new System.Drawing.Point(687, 97);
            this.button20.Name = "button20";
            this.button20.Size = new System.Drawing.Size(172, 41);
            this.button20.TabIndex = 3;
            this.button20.Text = "meta_GetTableNamesList";
            this.button20.UseVisualStyleBackColor = true;
            this.button20.Click += new System.EventHandler(this.button20_Click);
            //
            // button21
            //
            this.button21.Location = new System.Drawing.Point(687, 144);
            this.button21.Name = "button21";
            this.button21.Size = new System.Drawing.Size(172, 41);
            this.button21.TabIndex = 3;
            this.button21.Text = "meta_GetDatabaseList";
            this.button21.UseVisualStyleBackColor = true;
            this.button21.Click += new System.EventHandler(this.button21_Click);
            //
            // button22
            //
            this.button22.Location = new System.Drawing.Point(687, 191);
            this.button22.Name = "button22";
            this.button22.Size = new System.Drawing.Size(172, 41);
            this.button22.TabIndex = 3;
            this.button22.Text = "meta_GetTableStruList";
            this.button22.UseVisualStyleBackColor = true;
            this.button22.Click += new System.EventHandler(this.button22_Click);
            //
            // button23
            //
            this.button23.Location = new System.Drawing.Point(482, 20);
            this.button23.Name = "button23";
            this.button23.Size = new System.Drawing.Size(103, 41);
            this.button23.TabIndex = 1;
            this.button23.Text = "GetTop";
            this.button23.UseVisualStyleBackColor = true;
            this.button23.Click += new System.EventHandler(this.button23_Click);
            //
            // frmTestDB
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(904, 681);
            this.Controls.Add(this.btnMySql);
            this.Controls.Add(this.btnMSSQL);
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.txtConn);
            this.Controls.Add(this.txtResult);
            this.Controls.Add(this.button22);
            this.Controls.Add(this.button21);
            this.Controls.Add(this.button20);
            this.Controls.Add(this.dataGridView1);
            this.Name = "frmTestDB";
            this.Text = "CSFramework.DB测试程序";
            this.Load += new System.EventHandler(this.frmTestDB_Load);
            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
            this.groupBox1.ResumeLayout(false);
            this.groupBox2.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();
        }
        #endregion
        private System.Windows.Forms.DataGridView dataGridView1;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.TextBox txtResult;
        private System.Windows.Forms.Button button3;
        private System.Windows.Forms.Button button4;
        private System.Windows.Forms.Button button5;
        private System.Windows.Forms.Button button6;
        private System.Windows.Forms.Button button7;
        private System.Windows.Forms.Button button8;
        private System.Windows.Forms.Button button9;
        private System.Windows.Forms.Button button10;
        private System.Windows.Forms.Button button11;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.Button button12;
        private System.Windows.Forms.Button button13;
        private System.Windows.Forms.TextBox txtConn;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.GroupBox groupBox2;
        private System.Windows.Forms.Button button14;
        private System.Windows.Forms.Button button15;
        private System.Windows.Forms.Button button16;
        private System.Windows.Forms.Button button17;
        private System.Windows.Forms.Button button18;
        private System.Windows.Forms.Button btnMSSQL;
        private System.Windows.Forms.Button btnMySql;
        private System.Windows.Forms.Button button19;
        private System.Windows.Forms.Button button20;
        private System.Windows.Forms.Button button21;
        private System.Windows.Forms.Button button22;
        private System.Windows.Forms.Button button23;
    }
}
CSFramework.DB.Source/CSFramework.DBTester/frmTestDB.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,737 @@
using CSFramework.DB;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Threading;
using System.Windows.Forms;
namespace CSFramework.DBTester
{
    public partial class frmTestDB : Form
    {
        //string _Conn = "Server=.;Database=CSFramework_WebAPI_Log;User ID=sa;Password=test; Max Pool Size=512; Pooling=true;Connect Timeout=30";
        DatabaseType _DatabaseType = DatabaseType.SqlServer;
        public frmTestDB()
        {
            InitializeComponent();
        }
        private void frmTestDB_Load(object sender, EventArgs e)
        {
            ShowResult("默认为SQLServer连接");
            btnMSSQL_Click(btnMSSQL, null);
        }
        private void btnMSSQL_Click(object sender, EventArgs e)
        {
            _DatabaseType = DatabaseType.SqlServer;
            txtConn.Text = "Server=.;Database=CSFrameworkV5_Normal;User ID=sa;Password=test; Max Pool Size=512; Pooling=true;Connect Timeout=30";
            ShowResult("设置为SQLServer连接");
        }
        private void btnMySql_Click(object sender, EventArgs e)
        {
            _DatabaseType = DatabaseType.MySQL;
            txtConn.Text = "Server=120.79.85.97;Port=3306;Database=cs5_normal;User ID=root;Password=xxxxxxxx;Connection TimeOut=30;Charset=utf8;Pooling=true;Min Pool Size=0;Max Pool Size=500;Connection Lifetime=0;Convert Zero Datetime=True;";
            ShowResult("设置为MySQL连接");
            MessageBox.Show("请修改connstring的密码");
            txtConn.Focus();
        }
        public class UserModel
        {
            public string Account { get; set; }
            public string Password { get; set; }
        }
        private IDatabase _DB
        {
            get
            {
                return DatabaseFactory.CreateMDB(DatabaseType.SqlServer, txtConn.Text);
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string s = _DB.ConnectionString;
            ShowResult(s);
            DbCommand o2 = _DB.CreateCommand("SELECT GETDATE()", System.Data.CommandType.Text);
            object o9 = _DB.ExecuteCommand(o2);
            ShowResult(o9);
            DbCommand c1 = _DB.CreateCommand("SELECT * FROM sys_Log", System.Data.CommandType.Text);
            object o20 = _DB.GetDataSet(c1);
            ShowResult(o20);
            object o3 = _DB.CreateCommandBuilder();
            ShowResult(o3);
            object o4 = _DB.CreateConnection(txtConn.Text);
            ShowResult(o4);
            (o4 as IDisposable).Dispose();
            object o5 = _DB.CreateDataAdapter();
            ShowResult(o5);
            object o6 = _DB.CreateParameter("@asd", "asdf");
            ShowResult(o6);
            object o8 = _DB.DateTimeType;
            ShowResult(o8);
            object o10 = _DB.ExecuteReader("SELECT * FROM sys_Log");
            ShowResult(o10);
            object o11 = _DB.ExecuteScalar("SELECT * FROM sys_Log");
            ShowResult(o11);
            object o12 = _DB.ExecuteSQL("SELECT * FROM sys_Log");
            ShowResult(o12);
            DbTransaction tran = _DB.TransBegin();
            object o13 = _DB.ExecuteTrans(tran, "SELECT * FROM sys_Log");
            ShowResult(o13);
            _DB.TransRollback(tran);
            object o14 = _DB.GetDataRow("SELECT TOP 1 * FROM sys_Log");
            ShowResult(o14);
            object o15 = _DB.GetDataSet("SELECT TOP 1 * FROM sys_Log");
            ShowResult(o15);
            object o16 = _DB.GetTable("SELECT TOP 1 * FROM sys_Log");
            ShowResult(o16);
            object o17 = _DB.ParamSymboName;
            ShowResult(o17);
            object o18 = _DB.GetServerTime();
            ShowResult(o18);
            DbParameter p = _DB.CreateParameter("@TableName", "sys_Log");
            object o19 = _DB.GetDataSet("sp_sys_GetTableFieldDef", System.Data.CommandType.StoredProcedure, new System.Data.IDataParameter[] { p });
            ShowResult(o19);
        }
        private void ShowResult(object o)
        {
            if (o != null)
                txtResult.Text = txtResult.Text + "\r\n" + o.ToString();
            else
                txtResult.Text = txtResult.Text + "\r\n对象=null";
            txtResult.SelectionStart = txtResult.Text.Length;
            txtResult.ScrollToCaret();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            DbProviderFactory factory1 = DataProviderFactory.GetFactory(DatabaseType.SqlServer);
            ShowResult(factory1);
            DbProviderFactory factory2 = DataProviderFactory.GetFactory(DatabaseType.MySQL);
            ShowResult(factory2);
            DbProviderFactory factory3 = DataProviderFactory.GetFactory(DatabaseType.Oracle);
            ShowResult(factory3);
        }
        private void button3_Click(object sender, EventArgs e)
        {
            string _Conn = txtConn.Text;
            IDatabase db1 = DatabaseFactory.CreateMDB(_DatabaseType, _Conn);
            ShowResult(db1);
            ShowResult(db1.GetServerTime());
            //IDatabase db2 = DatabaseFactory.CreateMDB(_DatabaseType, _Conn);
            //ShowResult(db2);
            //ShowResult(db2.GetServerTime());
            //IDatabase db3 = DatabaseFactory.CreateMDB(DatabaseType.Oracle, _Conn);
            //ShowResult(db3);
            //ShowResult(db3.GetServerTime());
            //IDatabase db4 = DatabaseFactory.CreateDatabase(_DatabaseType, _Conn);
            //ShowResult(db4);
            //ShowResult(db4.GetServerTime());
            //IDatabase db5 = DatabaseFactory.CreateDatabase(DatabaseType.Oracle, _Conn);
            //ShowResult(db5);
            //ShowResult(db5.GetServerTime());
            IDatabase db6 = DatabaseFactory.CreateDatabase(DatabaseType.SqlServer, _Conn);
            ShowResult(db6);
            ShowResult(db6.GetServerTime());
        }
        private void button4_Click(object sender, EventArgs e)
        {
            IDatabase db = DatabaseFactory.CreateDatabase(DatabaseType.SqlServer, txtConn.Text);
            DataTable dt = db.GetTable("SELECT TOP 10 * FROM dbo.sys_Log", "sys_Log");
            dataGridView1.AutoGenerateColumns = true;
            dataGridView1.DataSource = dt;
        }
        private void button5_Click(object sender, EventArgs e)
        {
            DatabaseFactory.CommandTimeOut = 60 * 5; //设置DbCommand命令超时:5分钟
            DatabaseFactory.ConnectionTimeOut = 35;//设置数据库连接超时:35秒钟
            //连接字符串指定连接超时,25秒
            string connectionString = "Server=.;Database=CSFramework_WebAPI;User ID=sa;Password=test;Connection Timeout=25;";
            IDatabase db = DatabaseFactory.CreateDatabase(DatabaseType.SqlServer, connectionString);
            DbConnection conn = db.CreateConnection();//35s
            int a = conn.ConnectionTimeout;
            ShowResult(a);
            //连接字符串没有指定连接超时,自动添加Connection Timeout属性
            string connectionString1 = "Server=.;Database=CSFramework_WebAPI;User ID=sa;Password=test;";
            IDatabase db1 = DatabaseFactory.CreateDatabase(DatabaseType.SqlServer, connectionString1);
            DbConnection conn1 = db1.CreateConnection();
            int a1 = conn1.ConnectionTimeout;//35s
            ShowResult(a1);
            //Console.Write(a1);
            //Console.Write(conn1.ConnectionString);
            //测试命令超时
            DbCommand cmd = db.CreateCommand("SELECT COUNT(*) FROM Api_User", CommandType.Text);
            cmd.Connection = conn;
            int i = cmd.CommandTimeout;
            object o = cmd.ExecuteScalar();
            ShowResult(o);
            Console.Write(a);//300s
            conn.Dispose();
            conn1.Dispose();
        }
        private void button6_Click(object sender, EventArgs e)
        {
            //
            //测试案例:提交DataTable,批量修改提交多条记录
            //
            string conn = "Data Source=127.0.0.1;Initial Catalog=CSFramework_License;User ID=sa;Password =test;Persist Security Info=True;Connect Timeout=15;";
            IDatabase db = DatabaseFactory.CreateDatabase(DatabaseType.SqlServer, conn);
            var dt = db.GetTable("SELECT TOP 10 * FROM dbo.sys_RegisterLog");
            dt.Rows[0]["HID"] = "修改HID";//修改一条记录
            dt.Rows[1].Delete();//删除一条记录
            var row = dt.Rows.Add();//新增一条记录
            row["LicenseID"] = "xxxx";
            row["RegisterNo"] = "xxxx";
            row["RegisterTime"] = DateTime.Now;
            row["LogConent"] = "xxxx";
            row["HID"] = "xxxx";
            //根据Model提交数据
            int i = new DbFramework(db).Update(dt, typeof(sys_RegisterLog), new string[] { "isid" }, new string[] { "isid" });
            ShowResult($"共更新记录数:{i}");
        }
        private void button7_Click(object sender, EventArgs e)
        {
            //
            //测试案例:提交DataSet,批量修改、提交多表多条记录
            //
            string conn = "Data Source=127.0.0.1;Initial Catalog=CSFramework_License;User ID=sa;Password =test;Persist Security Info=True;Connect Timeout=15;";
            IDatabase db = DatabaseFactory.CreateDatabase(DatabaseType.SqlServer, conn);
            //表1
            var dt = db.GetTable("SELECT TOP 10 * FROM dbo.sys_RegisterLog ORDER BY isid ASC", "sys_RegisterLog");
            dt.Rows[0]["HID"] = "修改HID";//修改一条记录
            dt.Rows[1].Delete();//删除一条记录
            var row = dt.Rows.Add();//新增一条记录
            row["LicenseID"] = "xxxx";
            row["RegisterNo"] = "xxxx";
            row["RegisterTime"] = DateTime.Now;
            row["LogConent"] = "xxxx";
            row["HID"] = "xxxx";
            var row2 = dt.Rows.Add();//新增一条记录
            row2["LicenseID"] = "xxxx22";
            row2["RegisterNo"] = "xxxx22";
            row2["RegisterTime"] = DateTime.Now;
            row2["LogConent"] = "xxxx22";
            row2["HID"] = "xxxx22";
            //表2
            var dt1 = db.GetTable("SELECT TOP 10 * FROM dbo.sys_AdminUser ORDER BY isid DESC", "sys_AdminUser");
            var row1 = dt1.Rows[0];
            row1["AccountName"] = row1["AccountName"].ToString() + "-1";
            row1["LastLoginTime"] = DateTime.Now;//修改数据
            //
            //重要!!! æž„建ORM对象模型与表结构的关系
            //sys_RegisterLog表模型关系
            //sys_AdminUser表模型关系
            List<DbDataUpdateORM> orms = new List<DbDataUpdateORM>();
            orms.Add(new DbDataUpdateORM(typeof(sys_RegisterLog), new string[] { "isid" }, new string[] { "isid" }));
            orms.Add(new DbDataUpdateORM(typeof(sys_AdminUser), new string[] { "Account" }, new string[] { "isid" }));
            //组合DataSet, ä¸€æ¬¡æ€§æäº¤å¤šå¼ è¡¨
            DataSet ds = new DataSet();
            ds.Tables.Add(dt.GetChanges());
            ds.Tables.Add(dt1.GetChanges());
            //提交数据
            int i = 0;
            DbTransaction tran = db.TransBegin();
            DbFramework updater = new DbFramework(db, tran);
            try
            {
                i = updater.Update(ds, orms);//提交数据
                tran.Commit();
            }
            catch (Exception ex)
            {
                tran.Rollback();
                ShowResult(ex.Message);
            }
            ShowResult($"共更新记录数:{i}");
        }
        private void button8_Click(object sender, EventArgs e)
        {
            //
            //测试案例:新增一个对象,根据对象ORM自动存储到数据库
            //
            string conn = "Data Source=127.0.0.1;Initial Catalog=CSFramework_License;User ID=sa;Password =test;Persist Security Info=True;Connect Timeout=15;";
            IDatabase db = DatabaseFactory.CreateDatabase(DatabaseType.SqlServer, conn);
            sys_AdminUser user0 = new sys_AdminUser
            {
                Account = "Test-" + DateTime.Now.ToString("yyMMddHHmmss"),
                AccountName = "test",
                AccountType = "xx",
                Password = "pwd",
                LoginCount = 1929,
                Amount = decimal.Parse("1231.22"),
            };
            //新增一个对象
            bool b = new DbFramework(db).AddObject(user0, new string[] { "isid" });
            ShowResult($"更新{b}");
        }
        private void button9_Click(object sender, EventArgs e)
        {
            //
            //测试案例:修改对象,根据对象ORM自动存储到数据库
            //
            string conn = "Data Source=127.0.0.1;Initial Catalog=CSFramework_License;User ID=sa;Password =test;Persist Security Info=True;Connect Timeout=15;";
            IDatabase db = DatabaseFactory.CreateDatabase(DatabaseType.SqlServer, conn);
            sys_RegisterLog log = db.ExecuteReader<sys_RegisterLog>("SELECT * FROM dbo.sys_RegisterLog where isid=133");
            log.HID = "xxxxxxxxxxxxxxxxxxxx";
            log.LicenseID = "asdfasdfasf";
            log.LogConent = "asfdasdfasdfasdfasdf";
            log.RegisterNo = "xxxxxxxxxxxxxxxxx";
            log.RegisterTime = DateTime.Now;
            //修改对象
            bool ok = new DbFramework(db).UpdateObject(log, new string[] { "isid" }, new string[] { "isid" });
            ShowResult($"操作{ok}");
        }
        private void button10_Click(object sender, EventArgs e)
        {
            //
            //测试案例:删除一个对象,根据对象ORM自动自动删除记录
            //
            string conn = "Data Source=127.0.0.1;Initial Catalog=CSFramework_License;User ID=sa;Password =test;Persist Security Info=True;Connect Timeout=15;";
            IDatabase db = DatabaseFactory.CreateDatabase(DatabaseType.SqlServer, conn);
            var isid = db.ExecuteScalar("SELECT TOP 1 ISID FROM sys_RegisterLog");
            sys_RegisterLog log = new sys_RegisterLog();
            log.isid = int.Parse(isid.ToString());
            //删除一个对象
            bool ok = new DbFramework(db).DeleteObject(log, new string[] { "isid" });
            ShowResult($"操作{ok}");
        }
        private void button11_ChangeUICues(object sender, UICuesEventArgs e)
        {
        }
        private void button11_Click(object sender, EventArgs e)
        {
            //
            //测试案例:修改对象列表,根据对象ORM自动存储到数据库
            //
            string conn = "Data Source=127.0.0.1;Initial Catalog=CSFramework_License;User ID=sa;Password =test;Persist Security Info=True;Connect Timeout=15;";
            IDatabase db = DatabaseFactory.CreateDatabase(DatabaseType.SqlServer, conn);
            sys_AdminUser user = new sys_AdminUser
            {
                Account = "000011",
                AccountName = "test11",
                AccountType = "xx111111111111111111",
                Password = "pwd11111111"
            };
            sys_AdminUser user2 = new sys_AdminUser
            {
                Account = "000022",
                AccountName = "test22222222222",
                AccountType = "xx222222222222222222",
                Password = "pwd222222222"
            };
            List<sys_AdminUser> list = new List<sys_AdminUser>();
            list.Add(user);
            list.Add(user2);
            //修改对象列表
            int i = new DbFramework(db).UpdateList<sys_AdminUser>(list, new string[] { "Account" }, new string[] { "isid" });
            ShowResult($"批量更新记录{i}");
        }
        private void button12_Click(object sender, EventArgs e)
        {
            //
            //测试案例:删除对象列表,根据对象ORM自动删除记录
            //
            string conn = "Data Source=127.0.0.1;Initial Catalog=CSFramework_License;User ID=sa;Password =test;Persist Security Info=True;Connect Timeout=15;";
            IDatabase db = DatabaseFactory.CreateDatabase(DatabaseType.SqlServer, conn);
            var isid = db.GetStringList("SELECT TOP 2 ISID FROM sys_RegisterLog");
            sys_RegisterLog R1 = new sys_RegisterLog
            {
                isid = int.Parse(isid[0]),
            };
            sys_RegisterLog R2 = new sys_RegisterLog
            {
                isid = int.Parse(isid[1]),
            };
            List<sys_RegisterLog> list = new List<sys_RegisterLog>();
            list.Add(R1);
            list.Add(R2);
            //删除一个对象列表
            int i = new DbFramework(db).DeleteList<sys_RegisterLog>(list, new string[] { "isid" });
            ShowResult($"批量删除记录{i}");
        }
        private void button13_Click(object sender, EventArgs e)
        {
            //
            //测试案例:新增对象列表,根据对象ORM自动存储到数据库
            //
            string conn = "Data Source=127.0.0.1;Initial Catalog=CSFramework_License;User ID=sa;Password =test;Persist Security Info=True;Connect Timeout=15;";
            IDatabase db = DatabaseFactory.CreateDatabase(DatabaseType.SqlServer, conn);
            sys_AdminUser user = new sys_AdminUser
            {
                Account = "Test-" + DateTime.Now.ToString("yyMMddHHmmssfff"),
                AccountName = "test",
                AccountType = "xx",
                Password = "pwd"
            };
            Thread.Sleep(50);
            sys_AdminUser user2 = new sys_AdminUser
            {
                Account = "Test-" + DateTime.Now.ToString("yyMMddHHmmssfff"),
                AccountName = "test2",
                AccountType = "xx",
                Password = "pwd"
            };
            List<sys_AdminUser> list = new List<sys_AdminUser>();
            list.Add(user);
            list.Add(user2);
            //提交数据
            int i = 0;
            DbTransaction tran = db.TransBegin();
            DbFramework updater = new DbFramework(db, tran);
            try
            {
                i = updater.AddList<sys_AdminUser>(list, new string[] { "isid" });
                tran.Commit();
            }
            catch (Exception ex)
            {
                tran.Rollback();
                ShowResult(ex.Message);
            }
            ShowResult($"共更新记录数:{i}");
        }
        private void button14_Click(object sender, EventArgs e)
        {
            string conn = "Data Source=127.0.0.1;Initial Catalog=CSFrameworkV5_Normal;User ID=sa;Password =test;Persist Security Info=True;Connect Timeout=15;";
            IDatabase db = DatabaseFactory.CreateDatabase(DatabaseType.SqlServer, conn);
            var dt = db.GetTable("select TOP 1 * from _TestDataUpdate");
            ShowResult($"查询成功,记录{dt.Rows.Count}");
            DbFramework update = new DbFramework(db);
            _TestDataUpdate m = new _TestDataUpdate
            {
                _Binary = new byte[] { 1, 2, 3, 4, 5, 56 },
                _Bit = true,
                _Char = 'A',
                _Int = 100000,
                _Datetime2 = DateTime.Now,
                _DateTimeOffset = new DateTimeOffset(DateTime.Now),
                _Timestamp = new DateTime(),
                _Image = new byte[] { 1, 2, 3, 4, 5, 56 },
                _Ntext = "_Ntext_Ntext_Ntext_Ntext_Ntext",
                _Sql_variant = "_Sql_variant",//可变数据类型
                _UniqueIdentifier = Guid.NewGuid(),
                _Varbinary = new byte[] { 1, 2, 3, 4, 5, 56 },
                //标准XML格式
                _Xml = "<?xml version=\"1.0\"?><configuration><startup><supportedRuntime version=\"v4.0\" sku=\".NETFramework,Version=v4.5\"/></startup></configuration>",
                //SQL SERVER 2008支持两种空间数据类型,geometry和geography.其中geometry数据类型支持平面或平面球数据,
                //geography可用于存储GPS经度和纬度坐标等椭球体数据。
                //geometry和geography数据类型基于geometry层次结构。
                _Geography = "POINT(55.9271035250276 -3.29431266523898)", //Geography ç±»åž‹æ•°æ®ç»“æž„
                _Geometry = "POINT(55.9271035250276 -3.29431266523898)", //Geometry ç±»åž‹æ•°æ®ç»“æž„
                //摘要:hierarchyid æ•°æ®ç±»åž‹ï¼Œæ˜¯sqlserver 2008中新增的一个CLR数据类型,此数据类型应用于存储具有层级的结构图
                _Hierarchyid = "/1/2/2/1/5/3/4/",
            };
            int isid = 0;
            bool ok1 = update.AddObject<_TestDataUpdate>(m, new string[] { "isid", "_Timestamp" }, out isid);
            ShowResult($"新增对象结果{ok1}");
            var o = update.Select<_TestDataUpdate>("isid", isid);
            ShowResult($"查询对象结果{o._UniqueIdentifier}");
            m.isid = 12;
            bool ok2 = update.UpdateObject<_TestDataUpdate>(m, new string[] { "isid", }, new string[] { "isid", "_Timestamp" });
            ShowResult($"修改对象结果{ok2}");
            m.isid = 2;
            bool ok3 = update.DeleteObject<_TestDataUpdate>(m, new string[] { "isid", });
            ShowResult($"删除对象结果{ok3}");
        }
        private void button15_Click(object sender, EventArgs e)
        {
            //解决方案:
            //连接字符串删除:Allow Zero Datetime=True; åŠ ä¸Šï¼šConvert Zero Datetime=True;
            string conn = "Server={0};Port={1};Database={2};User ID={3};Password={4};Connection TimeOut={5};Charset=utf8;Pooling=true;Min Pool Size=0;Max Pool Size=500;Connection Lifetime=0;Convert Zero Datetime=True;";
            conn = txtConn.Text;
            IDatabase db = DatabaseFactory.CreateMySqlDatabase(conn);
            var DT = db.GetTable("SELECT * FROM tb_MyUserRoles LIMIT 10;");
            var row = DT.Rows.Add();
            row["CreateTime"] = DateTime.Now;
            DT.AcceptChanges();
            MessageBox.Show(row["CreateTime"].ToString());
        }
        private void button16_Click(object sender, EventArgs e)
        {
            IDatabase db = DatabaseFactory.CreateMySqlDatabase(txtConn.Text);
            CommandHelper sp = db.CreateSqlProc("usp_SearchCustomer");
            sp.AddParam("CustomerFrom", "");
            sp.AddParam("CustomerTo", "");
            sp.AddParam("CustomerName", "");
            sp.AddParam("Attribute", "");
            var DT = db.GetTable(sp.Command, "tb_Customer");
        }
        private void button17_Click(object sender, EventArgs e)
        {
            IDatabase db = DatabaseFactory.CreateMySqlDatabase(txtConn.Text);
            _testdataupdate m = new _testdataupdate
            {
                _BinaryCHAR = new byte[] { 1, 2, 3, 4, 5, 56 },
                _Bit = true,
                _Char = 'A',
                _Int = 100000,
                _Datetime = DateTime.Now,
                _Timestamp = new DateTime(),
                _Image = new byte[] { 1, 2, 3, 4, 5, 56 },
                _Ntext = "_Ntext_Ntext_Ntext_Ntext_Ntext",
                _Sql_variant = "_Sql_variant",//可变数据类型
                _UniqueIdentifier = Guid.NewGuid().ToString(),
                _Varbinary = new byte[] { 1, 2, 3, 4, 5, 56 },
                //标准XML格式
                _Json = "{}",
                //SQL SERVER 2008支持两种空间数据类型,geometry和geography.其中geometry数据类型支持平面或平面球数据,
                //geography可用于存储GPS经度和纬度坐标等椭球体数据。
                //geometry和geography数据类型基于geometry层次结构。
                _Geography = "POINT(55.9271035250276 -3.29431266523898)", //Geography ç±»åž‹æ•°æ®ç»“æž„
                _Geometry = "POINT(55.9271035250276 -3.29431266523898)", //Geometry ç±»åž‹æ•°æ®ç»“æž„
                //摘要:hierarchyid æ•°æ®ç±»åž‹ï¼Œæ˜¯sqlserver 2008中新增的一个CLR数据类型,此数据类型应用于存储具有层级的结构图
                _Hierarchyid = "/1/2/2/1/5/3/4/",
            };
            DbFramework update = new DbFramework(db);
            bool ok1 = update.AddObject<_testdataupdate>(m, new string[] { "isid", "_Timestamp" });
            ShowResult($"新增对象结果{ok1}");
            m.isid = 12;
            bool ok2 = update.UpdateObject<_testdataupdate>(m, new string[] { "isid", }, new string[] { "isid", "_Timestamp" });
            ShowResult($"修改对象结果{ok2}");
            m.isid = 2;
            bool ok3 = update.DeleteObject<_testdataupdate>(m, new string[] { "isid", });
            ShowResult($"删除对象结果{ok3}");
        }
        private void button18_Click(object sender, EventArgs e)
        {
            IDatabase db = DatabaseFactory.CreateMySqlDatabase(txtConn.Text);
            //查询原数据
            _testdataupdate o = db.ExecuteReader<_testdataupdate>("SELECT * FROM _testdataupdate WHERE isid=1;");
            _testdataupdate m = new _testdataupdate();//用于修改资料的对象
            //获取timestamp的值
            DateTime ts = o._Timestamp;
            ShowResult($"timestamp值:{ts}");
            //CSFramework.DB组件
            CSFramework.DB.DbFramework update = new DbFramework(db);
            //测试步骤1:模拟其他用户修改记录
            m.isid = 1; //isid作为主键更新记录
            m._Ntext = "模拟其他用户修改记录-isid作为主键更新记录" + Guid.NewGuid().ToString();
            bool ok1 = update.UpdateObject<_testdataupdate>(m, new string[] { "isid", }, new string[] { "isid", "_Timestamp" });
            ShowResult($"修改对象结果:{ok1}");
            //查询修改后Timestamp的值
            _testdataupdate o1 = db.ExecuteReader<_testdataupdate>("SELECT * FROM _testdataupdate WHERE isid=1;");
            ShowResult($"timestamp值(修改后):{o1._Timestamp}");
            //测试步骤2:Timestamp类型的字段作为主键更新数据
            m._Timestamp = o._Timestamp;
            m._Ntext = "Timestamp类型的字段作为主键更新数据";
            bool ok2 = update.UpdateObject<_testdataupdate>(m, new string[] { "_Timestamp", }, new string[] { "isid", "_Timestamp" });
            if (ok2)
                ShowResult($"修改对象结果:{ok2}");
            else
                ShowResult($"原记录已被修改(并发操作)!");
        }
        private void button19_Click(object sender, EventArgs e)
        {
            //
            //测试案例:修改对象,根据对象ORM自动存储到数据库
            //
            string conn = "Data Source=127.0.0.1;Initial Catalog=CSFramework_License;User ID=sa;Password =test;Persist Security Info=True;Connect Timeout=15;";
            IDatabase db = DatabaseFactory.CreateDatabase(DatabaseType.SqlServer, conn);
            //从数据库获取对象,最新数据
            sys_AdminUser user = db.ExecuteReader<sys_AdminUser>("SELECT * FROM sys_AdminUser where isid=49");
            user.AccountName = "修改用户名称";
            user.LoginCount = 111999;
            user.Amount = decimal.Parse("111999.99");
            string[] PKFields = new string[] { "isid" };//主键字段
            string[] ignoreFields = new string[] { "isid", "Account" };//忽略的字段列表,比如自增字段、时间戳等。
            string[] updateFields = new string[] { "AccountName", "Amount" };//指定提交数据的字段(ignoreFields参数可以不传值)
            //指定忽略更新的字段
            bool ok1 = new DbFramework(db).UpdateObject(user, PKFields, ignoreFields);
            //UPDATE SYS_ADMINUSER SET AccountType=@AccountType,AccountName=@AccountName,Password=@Password,FlagLock=@FlagLock,LastLoginTime=@LastLoginTime,LoginCount=@LoginCount,Amount=@Amount WHERE isid=@isid
            //指定更新的字段
            bool ok2 = new DbFramework(db).UpdateObject(user, PKFields, null, updateFields);
            //UPDATE SYS_ADMINUSER SET AccountName=@AccountName,Amount=@Amount WHERE isid=@isid
            //指定忽略更新+更新的字段,此方案ignoreFields参数无效(程序不处理)
            bool ok3 = new DbFramework(db).UpdateObject(user, PKFields, ignoreFields, updateFields);
            //UPDATE SYS_ADMINUSER SET AccountName=@AccountName,Amount=@Amount WHERE isid=@isid
        }
        private void button20_Click(object sender, EventArgs e)
        {
            IDatabase db = DatabaseFactory.CreateDatabase(_DatabaseType, txtConn.Text);
            var list = db.meta_GetTableNamesList();
            ShowResult($"list={list.Count}");
            foreach (var o in list) ShowResult(o.name);
        }
        private void button21_Click(object sender, EventArgs e)
        {
            IDatabase db = DatabaseFactory.CreateDatabase(_DatabaseType, txtConn.Text);
            var list = db.meta_GetDatabaseList();
            ShowResult($"list={list.Count}");
            foreach (var o in list) ShowResult(o.DBName);
        }
        private void button22_Click(object sender, EventArgs e)
        {
            IDatabase db = DatabaseFactory.CreateDatabase(_DatabaseType, txtConn.Text);
            var list = db.meta_GetTableStruList("sys_Log");
            ShowResult($"list={list.Count}");
            foreach (var o in list) ShowResult(o.FieldName);
        }
        private void button23_Click(object sender, EventArgs e)
        {
            IDatabase db = DatabaseFactory.CreateDatabase(_DatabaseType, txtConn.Text);
            //测试GetTop方法, é»˜è®¤å‚æ•°
            DataTable dt = db.GetTop(100, "sys_Log", "", null, "");
            ShowResult($"list={dt.Rows.Count}");
            //测试GetTop方法 - ä¼ å…¥æŒ‡å®šå‚æ•°
            DbParameter p1 = db.CreateParameter("TableName", "tb_POs");
            DbParameter p2 = db.CreateParameter("LogUser", "admin");
            List<DbParameter> list = new List<DbParameter>();
            list.Add(p1);
            list.Add(p2);
            DataTable dt1 = db.GetTop(100, "sys_Log", "isid,LogUser,LogDate,TableName", list, "isid DESC");
            ShowResult($"list={dt1.Rows.Count}");
            dataGridView1.AutoGenerateColumns = true;
            dataGridView1.DataSource = dt1;
        }
    }
}
CSFramework.DB.Source/CSFramework.DBTester/frmTestDB.resx
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
    Version 2.0
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
    Example:
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
    There are any number of "resheader" rows that contain simple
    name/value pairs.
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.
    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
</root>
CSFramework.DB.Source/CSFramework.DBTester/logo.ico
CSFramework.DB.Source/CSFramework.DBTester/sys_AdminUser.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
using CSFramework.DB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CSFramework.DBTester
{
    //指定表名,比如MySQL所有表名默认是小写,Oracle全大写
    //[TableInfoAttribute("sys_adminuser")]
    [TableInfoAttribute("SYS_ADMINUSER")]
    //[TableInfoAttribute("sys_AdminUser")]
    public class sys_AdminUser
    {
        public int isid { get; set; }
        public string AccountType { get; set; }
        public string Account { get; set; }
        public string AccountName { get; set; }
        public string Password { get; set; }
        public string FlagLock { get; set; }
        public DateTime LastLoginTime { get; set; }
        public int LoginCount { get; set; }
        public decimal Amount { get; set; }
    }
}
CSFramework.DB.Source/CSFramework.DBTester/sys_Log.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,41 @@
using CSFramework.DB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CSFramework.DBTester
{
    [TableInfoAttribute("sys_Log")]
    public class sys_Log
    {
        //标识该字段为主键
        [KeyField]
        public string GUID32 { get; set; }
        //该字段为自增字段,忽略
        [IgnoreField]
        public int isid { get; set; }
        public string DocNo { get; set; }
        public string LogUser { get; set; }
        public int OPType { get; set; }
        public DateTime LogDate { get; set; }
        public bool IsProcess { get; set; }
        //忽略的字段
        [IgnoreField]
        public string IgnoreField1 { get; set; }
        //忽略的字段
        [IgnoreField]
        public string IgnoreField2 { get; set; }
    }
}
CSFramework.DB.Source/CSFramework.DBTester/sys_RegisterLog.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CSFramework.DBTester
{
    public class sys_RegisterLog
    {
        public int isid { get; set; }
        public string LicenseID { get; set; }
        public string RegisterNo { get; set; }
        public DateTime RegisterTime { get; set; }
        public string LogConent { get; set; }
        public string HID { get; set; }
    }
}
CSFramework.DB.Source/CSFramework.DBV2.0.sln
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.1525
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSFramework.DB", "CSFramework.DB\CSFramework.DB.csproj", "{8AE59D09-994C-4E82-BEC7-69C5977B659F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSFramework.DBTester", "CSFramework.DBTester\CSFramework.DBTester.csproj", "{EBE7B1E8-6D76-43A2-A765-653847F0CC8B}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {8AE59D09-994C-4E82-BEC7-69C5977B659F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {8AE59D09-994C-4E82-BEC7-69C5977B659F}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {8AE59D09-994C-4E82-BEC7-69C5977B659F}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {8AE59D09-994C-4E82-BEC7-69C5977B659F}.Release|Any CPU.Build.0 = Release|Any CPU
        {EBE7B1E8-6D76-43A2-A765-653847F0CC8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {EBE7B1E8-6D76-43A2-A765-653847F0CC8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {EBE7B1E8-6D76-43A2-A765-653847F0CC8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {EBE7B1E8-6D76-43A2-A765-653847F0CC8B}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
    GlobalSection(ExtensibilityGlobals) = postSolution
        SolutionGuid = {277D77C4-307A-434F-8CEF-6D612FEC89E6}
    EndGlobalSection
EndGlobal
CSFrameworkV5.Core/CSFrameworkV5.Core.Tester/App.config
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
</configuration>
CSFrameworkV5.Core/CSFrameworkV5.Core.Tester/CSFrameworkV5.Core.Tester.csproj
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{4FCCF76F-F0A1-42BC-B77B-DF612DC3E976}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <RootNamespace>CSFrameworkV5.Core.Tester</RootNamespace>
    <AssemblyName>CSFrameworkV5.Core.Tester</AssemblyName>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <Deterministic>true</Deterministic>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>..\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Tester.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\CSFrameworkV5.Core\CSFrameworkV5.Core.csproj">
      <Project>{2A59861C-5D4D-4768-B31F-7F59A8517DAE}</Project>
      <Name>CSFrameworkV5.Core</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
CSFrameworkV5.Core/CSFrameworkV5.Core.Tester/Program.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CSFrameworkV5.Core.Tester
{
    class Program
    {
        static void Main(string[] args)
        {
            Tester.Do();
        }
    }
}
CSFrameworkV5.Core/CSFrameworkV5.Core.Tester/Properties/AssemblyInfo.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// æœ‰å…³ç¨‹åºé›†çš„一般信息由以下
// æŽ§åˆ¶ã€‚更改这些特性值可修改
// ä¸Žç¨‹åºé›†å…³è”的信息。
[assembly: AssemblyTitle("CSFrameworkV5.Core.Tester")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CSFrameworkV5.Core.Tester")]
[assembly: AssemblyCopyright("Copyright Â©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// å°† ComVisible è®¾ç½®ä¸º false ä¼šä½¿æ­¤ç¨‹åºé›†ä¸­çš„类型
//对 COM ç»„件不可见。如果需要从 COM è®¿é—®æ­¤ç¨‹åºé›†ä¸­çš„类型
//请将此类型的 ComVisible ç‰¹æ€§è®¾ç½®ä¸º true。
[assembly: ComVisible(false)]
// å¦‚果此项目向 COM å…¬å¼€ï¼Œåˆ™ä¸‹åˆ— GUID ç”¨äºŽç±»åž‹åº“çš„ ID
[assembly: Guid("4fccf76f-f0a1-42bc-b77b-df612dc3e976")]
// ç¨‹åºé›†çš„版本信息由下列四个值组成:
//
//      ä¸»ç‰ˆæœ¬
//      æ¬¡ç‰ˆæœ¬
//      ç”Ÿæˆå·
//      ä¿®è®¢å·
//
// å¯ä»¥æŒ‡å®šæ‰€æœ‰å€¼ï¼Œä¹Ÿå¯ä»¥ä½¿ç”¨ä»¥ä¸‹æ‰€ç¤ºçš„ "*" é¢„置版本号和修订号
// æ–¹æ³•是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
CSFrameworkV5.Core/CSFrameworkV5.Core.Tester/Tester.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,52 @@
using CSFrameworkV5.Core.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CSFrameworkV5.Core.Tester
{
    class Tester
    {
        internal static void Do()
        {
            var s = DataConverter.ImgToBase64String(@"C:\Users\Administrator\Desktop\pubimg\6868.png");
            Console.WriteLine(s);
           var img= DataConverter.Base64StringToImage(s);
            img.Dispose();
            return;
            var a = CryptoHelper.RSAEncrypt("csframework.com", RASKey());
            Console.WriteLine(a);
            var b = CryptoHelper.RSADecrypt(a, RASKey());
            Console.WriteLine(b);
            Console.ReadLine();
        }
        static string RASKey()
        {
            var key = @"<RSAKeyValue><Modulus>5m9m14XH3oqLJ8bNGw9e4rGpXpcktv9MSkHSVFVMjHbfv+SJ5v0ubqQxa5YjLN4vc49z7SVju8s0X4gZ6AzZTn06jzWOgyPRV54Q4I0DCYadWW4Ze3e+BOtwgVU1Og3qHKn8vygoj40J6U85Z/PTJu3hN1m75Zr195ju7g9v4Hk=</Modulus><Exponent>AQAB</Exponent><P>/hf2dnK7rNfl3lbqghWcpFdu778hUpIEBixCDL5WiBtpkZdpSw90aERmHJYaW2RGvGRi6zSftLh00KHsPcNUMw==</P><Q>6Cn/jOLrPapDTEp1Fkq+uz++1Do0eeX7HYqi9rY29CqShzCeI7LEYOoSwYuAJ3xA/DuCdQENPSoJ9KFbO4Wsow==</Q><DP>ga1rHIJro8e/yhxjrKYo/nqc5ICQGhrpMNlPkD9n3CjZVPOISkWF7FzUHEzDANeJfkZhcZa21z24aG3rKo5Qnw==</DP><DQ>MNGsCB8rYlMsRZ2ek2pyQwO7h/sZT8y5ilO9wu08Dwnot/7UMiOEQfDWstY3w5XQQHnvC9WFyCfP4h4QBissyw==</DQ><InverseQ>EG02S7SADhH1EVT9DD0Z62Y0uY7gIYvxX/uq+IzKSCwB8M2G7Qv9xgZQaQlLpCaeKbux3Y59hHM+KpamGL19Kg==</InverseQ><D>vmaYHEbPAgOJvaEXQl+t8DQKFT1fudEysTy31LTyXjGu6XiltXXHUuZaa2IPyHgBz0Nd7znwsW/S44iql0Fen1kzKioEL3svANui63O3o5xdDeExVM6zOf1wUUh/oldovPweChyoAdMtUzgvCbJk1sYDJf++Nr0FeNW1RB1XG30=</D></RSAKeyValue>";
            return key;
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("-----BEGIN PUBLIC KEY-----");
            sb.AppendLine("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDHc+PP8LuTlBL1zCX+lh9kcur");
            sb.AppendLine("gHHIXFnV/tDK789DaJuhwZvQ1lu5Zdcn+ULbNUKkB6b5tCP0sZxlpoCVKMyKHtde");
            sb.AppendLine("h/YGXwBD8sMc+XcRs0eh3/tyr4EoBu3bomzHWDGmHjH/F5GotFTrGcB6xQwAROy4");
            sb.AppendLine("mT5SketlQ3c7tucI+QIDAQAB");
            sb.AppendLine("-----END PUBLIC KEY-----");
            return sb.ToString();
        }
    }
}
CSFrameworkV5.Core/CSFrameworkV5.Core.sln
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,41 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.1525
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSFrameworkV5.Core", "CSFrameworkV5.Core\CSFrameworkV5.Core.csproj", "{2A59861C-5D4D-4768-B31F-7F59A8517DAE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSFrameworkV5.Core.Tester", "CSFrameworkV5.Core.Tester\CSFrameworkV5.Core.Tester.csproj", "{4FCCF76F-F0A1-42BC-B77B-DF612DC3E976}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Debug|x86 = Debug|x86
        Release|Any CPU = Release|Any CPU
        Release|x86 = Release|x86
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {2A59861C-5D4D-4768-B31F-7F59A8517DAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {2A59861C-5D4D-4768-B31F-7F59A8517DAE}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {2A59861C-5D4D-4768-B31F-7F59A8517DAE}.Debug|x86.ActiveCfg = Debug|x86
        {2A59861C-5D4D-4768-B31F-7F59A8517DAE}.Debug|x86.Build.0 = Debug|x86
        {2A59861C-5D4D-4768-B31F-7F59A8517DAE}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {2A59861C-5D4D-4768-B31F-7F59A8517DAE}.Release|Any CPU.Build.0 = Release|Any CPU
        {2A59861C-5D4D-4768-B31F-7F59A8517DAE}.Release|x86.ActiveCfg = Release|x86
        {2A59861C-5D4D-4768-B31F-7F59A8517DAE}.Release|x86.Build.0 = Release|x86
        {4FCCF76F-F0A1-42BC-B77B-DF612DC3E976}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {4FCCF76F-F0A1-42BC-B77B-DF612DC3E976}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {4FCCF76F-F0A1-42BC-B77B-DF612DC3E976}.Debug|x86.ActiveCfg = Debug|Any CPU
        {4FCCF76F-F0A1-42BC-B77B-DF612DC3E976}.Debug|x86.Build.0 = Debug|Any CPU
        {4FCCF76F-F0A1-42BC-B77B-DF612DC3E976}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {4FCCF76F-F0A1-42BC-B77B-DF612DC3E976}.Release|Any CPU.Build.0 = Release|Any CPU
        {4FCCF76F-F0A1-42BC-B77B-DF612DC3E976}.Release|x86.ActiveCfg = Release|Any CPU
        {4FCCF76F-F0A1-42BC-B77B-DF612DC3E976}.Release|x86.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
    GlobalSection(ExtensibilityGlobals) = postSolution
        SolutionGuid = {264FE228-71F0-48AB-997B-E99C98DEA625}
    EndGlobalSection
EndGlobal