feat: 搭建VS2017解决方案骨架(8项目+前端文件夹),编译通过0错误
- CncDataSystem.sln: 4层源码项目 + 4测试项目 + frontend解决方案文件夹 - CncModels: ApiResponse/PagedResult/PagedQuery/ErrorCode 基础类 - CncRepository: BaseRepository 双库连接管理(BusinessRepository/LogRepository) - CncService: BusinessException 业务异常基类 - CncWebApi: WebApiConfig路由配置/GlobalExceptionFilter/HealthController/Web.config - 测试项目: xUnit + Moq + Microsoft.NET.Test.Sdk - NuGet: Dapper + MySqlConnector + Newtonsoft.Json + log4net + JWT - 编译: dotnet build 8项目全部通过main
parent
9bb4b8246d
commit
0ba5cede73
@ -0,0 +1,72 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17.VisualStudioVersion = 17.0.31903.59
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CncModels", "src\CncModels\CncModels.csproj", "{898BBE60-B7CB-4602-BFC6-7651B062F986}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CncRepository", "src\CncRepository\CncRepository.csproj", "{534CA636-CA2C-4038-B02E-5258981479D3}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CncService", "src\CncService\CncService.csproj", "{8B105015-DFDF-4BFC-B0BA-471E0FA1AAC8}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CncWebApi", "src\CncWebApi\CncWebApi.csproj", "{A39DE219-F8CB-44CD-9907-8FCAA3766C8B}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CncModels.Tests", "tests\CncModels.Tests\CncModels.Tests.csproj", "{9AAF88A1-B04C-403E-A559-7622B13F9872}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CncRepository.Tests", "tests\CncRepository.Tests\CncRepository.Tests.csproj", "{D581A6D4-25A1-4143-8155-2A895AC52E5E}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CncService.Tests", "tests\CncService.Tests\CncService.Tests.csproj", "{BD63C81D-29E3-4B53-A41A-F10A04ED1052}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CncWebApi.Tests", "tests\CncWebApi.Tests\CncWebApi.Tests.csproj", "{4DAE1DA8-E028-4025-AA80-1E698976F74C}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "frontend", "frontend", "{D099B5F2-7E64-4A0A-B9ED-D085421E996E}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
frontend\package.json = frontend\package.json
|
||||||
|
frontend\vite.config.ts = frontend\vite.config.ts
|
||||||
|
frontend\tsconfig.json = frontend\tsconfig.json
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{898BBE60-B7CB-4602-BFC6-7651B062F986}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{898BBE60-B7CB-4602-BFC6-7651B062F986}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{898BBE60-B7CB-4602-BFC6-7651B062F986}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{898BBE60-B7CB-4602-BFC6-7651B062F986}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{534CA636-CA2C-4038-B02E-5258981479D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{534CA636-CA2C-4038-B02E-5258981479D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{534CA636-CA2C-4038-B02E-5258981479D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{534CA636-CA2C-4038-B02E-5258981479D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{8B105015-DFDF-4BFC-B0BA-471E0FA1AAC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{8B105015-DFDF-4BFC-B0BA-471E0FA1AAC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{8B105015-DFDF-4BFC-B0BA-471E0FA1AAC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{8B105015-DFDF-4BFC-B0BA-471E0FA1AAC8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{A39DE219-F8CB-44CD-9907-8FCAA3766C8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A39DE219-F8CB-44CD-9907-8FCAA3766C8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A39DE219-F8CB-44CD-9907-8FCAA3766C8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A39DE219-F8CB-44CD-9907-8FCAA3766C8B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{9AAF88A1-B04C-403E-A559-7622B13F9872}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{9AAF88A1-B04C-403E-A559-7622B13F9872}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{9AAF88A1-B04C-403E-A559-7622B13F9872}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{9AAF88A1-B04C-403E-A559-7622B13F9872}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{D581A6D4-25A1-4143-8155-2A895AC52E5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{D581A6D4-25A1-4143-8155-2A895AC52E5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{D581A6D4-25A1-4143-8155-2A895AC52E5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{D581A6D4-25A1-4143-8155-2A895AC52E5E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{BD63C81D-29E3-4B53-A41A-F10A04ED1052}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{BD63C81D-29E3-4B53-A41A-F10A04ED1052}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{BD63C81D-29E3-4B53-A41A-F10A04ED1052}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{BD63C81D-29E3-4B53-A41A-F10A04ED1052}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{4DAE1DA8-E028-4025-AA80-1E698976F74C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4DAE1DA8-E028-4025-AA80-1E698976F74C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4DAE1DA8-E028-4025-AA80-1E698976F74C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4DAE1DA8-E028-4025-AA80-1E698976F74C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(NestedProjects) = preSolution
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
# Vue 3 + TypeScript + Vite
|
||||||
|
|
||||||
|
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
||||||
|
|
||||||
|
Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const d = 'E:/opencode/haoliang/frontend/src/views';
|
||||||
|
|
||||||
|
const fixes = [
|
||||||
|
['(rows: any[])', '(rows: Record<string,unknown>[])'],
|
||||||
|
['(record: any)', '(record: Record<string,unknown>)'],
|
||||||
|
['const params: any =', 'const params: Record<string,unknown> ='],
|
||||||
|
['(r: any) => r.id', '(r: {id:number}) => r.id'],
|
||||||
|
['function onFileChange(file: any)', 'function onFileChange(file: Record<string,unknown>)'],
|
||||||
|
['params: { row: any; rowIndex', 'params: { row: Record<string,unknown>; rowIndex'],
|
||||||
|
['const payload: any =', 'const payload: Record<string,unknown> ='],
|
||||||
|
['(c: any) => c.configKey.toLowerCase().includes(kw) || c.description.t',
|
||||||
|
'(c: {configKey:string;description:string}) => c.configKey.toLowerCase().includes(kw) || c.description.t'],
|
||||||
|
['_rule: any, value: string, callback: any', '_rule: unknown, value: string, callback: (err?:Error)=>void'],
|
||||||
|
['rule: any, value: any, callback: any', 'rule: unknown, value: string, callback: (err?:Error)=>void'],
|
||||||
|
];
|
||||||
|
|
||||||
|
let total = 0;
|
||||||
|
fs.readdirSync(d).forEach(sub => {
|
||||||
|
const subDir = path.join(d, sub);
|
||||||
|
if (!fs.statSync(subDir).isDirectory()) return;
|
||||||
|
fs.readdirSync(subDir).forEach(f => {
|
||||||
|
if (!f.endsWith('.vue')) return;
|
||||||
|
const fp = path.join(subDir, f);
|
||||||
|
let c = fs.readFileSync(fp, 'utf8');
|
||||||
|
let n = 0;
|
||||||
|
fixes.forEach(([from, to]) => {
|
||||||
|
if (c.includes(from)) {
|
||||||
|
c = c.split(from).join(to);
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (n > 0) {
|
||||||
|
fs.writeFileSync(fp, c, 'utf8');
|
||||||
|
console.log(f + ': ' + n);
|
||||||
|
total += n;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
console.log('Total fixed: ' + total);
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
// Simple, targeted refactor: replace common inline styles with CSS utility classes
|
||||||
|
// Only handles exact pattern matches and only when the tag doesn't already have a class attribute.
|
||||||
|
// This is a safe, incremental step. Run this script from the project root: `node frontend/scripts/refactor_inline_styles.js`
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
function walkVueFiles(dir) {
|
||||||
|
const res = [];
|
||||||
|
const items = fs.readdirSync(dir, { withFileTypes: true });
|
||||||
|
for (const it of items) {
|
||||||
|
const full = path.join(dir, it.name);
|
||||||
|
if (it.isDirectory()) {
|
||||||
|
res.push(...walkVueFiles(full));
|
||||||
|
} else if (it.isFile() && full.endsWith('.vue')) {
|
||||||
|
res.push(full);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
const projectRoot = path.resolve(__dirname, '..');
|
||||||
|
const targetDir = path.resolve(projectRoot, 'src', 'views');
|
||||||
|
const files = walkVueFiles(targetDir);
|
||||||
|
|
||||||
|
const replacements = [
|
||||||
|
{ find: 'style="margin-bottom:16px"', replace: 'class="mb-16"' },
|
||||||
|
{ find: "style='margin-bottom:16px'", replace: "class='mb-16'" },
|
||||||
|
{ find: 'style="margin-top:20px"', replace: 'class="mt-20"' },
|
||||||
|
{ find: "style='margin-top:20px'", replace: "class='mt-20'" },
|
||||||
|
{ find: 'style="display:flex;align-items:center;gap:12px"', replace: 'class="flex-gap"' },
|
||||||
|
{ find: "style='display:flex;align-items:center;gap:12px'", replace: "class='flex-gap'" },
|
||||||
|
{ find: 'style="font-size:16px;font-weight:bold"', replace: 'class="page-title"' },
|
||||||
|
{ find: "style='font-size:16px;font-weight:bold'", replace: "class='page-title'" },
|
||||||
|
{ find: 'style="color: var(--el-color-primary); cursor: pointer; text-decoration: none;"', replace: 'class="link-text"' },
|
||||||
|
{ find: "style='color: var(--el-color-primary); cursor: pointer; text-decoration: none;'", replace: "class='link-text'" },
|
||||||
|
];
|
||||||
|
|
||||||
|
let totalReplacements = 0;
|
||||||
|
let totalFilesLaunched = 0;
|
||||||
|
|
||||||
|
for (const file of files) {
|
||||||
|
let content = fs.readFileSync(file, 'utf8');
|
||||||
|
let modified = false;
|
||||||
|
const lines = content.split(/\r?\n/);
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
let line = lines[i];
|
||||||
|
// Quick skip if line already has a class attribute
|
||||||
|
if (line.includes('style=') && !line.includes('class=')) {
|
||||||
|
for (const r of replacements) {
|
||||||
|
if (line.includes(r.find)) {
|
||||||
|
line = line.replace(r.find, r.replace);
|
||||||
|
modified = true;
|
||||||
|
totalReplacements++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lines[i] = line;
|
||||||
|
}
|
||||||
|
if (modified) {
|
||||||
|
totalFilesLaunched++;
|
||||||
|
fs.writeFileSync(file, lines.join('\n'), 'utf8');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`refactor_inline_styles.js: applied ${totalReplacements} replacements across ${totalFilesLaunched} files.`);
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// 通用信息
|
||||||
|
[assembly: AssemblyTitle("CncModels")]
|
||||||
|
[assembly: AssemblyDescription("CNC机床数据采集系统 - 数据模型层")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("CncDataSystem")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2026")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// COM 可见性
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// 版本号
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using System.Data;
|
||||||
|
using MySqlConnector;
|
||||||
|
|
||||||
|
namespace CncRepository.Base
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 仓储基类,提供数据库连接管理
|
||||||
|
/// 每个仓储方法应 using(CreateConnection()) 自动释放连接
|
||||||
|
/// </summary>
|
||||||
|
public abstract class BaseRepository
|
||||||
|
{
|
||||||
|
private readonly string _connectionString;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化仓储基类
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="connectionString">数据库连接字符串</param>
|
||||||
|
protected BaseRepository(string connectionString)
|
||||||
|
{
|
||||||
|
_connectionString = connectionString ?? throw new ArgumentNullException(nameof(connectionString));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建新的数据库连接
|
||||||
|
/// 调用方需使用 using 语句确保连接释放
|
||||||
|
/// </summary>
|
||||||
|
/// <example>
|
||||||
|
/// using (var conn = CreateConnection())
|
||||||
|
/// {
|
||||||
|
/// return conn.QueryFirstOrDefault<Machine>("SELECT * FROM cnc_machine WHERE id = @Id", new { Id = id });
|
||||||
|
/// }
|
||||||
|
/// </example>
|
||||||
|
protected IDbConnection CreateConnection()
|
||||||
|
{
|
||||||
|
return new MySqlConnection(_connectionString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("CncRepository")]
|
||||||
|
[assembly: AssemblyDescription("CNC机床数据采集系统 - 数据访问层")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("CncDataSystem")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2026")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net472</TargetFramework>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<RootNamespace>CncService</RootNamespace>
|
||||||
|
<AssemblyName>CncService</AssemblyName>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net472" Version="1.0.3" PrivateAssets="all" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\CncModels\CncModels.csproj" />
|
||||||
|
<ProjectReference Include="..\CncRepository\CncRepository.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("CncService")]
|
||||||
|
[assembly: AssemblyDescription("CNC机床数据采集系统 - 业务逻辑层")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("CncDataSystem")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2026")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Web.Http;
|
||||||
|
|
||||||
|
namespace CncWebApi.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 健康检查控制器
|
||||||
|
/// 用于验证API服务是否正常运行
|
||||||
|
/// </summary>
|
||||||
|
[RoutePrefix("api")]
|
||||||
|
public class HealthController : ApiController
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 健康检查端点
|
||||||
|
/// GET /api/health
|
||||||
|
/// </summary>
|
||||||
|
[HttpGet]
|
||||||
|
[Route("health")]
|
||||||
|
public IHttpActionResult Check()
|
||||||
|
{
|
||||||
|
return Ok(new
|
||||||
|
{
|
||||||
|
status = "healthy",
|
||||||
|
timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<%@ Application Codebehind="Global.asax.cs" Inherits="CncWebApi.WebApiApplication" Language="C#" %>
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Web;
|
||||||
|
using System.Web.Http;
|
||||||
|
using CncWebApi.App_Start;
|
||||||
|
|
||||||
|
namespace CncWebApi
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Web API 应用程序入口
|
||||||
|
/// IIS 启动时自动调用 Application_Start
|
||||||
|
/// </summary>
|
||||||
|
public class WebApiApplication : HttpApplication
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 应用启动时执行,注册路由和全局配置
|
||||||
|
/// </summary>
|
||||||
|
protected void Application_Start()
|
||||||
|
{
|
||||||
|
GlobalConfiguration.Configure(WebApiConfig.Register);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("CncWebApi")]
|
||||||
|
[assembly: AssemblyDescription("CNC机床数据采集系统 - Web API 主项目")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("CncDataSystem")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2026")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net472</TargetFramework>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<RootNamespace>CncModels.Tests</RootNamespace>
|
||||||
|
<AssemblyName>CncModels.Tests</AssemblyName>
|
||||||
|
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||||
|
<!-- 测试项目不生成XML文档 -->
|
||||||
|
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net472" Version="1.0.3" PrivateAssets="all" />
|
||||||
|
<PackageReference Include="xunit" Version="2.8.1" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1" />
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\CncModels\CncModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net472</TargetFramework>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<RootNamespace>CncRepository.Tests</RootNamespace>
|
||||||
|
<AssemblyName>CncRepository.Tests</AssemblyName>
|
||||||
|
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||||
|
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net472" Version="1.0.3" PrivateAssets="all" />
|
||||||
|
<PackageReference Include="xunit" Version="2.8.1" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1" />
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
|
||||||
|
<PackageReference Include="Dapper" Version="2.1.35" />
|
||||||
|
<PackageReference Include="MySqlConnector" Version="2.3.7" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\CncModels\CncModels.csproj" />
|
||||||
|
<ProjectReference Include="..\..\src\CncRepository\CncRepository.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net472</TargetFramework>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<RootNamespace>CncService.Tests</RootNamespace>
|
||||||
|
<AssemblyName>CncService.Tests</AssemblyName>
|
||||||
|
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||||
|
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net472" Version="1.0.3" PrivateAssets="all" />
|
||||||
|
<PackageReference Include="xunit" Version="2.8.1" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1" />
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
|
||||||
|
<PackageReference Include="Moq" Version="4.20.72" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\CncModels\CncModels.csproj" />
|
||||||
|
<ProjectReference Include="..\..\src\CncRepository\CncRepository.csproj" />
|
||||||
|
<ProjectReference Include="..\..\src\CncService\CncService.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net472</TargetFramework>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<RootNamespace>CncWebApi.Tests</RootNamespace>
|
||||||
|
<AssemblyName>CncWebApi.Tests</AssemblyName>
|
||||||
|
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||||
|
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net472" Version="1.0.3" PrivateAssets="all" />
|
||||||
|
<PackageReference Include="xunit" Version="2.8.1" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1" />
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
|
||||||
|
<PackageReference Include="Moq" Version="4.20.72" />
|
||||||
|
<!-- 用于测试 Controller 的 HTTP 相关类 -->
|
||||||
|
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.3.0" />
|
||||||
|
<PackageReference Include="Microsoft.AspNet.WebApi.Owin" Version="5.3.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\CncModels\CncModels.csproj" />
|
||||||
|
<ProjectReference Include="..\..\src\CncRepository\CncRepository.csproj" />
|
||||||
|
<ProjectReference Include="..\..\src\CncService\CncService.csproj" />
|
||||||
|
<ProjectReference Include="..\..\src\CncWebApi\CncWebApi.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
Loading…
Reference in New Issue