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