117 lines
3.7 KiB
C#
117 lines
3.7 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// 创建表测试
|
|
/// </summary>
|
|
[TestClass]
|
|
public class CreateTable
|
|
{
|
|
/// <summary>
|
|
/// 创建JM_OrderCancelConfirm测试
|
|
/// </summary>
|
|
[TestMethod]
|
|
public void CreateTable_JM_OrderCancelConfirm() {
|
|
var db = GetDbcontext();
|
|
try {
|
|
db.CodeFirst.InitTables<JM_OrderCancelConfirm>();
|
|
|
|
}
|
|
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<MyILogger>();
|
|
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) {
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 计免订单退费确认
|
|
/// </summary>
|
|
public class JM_OrderCancelConfirm:SugarBasicTable3
|
|
{
|
|
|
|
/// <summary>
|
|
/// 医疗机构代码 必填 string
|
|
/// </summary>
|
|
[StringLength(50), Required]
|
|
public string? yljgdm { get; set; }
|
|
/// <summary>
|
|
/// 收费订单流水号 挂号记录唯一标识 string
|
|
/// </summary>
|
|
[StringLength(50), Required]
|
|
public string? orderno { get; set; }
|
|
/// <summary>
|
|
/// 操作员号 当前登录操作员号(HIS系统),必填 string
|
|
/// </summary>
|
|
[StringLength(50)]
|
|
public string? czyh { get; set; }
|
|
|
|
}
|
|
|
|
public class MyILogger:ILogger<MyILogger>
|
|
{
|
|
public IDisposable BeginScope<TState>(TState state) {
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public bool IsEnabled(LogLevel logLevel) {
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public void Log<TState>(LogLevel logLevel,EventId eventId,TState state,Exception? exception,Func<TState,Exception?,string> formatter) {
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|