master
杨威 1 month ago
parent b3430a6e54
commit 48c71a083b

@ -0,0 +1,67 @@
<?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>{CA803C5B-CD45-478C-B427-DDA95C4BDFC3}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>DNSD_DB</RootNamespace>
<AssemblyName>DNSD_DB</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\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>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="Chloe, Version=5.25.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Chloe.5.25.0\lib\net46\Chloe.dll</HintPath>
</Reference>
<Reference Include="Chloe.Extension, Version=5.25.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Chloe.Extension.5.25.0\lib\net46\Chloe.Extension.dll</HintPath>
</Reference>
<Reference Include="Chloe.SQLite, Version=5.25.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Chloe.SQLite.5.25.0\lib\net46\Chloe.SQLite.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite">
<HintPath>..\Dll\System.Data.SQLite.dll</HintPath>
</Reference>
<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="Properties\AssemblyInfo.cs" />
<Compile Include="SQLiteContext.cs" />
<Compile Include="SqlLiteTool.cs" />
<Compile Include="Student.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("DNSD_DB")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DNSD_DB")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("ca803c5b-cd45-478c-b427-dda95c4bdfc3")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SQLite;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Chloe.Infrastructure;
using SQLiteContext = Chloe.SQLite.SQLiteContext;
namespace DNSD_DB
{
public class SQLiteConnectionFactory : IDbConnectionFactory
{
string _connString = null;
public SQLiteConnectionFactory(string connString)
{
this._connString = connString;
}
public IDbConnection CreateConnection()
{
/* You must add the 'System.Data.SQLite.dll' and implement this method */
//throw new NotImplementedException("You must add the System.Data.SQLite.dll and implement the method 'CreateConnection()'.");
/*
* If there is an error occurred because can not load the assembly 'SQLite.Interop.dll',the 'SQLite.Interop.dll' in the directories 'x64' and 'x86', you should copy them with folder to the directory 'bin\Debug' and try again.
*/
IDbConnection conn = null;
conn = new System.Data.SQLite.SQLiteConnection(this._connString);
return conn;
}
}
}

@ -0,0 +1,18 @@
using Chloe;
using Chloe.RDBMS.DDL;
using Chloe.SQLite;
using Chloe.SQLite.DDL;
namespace DNSD_DB
{
public class SqlLiteTool
{
public static void CreateTable(string db)
{
IDbContext dbContext = new SQLiteContext(new SQLiteConnectionFactory(db));
new SQLiteTableGenerator(dbContext).CreateTables(TableCreateMode.CreateIfNotExists);
}
}
}

@ -0,0 +1,40 @@
using System.ComponentModel;
using Chloe.Annotations;
namespace DNSD_DB
{
public class Student
{
/// <summary>
/// 学生ID [主键,自动递增]
/// </summary>
[Column(IsPrimaryKey = true)]
[AutoIncrement]
[DisplayName("学生ID")]
public int StudentID { get; set; }
/// <summary>
/// 班级ID
/// </summary>
public int ClassID { get; set; }
/// <summary>
/// 学生姓名
/// </summary>
public string Name { get; set; }
/// <summary>
/// 学生年龄
/// </summary>
public int Age { get; set; }
/// <summary>
/// 学生性别
/// </summary>
public string Gender { get; set; }
}
}

Binary file not shown.

File diff suppressed because it is too large Load Diff

@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NDSD_Screwdriver", "NDSD-Sc
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NDSD_TouchSocket", "NDSD-TouchSocket\NDSD_TouchSocket.csproj", "{B2580256-9ED8-4985-BE38-3F771B13E9FD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DNSD_DB", "DNSD_DB\DNSD_DB.csproj", "{CA803C5B-CD45-478C-B427-DDA95C4BDFC3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -21,6 +23,10 @@ Global
{B2580256-9ED8-4985-BE38-3F771B13E9FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2580256-9ED8-4985-BE38-3F771B13E9FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B2580256-9ED8-4985-BE38-3F771B13E9FD}.Release|Any CPU.Build.0 = Release|Any CPU
{CA803C5B-CD45-478C-B427-DDA95C4BDFC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CA803C5B-CD45-478C-B427-DDA95C4BDFC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CA803C5B-CD45-478C-B427-DDA95C4BDFC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CA803C5B-CD45-478C-B427-DDA95C4BDFC3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -5,6 +5,7 @@
</startup>
<appSettings>
<add key="ip" value="http" />
<add key="db" value="Data Source=ndsd.db;Version=3;" />
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

@ -7,5 +7,10 @@
{
return ConfigurationManager.AppSettings["ip"].ToString();
}
public static string GetDb()
{
return ConfigurationManager.AppSettings["db"].ToString();
}
}
}

@ -33,11 +33,30 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Chloe, Version=5.25.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Chloe.5.25.0\lib\net46\Chloe.dll</HintPath>
</Reference>
<Reference Include="Chloe.SQLite, Version=5.25.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Chloe.SQLite.5.25.0\lib\net46\Chloe.SQLite.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="mscorlib" />
<Reference Include="NewLife.Core, Version=10.10.2024.803, Culture=neutral, PublicKeyToken=8343210f0b524456, processorArchitecture=MSIL">
<HintPath>..\packages\NewLife.Core.10.10.2024.803\lib\net461\NewLife.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite">
<HintPath>..\Dll\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.IO.Compression" />
<Reference Include="System.Management" />
<Reference Include="System.Numerics" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@ -70,6 +89,7 @@
<EmbeddedResource Include="ScrewdriverTest.resx">
<DependentUpon>ScrewdriverTest.cs</DependentUpon>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@ -84,10 +104,25 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DNSD_DB\DNSD_DB.csproj">
<Project>{ca803c5b-cd45-478c-b427-dda95c4bdfc3}</Project>
<Name>DNSD_DB</Name>
</ProjectReference>
<ProjectReference Include="..\NDSD-TouchSocket\NDSD_TouchSocket.csproj">
<Project>{B2580256-9ED8-4985-BE38-3F771B13E9FD}</Project>
<Name>NDSD_TouchSocket</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="ndsd.db">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="x64\SQLite.Interop.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="x86\SQLite.Interop.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -4,6 +4,7 @@ using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using System.Windows.Forms;
using NewLife.Log;
namespace NDSD_Screwdriver
{
@ -17,6 +18,8 @@ namespace NDSD_Screwdriver
[STAThread]
static void Main()
{
XTrace.UseWinForm();
XTrace.UseConsole();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new ScrewdriverTest());

Binary file not shown.

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Chloe" version="5.25.0" targetFramework="net48" />
<package id="Chloe.SQLite" version="5.25.0" targetFramework="net48" />
<package id="NewLife.Core" version="10.10.2024.803" targetFramework="net48" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
</packages>
Loading…
Cancel
Save