ModelAssemblers.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. //-------------------------------------------------------------------------------------------------------
  2. // <auto-generated>
  3. // This code was generated by EntitiesToDtos.v3.0 (entitiestodtos.codeplex.com).
  4. // Timestamp: 2013/02/15 - 18:47:39
  5. //
  6. // Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
  7. // </auto-generated>
  8. //-------------------------------------------------------------------------------------------------------
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Runtime.Serialization;
  12. using System.Text;
  13. using System.Linq;
  14. using System.Data.Objects.DataClasses;
  15. namespace Foghorn.Core
  16. {
  17. /// <summary>
  18. /// Assembler for <see cref="Subscriber"/> and <see cref="SubscriberDto"/>.
  19. /// </summary>
  20. public static partial class SubscriberAssembler
  21. {
  22. /// <summary>
  23. /// Invoked when <see cref="ToDto"/> operation is about to return.
  24. /// </summary>
  25. /// <param name="dto"><see cref="SubscriberDto"/> converted from <see cref="Subscriber"/>.</param>
  26. /// <param name="entity"><see cref="Subscriber"/> converted from <see cref="SubscriberDto"/>.</param>
  27. static partial void OnDto(this Subscriber entity, SubscriberDto dto);
  28. /// <summary>
  29. /// Invoked when <see cref="ToEntity"/> operation is about to return.
  30. /// </summary>
  31. /// <param name="dto"><see cref="SubscriberDto"/> converted from <see cref="Subscriber"/>.</param>
  32. /// <param name="entity"><see cref="Subscriber"/> converted from <see cref="SubscriberDto"/>.</param>
  33. static partial void OnEntity(this SubscriberDto dto, Subscriber entity);
  34. /// <summary>
  35. /// Converts this instance of <see cref="SubscriberDto"/> to an instance of <see cref="Subscriber"/>.
  36. /// </summary>
  37. /// <param name="dto"><see cref="SubscriberDto"/> to convert.</param>
  38. public static Subscriber ToEntity(this SubscriberDto dto)
  39. {
  40. if (dto == null) return null;
  41. var entity = new Subscriber();
  42. entity.SubscriberId = dto.SubscriberId;
  43. entity.SubscriberName = dto.SubscriberName;
  44. entity.Port = dto.Port;
  45. entity.HostName = dto.HostName;
  46. entity.Password = dto.Password;
  47. dto.OnEntity(entity);
  48. return entity;
  49. }
  50. /// <summary>
  51. /// Converts this instance of <see cref="Subscriber"/> to an instance of <see cref="SubscriberDto"/>.
  52. /// </summary>
  53. /// <param name="entity"><see cref="Subscriber"/> to convert.</param>
  54. public static SubscriberDto ToDto(this Subscriber entity)
  55. {
  56. if (entity == null) return null;
  57. var dto = new SubscriberDto();
  58. dto.SubscriberId = entity.SubscriberId;
  59. dto.SubscriberName = entity.SubscriberName;
  60. dto.Port = entity.Port;
  61. dto.HostName = entity.HostName;
  62. dto.Password = entity.Password;
  63. entity.OnDto(dto);
  64. return dto;
  65. }
  66. /// <summary>
  67. /// Converts each instance of <see cref="SubscriberDto"/> to an instance of <see cref="Subscriber"/>.
  68. /// </summary>
  69. /// <param name="dtos">An ICollection of <see cref="SubscriberDto"/>s</param>
  70. /// <returns>An ICollection of <see cref="Subscriber"/></returns>
  71. public static ICollection<Subscriber> ToEntities(this IEnumerable<SubscriberDto> dtos)
  72. {
  73. if (dtos == null) return null;
  74. return dtos.Select(e => e.ToEntity()).ToList();
  75. }
  76. /// <summary>
  77. /// Converts each instance of <see cref="Subscriber"/> to an instance of <see cref="SubscriberDto"/>.
  78. /// </summary>
  79. /// <param name="entities">An ICollection of <see cref="Subscriber"/>s</param>
  80. /// <returns>An ICollection of <see cref="SubscriberDto"/></returns>
  81. public static ICollection<SubscriberDto> ToDtos(this IEnumerable<Subscriber> entities)
  82. {
  83. if (entities == null) return null;
  84. return entities.Select(e => e.ToDto()).ToList();
  85. }
  86. }
  87. /// <summary>
  88. /// Assembler for <see cref="Notification"/> and <see cref="NotificationDto"/>.
  89. /// </summary>
  90. public static partial class NotificationAssembler
  91. {
  92. /// <summary>
  93. /// Invoked when <see cref="ToDto"/> operation is about to return.
  94. /// </summary>
  95. /// <param name="dto"><see cref="NotificationDto"/> converted from <see cref="Notification"/>.</param>
  96. /// <param name="entity"><see cref="Notification"/> converted from <see cref="NotificationDto"/>.</param>
  97. static partial void OnDto(this Notification entity, NotificationDto dto);
  98. /// <summary>
  99. /// Invoked when <see cref="ToEntity"/> operation is about to return.
  100. /// </summary>
  101. /// <param name="dto"><see cref="NotificationDto"/> converted from <see cref="Notification"/>.</param>
  102. /// <param name="entity"><see cref="Notification"/> converted from <see cref="NotificationDto"/>.</param>
  103. static partial void OnEntity(this NotificationDto dto, Notification entity);
  104. /// <summary>
  105. /// Converts this instance of <see cref="NotificationDto"/> to an instance of <see cref="Notification"/>.
  106. /// </summary>
  107. /// <param name="dto"><see cref="NotificationDto"/> to convert.</param>
  108. public static Notification ToEntity(this NotificationDto dto)
  109. {
  110. if (dto == null) return null;
  111. var entity = new Notification();
  112. entity.NotificationId = dto.NotificationId;
  113. entity.NotificationTitle = dto.NotificationTitle;
  114. entity.NotificationMessage = dto.NotificationMessage;
  115. entity.SentDateTime = dto.SentDateTime;
  116. entity.Priority = dto.Priority;
  117. entity.Sticky = dto.Sticky;
  118. dto.OnEntity(entity);
  119. return entity;
  120. }
  121. /// <summary>
  122. /// Converts this instance of <see cref="Notification"/> to an instance of <see cref="NotificationDto"/>.
  123. /// </summary>
  124. /// <param name="entity"><see cref="Notification"/> to convert.</param>
  125. public static NotificationDto ToDto(this Notification entity)
  126. {
  127. if (entity == null) return null;
  128. var dto = new NotificationDto();
  129. dto.NotificationId = entity.NotificationId;
  130. dto.NotificationTitle = entity.NotificationTitle;
  131. dto.NotificationMessage = entity.NotificationMessage;
  132. dto.SentDateTime = entity.SentDateTime;
  133. dto.Priority = entity.Priority;
  134. dto.Sticky = entity.Sticky;
  135. entity.OnDto(dto);
  136. return dto;
  137. }
  138. /// <summary>
  139. /// Converts each instance of <see cref="NotificationDto"/> to an instance of <see cref="Notification"/>.
  140. /// </summary>
  141. /// <param name="dtos">An ICollection of <see cref="NotificationDto"/>s</param>
  142. /// <returns>An ICollection of <see cref="Notification"/></returns>
  143. public static ICollection<Notification> ToEntities(this IEnumerable<NotificationDto> dtos)
  144. {
  145. if (dtos == null) return null;
  146. return dtos.Select(e => e.ToEntity()).ToList();
  147. }
  148. /// <summary>
  149. /// Converts each instance of <see cref="Notification"/> to an instance of <see cref="NotificationDto"/>.
  150. /// </summary>
  151. /// <param name="entities">An ICollection of <see cref="Notification"/>s</param>
  152. /// <returns>An ICollection of <see cref="NotificationDto"/></returns>
  153. public static ICollection<NotificationDto> ToDtos(this IEnumerable<Notification> entities)
  154. {
  155. if (entities == null) return null;
  156. return entities.Select(e => e.ToDto()).ToList();
  157. }
  158. }
  159. /// <summary>
  160. /// Assembler for <see cref="SendingApplication"/> and <see cref="SendingApplicationDto"/>.
  161. /// </summary>
  162. public static partial class SendingApplicationAssembler
  163. {
  164. /// <summary>
  165. /// Invoked when <see cref="ToDto"/> operation is about to return.
  166. /// </summary>
  167. /// <param name="dto"><see cref="SendingApplicationDto"/> converted from <see cref="SendingApplication"/>.</param>
  168. /// <param name="entity"><see cref="SendingApplication"/> converted from <see cref="SendingApplicationDto"/>.</param>
  169. static partial void OnDto(this SendingApplication entity, SendingApplicationDto dto);
  170. /// <summary>
  171. /// Invoked when <see cref="ToEntity"/> operation is about to return.
  172. /// </summary>
  173. /// <param name="dto"><see cref="SendingApplicationDto"/> converted from <see cref="SendingApplication"/>.</param>
  174. /// <param name="entity"><see cref="SendingApplication"/> converted from <see cref="SendingApplicationDto"/>.</param>
  175. static partial void OnEntity(this SendingApplicationDto dto, SendingApplication entity);
  176. /// <summary>
  177. /// Converts this instance of <see cref="SendingApplicationDto"/> to an instance of <see cref="SendingApplication"/>.
  178. /// </summary>
  179. /// <param name="dto"><see cref="SendingApplicationDto"/> to convert.</param>
  180. public static SendingApplication ToEntity(this SendingApplicationDto dto)
  181. {
  182. if (dto == null) return null;
  183. var entity = new SendingApplication();
  184. entity.SendingApplicationId = dto.SendingApplicationId;
  185. entity.SendingApplicationName = dto.SendingApplicationName;
  186. entity.SendingApplicationIcon = dto.SendingApplicationIcon;
  187. dto.OnEntity(entity);
  188. return entity;
  189. }
  190. /// <summary>
  191. /// Converts this instance of <see cref="SendingApplication"/> to an instance of <see cref="SendingApplicationDto"/>.
  192. /// </summary>
  193. /// <param name="entity"><see cref="SendingApplication"/> to convert.</param>
  194. public static SendingApplicationDto ToDto(this SendingApplication entity)
  195. {
  196. if (entity == null) return null;
  197. var dto = new SendingApplicationDto();
  198. dto.SendingApplicationId = entity.SendingApplicationId;
  199. dto.SendingApplicationName = entity.SendingApplicationName;
  200. dto.SendingApplicationIcon = entity.SendingApplicationIcon;
  201. entity.OnDto(dto);
  202. return dto;
  203. }
  204. /// <summary>
  205. /// Converts each instance of <see cref="SendingApplicationDto"/> to an instance of <see cref="SendingApplication"/>.
  206. /// </summary>
  207. /// <param name="dtos">An ICollection of <see cref="SendingApplicationDto"/>s</param>
  208. /// <returns>An ICollection of <see cref="SendingApplication"/></returns>
  209. public static ICollection<SendingApplication> ToEntities(this IEnumerable<SendingApplicationDto> dtos)
  210. {
  211. if (dtos == null) return null;
  212. return dtos.Select(e => e.ToEntity()).ToList();
  213. }
  214. /// <summary>
  215. /// Converts each instance of <see cref="SendingApplication"/> to an instance of <see cref="SendingApplicationDto"/>.
  216. /// </summary>
  217. /// <param name="entities">An ICollection of <see cref="SendingApplication"/>s</param>
  218. /// <returns>An ICollection of <see cref="SendingApplicationDto"/></returns>
  219. public static ICollection<SendingApplicationDto> ToDtos(this IEnumerable<SendingApplication> entities)
  220. {
  221. if (entities == null) return null;
  222. return entities.Select(e => e.ToDto()).ToList();
  223. }
  224. }
  225. /// <summary>
  226. /// Assembler for <see cref="NotificationType"/> and <see cref="NotificationTypeDto"/>.
  227. /// </summary>
  228. public static partial class NotificationTypeAssembler
  229. {
  230. /// <summary>
  231. /// Invoked when <see cref="ToDto"/> operation is about to return.
  232. /// </summary>
  233. /// <param name="dto"><see cref="NotificationTypeDto"/> converted from <see cref="NotificationType"/>.</param>
  234. /// <param name="entity"><see cref="NotificationType"/> converted from <see cref="NotificationTypeDto"/>.</param>
  235. static partial void OnDto(this NotificationType entity, NotificationTypeDto dto);
  236. /// <summary>
  237. /// Invoked when <see cref="ToEntity"/> operation is about to return.
  238. /// </summary>
  239. /// <param name="dto"><see cref="NotificationTypeDto"/> converted from <see cref="NotificationType"/>.</param>
  240. /// <param name="entity"><see cref="NotificationType"/> converted from <see cref="NotificationTypeDto"/>.</param>
  241. static partial void OnEntity(this NotificationTypeDto dto, NotificationType entity);
  242. /// <summary>
  243. /// Converts this instance of <see cref="NotificationTypeDto"/> to an instance of <see cref="NotificationType"/>.
  244. /// </summary>
  245. /// <param name="dto"><see cref="NotificationTypeDto"/> to convert.</param>
  246. public static NotificationType ToEntity(this NotificationTypeDto dto)
  247. {
  248. if (dto == null) return null;
  249. var entity = new NotificationType();
  250. entity.NotificationTypeId = dto.NotificationTypeId;
  251. entity.NotificationTypeName = dto.NotificationTypeName;
  252. entity.NotificationTypeDisplayName = dto.NotificationTypeDisplayName;
  253. entity.NotificationTypeIcon = dto.NotificationTypeIcon;
  254. dto.OnEntity(entity);
  255. return entity;
  256. }
  257. /// <summary>
  258. /// Converts this instance of <see cref="NotificationType"/> to an instance of <see cref="NotificationTypeDto"/>.
  259. /// </summary>
  260. /// <param name="entity"><see cref="NotificationType"/> to convert.</param>
  261. public static NotificationTypeDto ToDto(this NotificationType entity)
  262. {
  263. if (entity == null) return null;
  264. var dto = new NotificationTypeDto();
  265. dto.NotificationTypeId = entity.NotificationTypeId;
  266. dto.NotificationTypeName = entity.NotificationTypeName;
  267. dto.NotificationTypeDisplayName = entity.NotificationTypeDisplayName;
  268. dto.NotificationTypeIcon = entity.NotificationTypeIcon;
  269. entity.OnDto(dto);
  270. return dto;
  271. }
  272. /// <summary>
  273. /// Converts each instance of <see cref="NotificationTypeDto"/> to an instance of <see cref="NotificationType"/>.
  274. /// </summary>
  275. /// <param name="dtos">An ICollection of <see cref="NotificationTypeDto"/>s</param>
  276. /// <returns>An ICollection of <see cref="NotificationType"/></returns>
  277. public static ICollection<NotificationType> ToEntities(this IEnumerable<NotificationTypeDto> dtos)
  278. {
  279. if (dtos == null) return null;
  280. return dtos.Select(e => e.ToEntity()).ToList();
  281. }
  282. /// <summary>
  283. /// Converts each instance of <see cref="NotificationType"/> to an instance of <see cref="NotificationTypeDto"/>.
  284. /// </summary>
  285. /// <param name="entities">An ICollection of <see cref="NotificationType"/>s</param>
  286. /// <returns>An ICollection of <see cref="NotificationTypeDto"/></returns>
  287. public static ICollection<NotificationTypeDto> ToDtos(this IEnumerable<NotificationType> entities)
  288. {
  289. if (entities == null) return null;
  290. return entities.Select(e => e.ToDto()).ToList();
  291. }
  292. }
  293. }