TestCreateTable.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using XYY.Core.Standard.Data.Infrastructure;
  8. using XYY.DataMSHelper.Standard;
  9. namespace XYY.Test
  10. {
  11. [TestClass]
  12. public class TestCreateTable
  13. {
  14. [TestMethod]
  15. public async Task Test()
  16. {
  17. string sqlConn = "Server=183.57.73.109,3433;Pooling=true;Max Pool Size=40000;Min Pool Size=0;initial catalog=xyy_wms;uid=xyy;pwd=n3T3RTlM;MultipleActiveResultSets=True;";
  18. using (IUnitOfWork _unitOfWork = new UnitOfWork(new System.Data.SqlClient.SqlConnection(sqlConn), sqlConn))
  19. {
  20. _unitOfWork.Connection.Open();
  21. _unitOfWork.Transaction = _unitOfWork.Connection.BeginTransaction();
  22. CreaterHelper createrHelper = new CreaterHelper(_unitOfWork);
  23. try
  24. {
  25. await createrHelper.CreateTables("XYY.Model.Standard.Erp.Purchase", "XYY.Model.Standard");
  26. _unitOfWork.Commit();
  27. }
  28. catch (Exception ex)
  29. {
  30. _unitOfWork.Rollback();
  31. }
  32. }
  33. }
  34. }
  35. }