Service.cst 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Data;
  5. using System.Data.Common;
  6. using System.ComponentModel;
  7. using System.Transactions;
  8. using Befri.Query;
  9. using Befri.Data.SqlClient;
  10. using Befri.Goldhoo.Models;
  11. using Befri.Goldhoo.DataAccess;
  12. namespace Befri.Goldhoo.Services
  13. {
  14. /// <summary>
  15. /// 名 称: <%= Table.Text %>管理服务类
  16. /// 开发人员:
  17. /// 开发日期: <%= DateTime.Today.ToLongDateString() %>
  18. /// </summary>
  19. public class <%= Table.AliasName %>Service : DataService, I<%= Table.AliasName %>Service
  20. {
  21. private <%= Table.AliasName %>DAO _<%= Table.aliasName %>DAO = new <%= Table.AliasName %>DAO();
  22. /// <summary>
  23. /// 返回满足查询条件的<%= Table.Text %>实体列表
  24. /// </summary>
  25. /// <param name="param">查询条件</param>
  26. /// <returns><%= Table.Text %>实体列表</returns>
  27. public IList<<%= Table.AliasName %>> Get<%= Table.AliasName %>s(QueryParameter param)
  28. {
  29. return _<%= Table.aliasName %>DAO.Get<%= Table.AliasName %>s(param);
  30. }
  31. /// <summary>
  32. /// 创建<%= Table.Text %>记录
  33. /// </summary>
  34. /// <param name="<%= Table.aliasName %>"><%= Table.Text %>对象</param>
  35. /// <returns></returns>
  36. public int Create<%= Table.AliasName %>(<%= Table.AliasName %> <%= Table.aliasName %>)
  37. {
  38. return _<%= Table.aliasName %>DAO.Insert(<%= Table.aliasName %>);
  39. }
  40. /// <summary>
  41. /// 更新<%= Table.Text %>记录
  42. /// </summary>
  43. /// <param name="<%= Table.aliasName %>"><%= Table.Text %>对象</param>
  44. /// <returns>受影响的记录数</returns>
  45. public int Update<%= Table.AliasName %>(<%= Table.AliasName %> <%= Table.aliasName %>)
  46. {
  47. return _<%= Table.aliasName %>DAO.Update(<%= Table.aliasName %>);
  48. }
  49. /// <summary>
  50. /// 删除<%= Table.Text %>记录
  51. /// </summary>
  52. <% foreach(Arista.Data.ColumnSchema column in Table.Keys){%>/// <param name="<%= column.aliasName %>"><%= column.Text %></param> <% } %>
  53. /// <returns>受影响的记录数</returns>
  54. public int Delete<%= Table.AliasName %>(<%= KeyParamsText %>)
  55. {
  56. return _<%= Table.aliasName %>DAO.Delete(<%= KeyParamsValueText %>);
  57. }
  58. }
  59. }