MaterialBindingManager.cs 846 B

123456789101112131415161718192021222324252627282930313233
  1. 
  2. using DbCommon.BusinessCore.DbCore;
  3. using DbCommon.Enties.DbModels;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace DbCommon.BusinessCore.BaseCore
  10. {
  11. public class MaterialBindingManager : DbContext<MaterialBinding>
  12. {
  13. public void Init()
  14. {
  15. //If no exist create datebase
  16. //Db.DbMaintenance.CreateDatabase();
  17. var dt = Db.Ado.GetDataTable("SELECT * FROM sysobjects WHERE NAME = 'MaterialBinding'");
  18. if (dt.Rows.Count == 0)
  19. {
  20. //Create tables
  21. Db.CodeFirst.InitTables(typeof(MaterialBinding));
  22. }
  23. }
  24. public bool Save(MaterialBinding data)
  25. {
  26. return Db.Saveable(data).ExecuteCommand() > 0;
  27. }
  28. }
  29. }