PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/sipsorcery-core/SIPSorcery.SIP.App/Entities/SIPEntitiesDomainService.cs

https://github.com/thecc4re/sipsorcery-mono
C# | 166 lines | 124 code | 21 blank | 21 comment | 16 complexity | 166296dd1af02c7292eda92a243343ef MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. namespace SIPSorcery.SIP.App.Entities
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.ComponentModel.DataAnnotations;
  7. using System.Data;
  8. using System.Linq;
  9. using System.ServiceModel.DomainServices.EntityFramework;
  10. using System.ServiceModel.DomainServices.Hosting;
  11. using System.ServiceModel.DomainServices.Server;
  12. // Implements application logic using the SIPSorceryAppEntities context.
  13. // TODO: Add your application logic to these methods or in additional methods.
  14. // TODO: Wire up authentication (Windows/ASP.NET Forms) and uncomment the following to disable anonymous access
  15. // Also consider adding roles to restrict access as appropriate.
  16. // [RequiresAuthentication]
  17. [EnableClientAccess()]
  18. public class SIPEntitiesDomainService : LinqToEntitiesDomainService<SIPSorceryAppEntities>
  19. {
  20. // TODO:
  21. // Consider constraining the results of your query method. If you need additional input you can
  22. // add parameters to this method or create additional query methods with different names.
  23. // To support paging you will need to add ordering to the 'SIPDialplanLookups' query.
  24. public IQueryable<SIPDialplanLookup> GetSIPDialplanLookups()
  25. {
  26. return this.ObjectContext.SIPDialplanLookups;
  27. }
  28. public void InsertSIPDialplanLookup(SIPDialplanLookup sIPDialplanLookup)
  29. {
  30. if ((sIPDialplanLookup.EntityState != EntityState.Detached))
  31. {
  32. this.ObjectContext.ObjectStateManager.ChangeObjectState(sIPDialplanLookup, EntityState.Added);
  33. }
  34. else
  35. {
  36. this.ObjectContext.SIPDialplanLookups.AddObject(sIPDialplanLookup);
  37. }
  38. }
  39. public void UpdateSIPDialplanLookup(SIPDialplanLookup currentSIPDialplanLookup)
  40. {
  41. this.ObjectContext.SIPDialplanLookups.AttachAsModified(currentSIPDialplanLookup, this.ChangeSet.GetOriginal(currentSIPDialplanLookup));
  42. }
  43. public void DeleteSIPDialplanLookup(SIPDialplanLookup sIPDialplanLookup)
  44. {
  45. if ((sIPDialplanLookup.EntityState == EntityState.Detached))
  46. {
  47. this.ObjectContext.SIPDialplanLookups.Attach(sIPDialplanLookup);
  48. }
  49. this.ObjectContext.SIPDialplanLookups.DeleteObject(sIPDialplanLookup);
  50. }
  51. // TODO:
  52. // Consider constraining the results of your query method. If you need additional input you can
  53. // add parameters to this method or create additional query methods with different names.
  54. // To support paging you will need to add ordering to the 'SIPDialplanOptions' query.
  55. public IQueryable<SIPDialplanOption> GetSIPDialplanOptions()
  56. {
  57. return this.ObjectContext.SIPDialplanOptions;
  58. }
  59. public void InsertSIPDialplanOption(SIPDialplanOption sIPDialplanOption)
  60. {
  61. if ((sIPDialplanOption.EntityState != EntityState.Detached))
  62. {
  63. this.ObjectContext.ObjectStateManager.ChangeObjectState(sIPDialplanOption, EntityState.Added);
  64. }
  65. else
  66. {
  67. this.ObjectContext.SIPDialplanOptions.AddObject(sIPDialplanOption);
  68. }
  69. }
  70. public void UpdateSIPDialplanOption(SIPDialplanOption currentSIPDialplanOption)
  71. {
  72. this.ObjectContext.SIPDialplanOptions.AttachAsModified(currentSIPDialplanOption, this.ChangeSet.GetOriginal(currentSIPDialplanOption));
  73. }
  74. public void DeleteSIPDialplanOption(SIPDialplanOption sIPDialplanOption)
  75. {
  76. if ((sIPDialplanOption.EntityState == EntityState.Detached))
  77. {
  78. this.ObjectContext.SIPDialplanOptions.Attach(sIPDialplanOption);
  79. }
  80. this.ObjectContext.SIPDialplanOptions.DeleteObject(sIPDialplanOption);
  81. }
  82. // TODO:
  83. // Consider constraining the results of your query method. If you need additional input you can
  84. // add parameters to this method or create additional query methods with different names.
  85. // To support paging you will need to add ordering to the 'SIPDialplanProviders' query.
  86. public IQueryable<SIPDialplanProvider> GetSIPDialplanProviders()
  87. {
  88. return this.ObjectContext.SIPDialplanProviders;
  89. }
  90. public void InsertSIPDialplanProvider(SIPDialplanProvider sIPDialplanProvider)
  91. {
  92. if ((sIPDialplanProvider.EntityState != EntityState.Detached))
  93. {
  94. this.ObjectContext.ObjectStateManager.ChangeObjectState(sIPDialplanProvider, EntityState.Added);
  95. }
  96. else
  97. {
  98. this.ObjectContext.SIPDialplanProviders.AddObject(sIPDialplanProvider);
  99. }
  100. }
  101. public void UpdateSIPDialplanProvider(SIPDialplanProvider currentSIPDialplanProvider)
  102. {
  103. this.ObjectContext.SIPDialplanProviders.AttachAsModified(currentSIPDialplanProvider, this.ChangeSet.GetOriginal(currentSIPDialplanProvider));
  104. }
  105. public void DeleteSIPDialplanProvider(SIPDialplanProvider sIPDialplanProvider)
  106. {
  107. if ((sIPDialplanProvider.EntityState == EntityState.Detached))
  108. {
  109. this.ObjectContext.SIPDialplanProviders.Attach(sIPDialplanProvider);
  110. }
  111. this.ObjectContext.SIPDialplanProviders.DeleteObject(sIPDialplanProvider);
  112. }
  113. // TODO:
  114. // Consider constraining the results of your query method. If you need additional input you can
  115. // add parameters to this method or create additional query methods with different names.
  116. // To support paging you will need to add ordering to the 'SIPDialplanRoutes' query.
  117. public IQueryable<SIPDialplanRoute> GetSIPDialplanRoutes()
  118. {
  119. return this.ObjectContext.SIPDialplanRoutes;
  120. }
  121. public void InsertSIPDialplanRoute(SIPDialplanRoute sIPDialplanRoute)
  122. {
  123. if ((sIPDialplanRoute.EntityState != EntityState.Detached))
  124. {
  125. this.ObjectContext.ObjectStateManager.ChangeObjectState(sIPDialplanRoute, EntityState.Added);
  126. }
  127. else
  128. {
  129. this.ObjectContext.SIPDialplanRoutes.AddObject(sIPDialplanRoute);
  130. }
  131. }
  132. public void UpdateSIPDialplanRoute(SIPDialplanRoute currentSIPDialplanRoute)
  133. {
  134. this.ObjectContext.SIPDialplanRoutes.AttachAsModified(currentSIPDialplanRoute, this.ChangeSet.GetOriginal(currentSIPDialplanRoute));
  135. }
  136. public void DeleteSIPDialplanRoute(SIPDialplanRoute sIPDialplanRoute)
  137. {
  138. if ((sIPDialplanRoute.EntityState == EntityState.Detached))
  139. {
  140. this.ObjectContext.SIPDialplanRoutes.Attach(sIPDialplanRoute);
  141. }
  142. this.ObjectContext.SIPDialplanRoutes.DeleteObject(sIPDialplanRoute);
  143. }
  144. }
  145. }