update:修改项目名称从Dilon到Ewide
This commit is contained in:
28
Api/Ewide.Application/Dilon.Application.csproj
Normal file
28
Api/Ewide.Application/Dilon.Application.csproj
Normal file
@@ -0,0 +1,28 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<NoWarn>1701;1702;1591</NoWarn>
|
||||
<DocumentationFile>Dilon.Application.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="applicationsettings.json" />
|
||||
<None Remove="Dilon.Application.xml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="applicationsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Dilon.Core\Dilon.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Furion.Extras.DatabaseAccessor.SqlSugar" Version="1.17.4" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
69
Api/Ewide.Application/Dilon.Application.xml
Normal file
69
Api/Ewide.Application/Dilon.Application.xml
Normal file
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Dilon.Application</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:Dilon.Application.CodeGenTest">
|
||||
<summary>
|
||||
代码生成实体测试(EF)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Dilon.Application.CodeGenTest.Name">
|
||||
<summary>
|
||||
名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Dilon.Application.CodeGenTest.NickName">
|
||||
<summary>
|
||||
昵称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Dilon.Application.CodeGenTest.Birthday">
|
||||
<summary>
|
||||
生日
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Dilon.Application.CodeGenTest.Age">
|
||||
<summary>
|
||||
年龄
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Dilon.Application.Test">
|
||||
<summary>
|
||||
SqlSugar实体
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Dilon.Application.Test.Id">
|
||||
<summary>
|
||||
雪花Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Dilon.Application.Test.Name">
|
||||
<summary>
|
||||
名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Dilon.Application.Test.Age">
|
||||
<summary>
|
||||
年龄
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Dilon.Application.Test.CreateTime">
|
||||
<summary>
|
||||
创建时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Dilon.Application.TestService">
|
||||
<summary>
|
||||
业务服务及集成SqlSugar用法事例
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Dilon.Application.TestService.GetDescription">
|
||||
<summary>
|
||||
测试方法
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
39
Api/Ewide.Application/Entity/CodeGenTest.cs
Normal file
39
Api/Ewide.Application/Entity/CodeGenTest.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Dilon.Core;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Ewide.Application
|
||||
{
|
||||
/// <summary>
|
||||
/// 代码生成实体测试(EF)
|
||||
/// </summary>
|
||||
[Table("code_gen_test")]
|
||||
[Comment("代码生成业务")]
|
||||
public class CodeGenTest : DEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[Comment("名称")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 昵称
|
||||
/// </summary>
|
||||
[Comment("昵称")]
|
||||
public string NickName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生日
|
||||
/// </summary>
|
||||
[Comment("生日")]
|
||||
public DateTimeOffset Birthday { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 年龄
|
||||
/// </summary>
|
||||
[Comment("年龄")]
|
||||
public int Age { get; set; }
|
||||
}
|
||||
}
|
||||
1
Api/Ewide.Application/Entity/README.md
Normal file
1
Api/Ewide.Application/Entity/README.md
Normal file
@@ -0,0 +1 @@
|
||||
/** 您的业务实体文件写在此文件夹下面 **/
|
||||
35
Api/Ewide.Application/Entity/Test.cs
Normal file
35
Api/Ewide.Application/Entity/Test.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace Ewide.Application
|
||||
{
|
||||
/// <summary>
|
||||
/// SqlSugar实体
|
||||
/// </summary>
|
||||
[SugarTable("Test", TableDescription = "我的业务表")]
|
||||
public class Test
|
||||
{
|
||||
/// <summary>
|
||||
/// 雪花Id
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDataType = "Nvarchar(32)")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 年龄
|
||||
/// </summary>
|
||||
public int Age { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public DateTimeOffset CreateTime { get; set; }
|
||||
}
|
||||
}
|
||||
3
Api/Ewide.Application/README.md
Normal file
3
Api/Ewide.Application/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
1、原则上服务应该放在Application层次,考虑将咱自己的业务层直接写在Application里面好些,后续升级后,咱大家直接升级就行了,减少冲突!
|
||||
2、系统默认ORM为EF Core,如果觉得不趁手,可以自行更换
|
||||
3、在此应用层默认集成了SqlSugar,其他ORM类同,可以多个ORM并行开发,熟悉哪个用哪个
|
||||
7
Api/Ewide.Application/Service/ITestService.cs
Normal file
7
Api/Ewide.Application/Service/ITestService.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Ewide.Application
|
||||
{
|
||||
public interface ITestService
|
||||
{
|
||||
string GetDescription();
|
||||
}
|
||||
}
|
||||
76
Api/Ewide.Application/Service/TestService.cs
Normal file
76
Api/Ewide.Application/Service/TestService.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using Dilon.Core;
|
||||
using Furion.DependencyInjection;
|
||||
using Furion.DynamicApiController;
|
||||
using Furion.Snowflake;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Application
|
||||
{
|
||||
/// <summary>
|
||||
/// 业务服务及集成SqlSugar用法事例
|
||||
/// </summary>
|
||||
public class TestService : ITestService, IDynamicApiController, ITransient
|
||||
{
|
||||
//private readonly ISqlSugarRepository<Test> _testRep;
|
||||
//private readonly SqlSugarClient _db; // SqlSugar对象
|
||||
|
||||
public TestService(/*ISqlSugarRepository<Test> sqlSugarRep*/)
|
||||
{
|
||||
//_testRep = sqlSugarRep;
|
||||
//_db = (SqlSugarClient)_testRep.Context;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 测试方法
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/test")]
|
||||
public string GetDescription()
|
||||
{
|
||||
return "Admin.NET";
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// 增加数据
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//[HttpPost("/test/add")]
|
||||
//public async Task AddTestAsync()
|
||||
//{
|
||||
// var test = new Test()
|
||||
// {
|
||||
// Id = IDGenerator.NextId(),
|
||||
// Name = "Admin.NET",
|
||||
// Age = 1,
|
||||
// CreateTime = DateTimeOffset.Now
|
||||
// };
|
||||
// await _testRep.InsertAsync(test);
|
||||
// // _db.Insertable(test).ExecuteCommand();
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 查询所有
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//[HttpPost("/test/page")]
|
||||
//public async Task<List<Test>> GetTestListAsync()
|
||||
//{
|
||||
// return await _testRep.Entities.ToListAsync();
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 查询系统用户
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//[HttpPost("/test/userPage")]
|
||||
//public async Task<dynamic> GetUserListAsync()
|
||||
//{
|
||||
// return await _db.Queryable<SysUser>().ToListAsync();
|
||||
//}
|
||||
}
|
||||
}
|
||||
31
Api/Ewide.Application/Startup.cs
Normal file
31
Api/Ewide.Application/Startup.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Furion;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
using System.Linq;
|
||||
|
||||
namespace Ewide.Application
|
||||
{
|
||||
public class Startup : AppStartup
|
||||
{
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
//services.AddSqlSugar(new ConnectionConfig
|
||||
//{
|
||||
// ConnectionString = App.Configuration["ConnectionStrings:DefaultConnection"],
|
||||
// DbType = DbType.Sqlite,
|
||||
// IsAutoCloseConnection = true,
|
||||
// InitKeyType = InitKeyType.Attribute
|
||||
//},
|
||||
//db =>
|
||||
//{
|
||||
// // db.DbMaintenance.CreateDatabase();
|
||||
// // db.CodeFirst.SetStringDefaultLength(200).InitTables(typeof(Test));
|
||||
|
||||
// db.Aop.OnLogExecuting = (sql, pars) =>
|
||||
// {
|
||||
// App.PrintToMiniProfiler("SqlSugar", "Info", sql + "\r\n" + string.Join(",", pars?.Select(it => it.ParameterName + ":" + it.Value)));
|
||||
// };
|
||||
//});
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Api/Ewide.Application/applicationsettings.json
Normal file
3
Api/Ewide.Application/applicationsettings.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user