diff --git a/Falcon.SugarApi.Test/CreateTable/CreateTable.cs b/Falcon.SugarApi.Test/CreateTable/CreateTable.cs new file mode 100644 index 0000000..2af1c7d --- /dev/null +++ b/Falcon.SugarApi.Test/CreateTable/CreateTable.cs @@ -0,0 +1,116 @@ +using Falcon.SugarApi.DatabaseDefinitions; +using Falcon.SugarApi.DatabaseDefinitions.EntityServices; +using Falcon.SugarApi.DatabaseManager; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Falcon.SugarApi.Test.CreateTable +{ + /// + /// 创建表测试 + /// + [TestClass] + public class CreateTable + { + /// + /// 创建JM_OrderCancelConfirm测试 + /// + [TestMethod] + public void CreateTable_JM_OrderCancelConfirm() { + var db = GetDbcontext(); + try { + db.CodeFirst.InitTables(); + + } + catch(Exception ex) { + + throw ex; + } + } + + + private static Dbcontext GetDbcontext() { + + var cc = new ConnectionConfig { + ConnectionString = "DATA SOURCE=(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.100.29)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME =his)));PASSWORD=DAQIAO#W0rd2021;PERSIST SECURITY INFO=True;POOLING=True;Max Pool Size=100;Min Pool Size=10;USER ID=HARMONYHIS;Connection Lifetime=120;Connection Timeout=60", + DbType = DbType.Oracle, + + }; + //ConfigureExternalServices(cc); + var sc = new ServiceCollection(); + sc.AddSingleton(); + var sp = sc.BuildServiceProvider(); + return new Dbcontext(cc,sp); + } + + private static void ConfigureExternalServices(ConnectionConfig config) { + config.ConfigureExternalServices ??= new ConfigureExternalServices(); + var ces = config.ConfigureExternalServices; + ces.EntityNameService = (t,e) => { + new TableNameTableService().SetupTable(t,e); + }; + ces.EntityService = (p,c) => { + new SetupKeyColumnServices().SetupColumn(p,c); + new SetupLengthColumnServices().SetupColumn(p,c); + new SetupNullableColumnServices().SetupColumn(p,c); + new JsonTypeColumnServices().SetupColumn(p,c); + }; + } + + + + } + + public class Dbcontext:DbContextBase + { + public Dbcontext(ConnectionConfig config,IServiceProvider service) : base(config,service) { + } + } + + /// + /// 计免订单退费确认 + /// + public class JM_OrderCancelConfirm:SugarBasicTable3 + { + + /// + /// 医疗机构代码 必填 string + /// + [StringLength(50), Required] + public string? yljgdm { get; set; } + /// + /// 收费订单流水号 挂号记录唯一标识 string + /// + [StringLength(50), Required] + public string? orderno { get; set; } + /// + /// 操作员号 当前登录操作员号(HIS系统),必填 string + /// + [StringLength(50)] + public string? czyh { get; set; } + + } + + public class MyILogger:ILogger + { + public IDisposable BeginScope(TState state) { + throw new NotImplementedException(); + } + + public bool IsEnabled(LogLevel logLevel) { + throw new NotImplementedException(); + } + + public void Log(LogLevel logLevel,EventId eventId,TState state,Exception? exception,Func formatter) { + throw new NotImplementedException(); + } + } +}