团餐订单
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

46 lines
1.4 KiB

  1. using BPA.KitChen.GroupMealOrder.SqlSugar;
  2. using Furion.DependencyInjection;
  3. using Furion.DynamicApiController;
  4. using Microsoft.AspNetCore.Authorization;
  5. using Microsoft.AspNetCore.Mvc;
  6. using SqlSugar;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Reflection;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. namespace BPA.KitChen.GroupMealOrder.Application.Service.TestService
  14. {
  15. [ApiDescriptionSettings("测试", Tag = "测试", SplitCamelCase = false)]
  16. [AllowAnonymous]
  17. public class TestService: IDynamicApiController, ITransient, ITestService
  18. {
  19. /// <summary>
  20. /// CodeFirst
  21. /// </summary>
  22. /// <param name="tableNames"></param>
  23. public void CodeFirst()
  24. {
  25. try
  26. {
  27. var types = Assembly.Load("BPA.KitChen.GroupMealOrder.Core").GetTypes()
  28. .Where(x => x.Namespace != null
  29. && x.GetCustomAttribute<SugarTable>() != null
  30. && x.Namespace.Contains("BPA.KitChen.GroupMealOrder.Core.Entity"))
  31. .ToArray();
  32. types = types.Where(x => x.Name != "BPA_Order"&&x.Name!= "BPA_SubOrder").ToArray();
  33. SqlSugarDb.Db.CodeFirst.InitTables(types);
  34. }
  35. catch (Exception e)
  36. {
  37. Console.WriteLine(e);
  38. throw;
  39. }
  40. }
  41. }
  42. }