using BPA.KitChen.GroupMealOrder.SqlSugar; using Furion.DependencyInjection; using Furion.DynamicApiController; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace BPA.KitChen.GroupMealOrder.Application.Service.TestService { [ApiDescriptionSettings("测试", Tag = "测试", SplitCamelCase = false)] [AllowAnonymous] public class TestService: IDynamicApiController, ITransient, ITestService { /// /// CodeFirst /// /// public void CodeFirst() { try { var types = Assembly.Load("BPA.KitChen.GroupMealOrder.Core").GetTypes() .Where(x => x.Namespace != null && x.GetCustomAttribute() != null && x.Namespace.Contains("BPA.KitChen.GroupMealOrder.Core.Entity")) .ToArray(); types = types.Where(x => x.Name != "BPA_Order"&&x.Name!= "BPA_SubOrder").ToArray(); SqlSugarDb.Db.CodeFirst.InitTables(types); } catch (Exception e) { Console.WriteLine(e); throw; } } } }