更新星尘,注册Ant.Web

This commit is contained in:
大石头 2022-04-06 18:23:05 +08:00
parent 6a7f63ccf6
commit f413567795
9 changed files with 17 additions and 51 deletions

View File

@ -30,12 +30,6 @@
<ItemGroup>
<None Remove="Build.tt" />
</ItemGroup>
<ItemGroup>
<Content Include="Build.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>Build.log</LastGenOutput>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="NewLife.XCode" Version="11.0.2022.401" />
</ItemGroup>

View File

@ -1,34 +0,0 @@
<#@ template language="C#" hostSpecific="true" debug="true" #>
<#@ assembly name="netstandard" #>
<#@ assembly name="$(ProjectDir)\..\DLL\NewLife.Core.dll" #>
<#@ assembly name="$(ProjectDir)\..\DLL\XCode.dll" #>
<#@ import namespace="System.Diagnostics" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="XCode.Code" #>
<#@ output extension=".log" #>
<#
// 设置当前工作目录
PathHelper.BasePath = Host.ResolvePath(".");
// 加载模型文件,得到数据表
var option = new BuilderOption();
var tables = ClassBuilder.LoadModels(null, option, out var atts);
EntityBuilder.FixModelFile(null, option, atts, tables);
// 生成实体类
//option.BaseClass = "I{name}";
//option.ModelNameForCopy = "I{name}";
EntityBuilder.BuildTables(tables, option, chineseFileName: true);
// 生成简易模型类
option.Output = @"Output\EntityModels\";
option.ClassNameTemplate = "{name}Model";
option.ModelNameForCopy = "I{name}";
//ClassBuilder.BuildModels(tables, option);
// 生成简易接口
option.BaseClass = null;
option.ClassNameTemplate = null;
option.Output = @"Output\EntityInterfaces\";
//ClassBuilder.BuildInterfaces(tables, option);
#>

View File

@ -366,7 +366,7 @@ namespace AntJob.Data.Entity
case "Name": _Name = Convert.ToString(value); break;
case "ClassName": _ClassName = Convert.ToString(value); break;
case "DisplayName": _DisplayName = Convert.ToString(value); break;
case "Mode": _Mode = (JobModes)value; break;
case "Mode": _Mode = (JobModes)value.ToInt(); break;
case "Topic": _Topic = Convert.ToString(value); break;
case "MessageCount": _MessageCount = value.ToInt(); break;
case "Start": _Start = value.ToDateTime(); break;

View File

@ -260,7 +260,7 @@ namespace AntJob.Data.Entity
case "Speed": _Speed = value.ToInt(); break;
case "Cost": _Cost = value.ToInt(); break;
case "FullCost": _FullCost = value.ToInt(); break;
case "Status": _Status = (JobStatus)value; break;
case "Status": _Status = (JobStatus)value.ToInt(); break;
case "MsgCount": _MsgCount = value.ToInt(); break;
case "Server": _Server = Convert.ToString(value); break;
case "ProcessID": _ProcessID = value.ToInt(); break;

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Tables xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="http://www.newlifex.com http://www.newlifex.com/Model2020.xsd" Output="Entity" NameSpace="AntJob.Data.Entity" ConnName="Ant" BaseClass="EntityBase" xmlns="http://www.newlifex.com/Model2020.xsd">
<Tables xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="http://www.newlifex.com http://www.newlifex.com/Model2022.xsd" Output="Entity" NameSpace="AntJob.Data.Entity" ConnName="Ant" BaseClass="EntityBase" Version="11.0.2022.0405" Document="https://www.yuque.com/smartstone/xcode/model" xmlns="http://www.newlifex.com/Model2022.xsd">
<Table Name="App" Description="应用系统。数据作业隶属于某个应用">
<Columns>
<Column Name="ID" DataType="Int32" Identity="True" PrimaryKey="True" Description="编号" />

BIN
AntJob.Data/xcodetool.exe Normal file

Binary file not shown.

View File

@ -29,7 +29,7 @@
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="NewLife.Stardust" Version="2.0.2022.404" />
<PackageReference Include="NewLife.Stardust.Extensions" Version="2.0.2022.404" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AntJob.Data\AntJob.Data.csproj" />

View File

@ -19,6 +19,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NewLife.Cube.Core" Version="5.0.2022.401" />
<PackageReference Include="NewLife.Stardust.Extensions" Version="2.0.2022.404" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AntJob.Data\AntJob.Data.csproj" />

View File

@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using NewLife.Cube;
using XCode;
namespace AntJob.Web
{
@ -12,13 +13,8 @@ namespace AntJob.Web
public void ConfigureServices(IServiceCollection services)
{
#region
//var star = new StarFactory(null, null, null);
//services.AddSingleton(star);
//services.AddSingleton(star.Tracer);
//services.AddSingleton(star.Config);
#endregion
// 配置星尘。借助StarAgent或者读取配置文件 config/star.config 中的服务器地址
var star = services.AddStardust(null);
services.AddControllersWithViews();
services.AddCube();
@ -26,6 +22,12 @@ namespace AntJob.Web
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
// 预热数据层,执行反向工程建表等操作
EntityFactory.InitConnection("Membership");
EntityFactory.InitConnection("Log");
EntityFactory.InitConnection("Cube");
EntityFactory.InitConnection("Ant");
// 使用Cube前添加自己的管道
if (env.IsDevelopment())
app.UseDeveloperExceptionPage();
@ -46,6 +48,9 @@ namespace AntJob.Web
"{controller=CubeHome}/{action=Index}/{id?}"
);
});
// 启用星尘注册中心,向注册中心注册服务,服务消费者将自动更新服务端地址列表
app.RegisterService("Ant.Web", null, "dev");
}
}
}