Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Services.Hive/3.3/Convert.cs @ 9426

Last change on this file since 9426 was 9426, checked in by ascheibe, 11 years ago

#2019

  • removed useless code as suggested by abeham
  • enabled lazy loading for binary data (plugins and task data) as suggested by pfleck
File size: 23.8 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Data.Linq;
25using System.Linq;
26using DB = HeuristicLab.Services.Hive.DataAccess;
27using DT = HeuristicLab.Services.Hive.DataTransfer;
28
29namespace HeuristicLab.Services.Hive.DataTransfer {
30  public static class Convert {
31    #region Task
32    public static DT.Task ToDto(DB.Task source) {
33      if (source == null) return null;
34      return new DT.Task {
35        Id = source.TaskId,
36        CoresNeeded = source.CoresNeeded,
37        ExecutionTime = TimeSpan.FromMilliseconds(source.ExecutionTimeMs),
38        MemoryNeeded = source.MemoryNeeded,
39        ParentTaskId = source.ParentTaskId,
40        Priority = source.Priority,
41        PluginsNeededIds = (source.RequiredPlugins == null ? new List<Guid>() : source.RequiredPlugins.Select(x => x.PluginId).ToList()),
42        LastHeartbeat = source.LastHeartbeat,
43        State = Convert.ToDto(source.State),
44        StateLog = (source.StateLogs == null ? new List<DT.StateLog>() : source.StateLogs.Select(x => Convert.ToDto(x)).OrderBy(x => x.DateTime).ToList()),
45        IsParentTask = source.IsParentTask,
46        FinishWhenChildJobsFinished = source.FinishWhenChildJobsFinished,
47        Command = Convert.ToDto(source.Command),
48        LastTaskDataUpdate = (source.JobData == null ? DateTime.MinValue : source.JobData.LastUpdate),
49        JobId = source.JobId,
50        IsPrivileged = source.IsPrivileged
51      };
52    }
53
54    public static DB.Task ToEntity(DT.Task source) {
55      if (source == null) return null;
56      var entity = new DB.Task(); ToEntity(source, entity);
57      return entity;
58    }
59    public static void ToEntity(DT.Task source, DB.Task target) {
60      if ((source != null) && (target != null)) {
61        target.TaskId = source.Id;
62        target.CoresNeeded = source.CoresNeeded;
63        target.ExecutionTimeMs = source.ExecutionTime.TotalMilliseconds;
64        target.MemoryNeeded = source.MemoryNeeded;
65        target.ParentTaskId = source.ParentTaskId;
66        target.Priority = source.Priority;
67        target.LastHeartbeat = source.LastHeartbeat;
68        target.State = Convert.ToEntity(source.State);
69        foreach (DT.StateLog sl in source.StateLog.Where(x => x.Id == Guid.Empty)) {
70          target.StateLogs.Add(Convert.ToEntity(sl));
71        }
72        target.IsParentTask = source.IsParentTask;
73        target.FinishWhenChildJobsFinished = source.FinishWhenChildJobsFinished;
74        target.Command = Convert.ToEntity(source.Command);
75        // RequiredPlugins are added by Dao
76        target.JobId = source.JobId;
77        target.IsPrivileged = source.IsPrivileged;
78      }
79    }
80
81    public static void ToEntityTaskOnly(DT.Task source, DB.Task target) {
82      if ((source != null) && (target != null)) {
83        target.TaskId = source.Id;
84        target.CoresNeeded = source.CoresNeeded;
85        target.ExecutionTimeMs = source.ExecutionTime.TotalMilliseconds;
86        target.MemoryNeeded = source.MemoryNeeded;
87        target.ParentTaskId = source.ParentTaskId;
88        target.Priority = source.Priority;
89        target.LastHeartbeat = source.LastHeartbeat;
90        target.State = Convert.ToEntity(source.State);
91        target.IsParentTask = source.IsParentTask;
92        target.FinishWhenChildJobsFinished = source.FinishWhenChildJobsFinished;
93        target.Command = Convert.ToEntity(source.Command);
94        // RequiredPlugins are added by Dao
95        target.JobId = source.JobId;
96        target.IsPrivileged = source.IsPrivileged;
97      }
98    }
99    #endregion
100
101    #region TaskData
102    public static DT.TaskData ToDto(DB.TaskData source) {
103      if (source == null) return null;
104      return new DT.TaskData { TaskId = source.TaskId, Data = source.Data.ToArray(), LastUpdate = source.LastUpdate };
105    }
106    public static DB.TaskData ToEntity(DT.TaskData source) {
107      if (source == null) return null;
108      var entity = new DB.TaskData(); ToEntity(source, entity);
109      return entity;
110    }
111    public static void ToEntity(DT.TaskData source, DB.TaskData target) {
112      if ((source != null) && (target != null)) {
113        target.TaskId = source.TaskId; target.Data = new Binary(source.Data); target.LastUpdate = source.LastUpdate;
114      }
115    }
116    #endregion
117
118    #region StateLog
119    public static DT.StateLog ToDto(DB.StateLog source) {
120      if (source == null) return null;
121      return new DT.StateLog { Id = source.StateLogId, DateTime = source.DateTime, Exception = source.Exception, TaskId = source.TaskId, SlaveId = source.SlaveId, State = Convert.ToDto(source.State), UserId = source.UserId };
122    }
123    public static DB.StateLog ToEntity(DT.StateLog source) {
124      if (source == null) return null;
125      var entity = new DB.StateLog(); ToEntity(source, entity);
126      return entity;
127    }
128    public static void ToEntity(DT.StateLog source, DB.StateLog target) {
129      if ((source != null) && (target != null)) {
130        target.StateLogId = source.Id; target.DateTime = source.DateTime; target.Exception = source.Exception; target.TaskId = source.TaskId; target.SlaveId = source.SlaveId; target.State = Convert.ToEntity(source.State); target.UserId = source.UserId;
131      }
132    }
133    #endregion
134
135    #region Downtimes
136    public static DT.Downtime ToDto(DB.Downtime source) {
137      if (source == null) return null;
138      return new DT.Downtime { Id = source.DowntimeId, AllDayEvent = source.AllDayEvent, EndDate = source.EndDate, Recurring = source.Recurring, RecurringId = source.RecurringId, ResourceId = source.ResourceId, StartDate = source.StartDate, DowntimeType = source.DowntimeType };
139    }
140    public static DB.Downtime ToEntity(DT.Downtime source) {
141      if (source == null) return null;
142      var entity = new DB.Downtime(); ToEntity(source, entity);
143      return entity;
144    }
145    public static void ToEntity(DT.Downtime source, DB.Downtime target) {
146      if ((source != null) && (target != null)) {
147        target.DowntimeId = source.Id; target.AllDayEvent = source.AllDayEvent; target.EndDate = source.EndDate; target.Recurring = source.Recurring; target.RecurringId = source.RecurringId; target.ResourceId = source.ResourceId; target.StartDate = source.StartDate; target.DowntimeType = source.DowntimeType;
148      }
149    }
150    #endregion
151
152    #region Job
153    public static DT.Job ToDto(DB.Job source) {
154      if (source == null) return null;
155      return new DT.Job { Id = source.JobId, Description = source.Description, Name = source.Name, OwnerUserId = source.OwnerUserId, DateCreated = source.DateCreated, ResourceNames = source.ResourceIds };
156    }
157    public static DB.Job ToEntity(DT.Job source) {
158      if (source == null) return null;
159      var entity = new DB.Job(); ToEntity(source, entity);
160      return entity;
161    }
162    public static void ToEntity(DT.Job source, DB.Job target) {
163      if ((source != null) && (target != null)) {
164        target.JobId = source.Id; target.Description = source.Description; target.Name = source.Name; target.OwnerUserId = source.OwnerUserId; target.DateCreated = source.DateCreated; target.ResourceIds = source.ResourceNames;
165      }
166    }
167    #endregion
168
169    #region JobPermission
170    public static DT.JobPermission ToDto(DB.JobPermission source) {
171      if (source == null) return null;
172      return new DT.JobPermission { JobId = source.JobId, GrantedUserId = source.GrantedUserId, GrantedByUserId = source.GrantedByUserId, Permission = Convert.ToDto(source.Permission) };
173    }
174    public static DB.JobPermission ToEntity(DT.JobPermission source) {
175      if (source == null) return null;
176      var entity = new DB.JobPermission(); ToEntity(source, entity);
177      return entity;
178    }
179    public static void ToEntity(DT.JobPermission source, DB.JobPermission target) {
180      if ((source != null) && (target != null)) {
181        target.JobId = source.JobId; target.GrantedUserId = source.GrantedUserId; target.GrantedByUserId = source.GrantedByUserId; target.Permission = Convert.ToEntity(source.Permission);
182      }
183    }
184    #endregion
185
186    #region Plugin
187    public static DT.Plugin ToDto(DB.Plugin source) {
188      if (source == null) return null;
189      return new DT.Plugin { Id = source.PluginId, Name = source.Name, Version = new Version(source.Version), UserId = source.UserId, DateCreated = source.DateCreated, Hash = source.Hash };
190    }
191    public static DB.Plugin ToEntity(DT.Plugin source) {
192      if (source == null) return null;
193      var entity = new DB.Plugin(); ToEntity(source, entity);
194      return entity;
195    }
196    public static void ToEntity(DT.Plugin source, DB.Plugin target) {
197      if ((source != null) && (target != null)) {
198        target.PluginId = source.Id; target.Name = source.Name; target.Version = source.Version.ToString(); target.UserId = source.UserId; target.DateCreated = source.DateCreated; target.Hash = source.Hash;
199      }
200    }
201    #endregion
202
203    #region PluginData
204    public static DT.PluginData ToDto(DB.PluginData source) {
205      if (source == null) return null;
206      return new DT.PluginData { Id = source.PluginDataId, PluginId = source.PluginId, Data = source.Data.ToArray(), FileName = source.FileName };
207    }
208    public static DB.PluginData ToEntity(DT.PluginData source) {
209      if (source == null) return null;
210      var entity = new DB.PluginData(); ToEntity(source, entity);
211      return entity;
212    }
213    public static void ToEntity(DT.PluginData source, DB.PluginData target) {
214      if ((source != null) && (target != null)) {
215        target.PluginDataId = source.Id; target.PluginId = source.PluginId; target.Data = new Binary(source.Data); target.FileName = source.FileName;
216      }
217    }
218    #endregion
219
220    #region Resource
221    public static DT.Resource ToDto(DB.Resource source) {
222      if (source == null) return null;
223      return new DT.Resource { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId, HbInterval = source.HbInterval, OwnerUserId = source.OwnerUserId };
224    }
225    public static DB.Resource ToEntity(DT.Resource source) {
226      if (source == null) return null;
227      var entity = new DB.Resource(); ToEntity(source, entity);
228      return entity;
229    }
230    public static void ToEntity(DT.Resource source, DB.Resource target) {
231      if ((source != null) && (target != null)) {
232        target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId; target.HbInterval = source.HbInterval; target.OwnerUserId = source.OwnerUserId;
233      }
234    }
235    #endregion
236
237    #region SlaveGroup
238    public static DT.SlaveGroup ToDto(DB.SlaveGroup source) {
239      if (source == null) return null;
240      return new DT.SlaveGroup { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId, HbInterval = source.HbInterval, OwnerUserId = source.OwnerUserId };
241    }
242    public static DB.SlaveGroup ToEntity(DT.SlaveGroup source) {
243      if (source == null) return null;
244      var entity = new DB.SlaveGroup(); ToEntity(source, entity);
245      return entity;
246    }
247    public static void ToEntity(DT.SlaveGroup source, DB.SlaveGroup target) {
248      if ((source != null) && (target != null)) {
249        target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId; target.HbInterval = source.HbInterval; target.OwnerUserId = source.OwnerUserId;
250      }
251    }
252    #endregion
253
254    #region Slave
255    public static DT.Slave ToDto(DB.Slave source) {
256      if (source == null) return null;
257      return new DT.Slave {
258        Id = source.ResourceId,
259        ParentResourceId = source.ParentResourceId,
260        Cores = source.Cores,
261        CpuSpeed = source.CpuSpeed,
262        FreeCores = source.FreeCores,
263        FreeMemory = source.FreeMemory,
264        IsAllowedToCalculate = source.IsAllowedToCalculate,
265        Memory = source.Memory,
266        Name = source.Name,
267        SlaveState = Convert.ToDto(source.SlaveState),
268        CpuArchitecture = Convert.ToDto(source.CpuArchitecture),
269        OperatingSystem = source.OperatingSystem,
270        LastHeartbeat = source.LastHeartbeat,
271        CpuUtilization = source.CpuUtilization,
272        HbInterval = source.HbInterval,
273        IsDisposable = source.IsDisposable,
274        OwnerUserId = source.OwnerUserId
275      };
276    }
277    public static DB.Slave ToEntity(DT.Slave source) {
278      if (source == null) return null;
279      var entity = new DB.Slave(); ToEntity(source, entity);
280      return entity;
281    }
282    public static void ToEntity(DT.Slave source, DB.Slave target) {
283      if ((source != null) && (target != null)) {
284        target.ResourceId = source.Id;
285        target.ParentResourceId = source.ParentResourceId;
286        target.Cores = source.Cores;
287        target.CpuSpeed = source.CpuSpeed;
288        target.FreeCores = source.FreeCores;
289        target.FreeMemory = source.FreeMemory;
290        target.IsAllowedToCalculate = source.IsAllowedToCalculate;
291        target.Memory = source.Memory;
292        target.Name = source.Name;
293        target.SlaveState = Convert.ToEntity(source.SlaveState);
294        target.CpuArchitecture = Convert.ToEntity(source.CpuArchitecture);
295        target.OperatingSystem = source.OperatingSystem;
296        target.LastHeartbeat = source.LastHeartbeat;
297        target.CpuUtilization = source.CpuUtilization;
298        target.HbInterval = source.HbInterval;
299        target.IsDisposable = source.IsDisposable;
300        target.OwnerUserId = source.OwnerUserId;
301      }
302    }
303    #endregion
304
305    #region ResourcePermission
306    public static DT.ResourcePermission ToDto(DB.ResourcePermission source) {
307      if (source == null) return null;
308      return new DT.ResourcePermission { ResourceId = source.ResourceId, GrantedUserId = source.GrantedUserId, GrantedByUserId = source.GrantedByUserId };
309    }
310    public static DB.ResourcePermission ToEntity(DT.ResourcePermission source) {
311      if (source == null) return null;
312      var entity = new DB.ResourcePermission(); ToEntity(source, entity);
313      return entity;
314    }
315    public static void ToEntity(DT.ResourcePermission source, DB.ResourcePermission target) {
316      if ((source != null) && (target != null)) {
317        target.ResourceId = source.ResourceId; target.GrantedUserId = source.GrantedUserId; target.GrantedByUserId = source.GrantedByUserId;
318      }
319    }
320    #endregion
321
322    #region SlaveStatistics
323    public static DT.SlaveStatistics ToDto(DB.SlaveStatistics source) {
324      if (source == null) return null;
325      return new DT.SlaveStatistics {
326        Id = source.StatisticsId,
327        SlaveId = source.SlaveId,
328        Cores = source.Cores,
329        CpuUtilization = source.CpuUtilization,
330        FreeCores = source.FreeCores,
331        FreeMemory = source.FreeMemory,
332        Memory = source.Memory
333      };
334    }
335    public static DB.SlaveStatistics ToEntity(DT.SlaveStatistics source) {
336      if (source == null) return null;
337      var entity = new DB.SlaveStatistics(); ToEntity(source, entity);
338      return entity;
339    }
340    public static void ToEntity(DT.SlaveStatistics source, DB.SlaveStatistics target) {
341      if ((source != null) && (target != null)) {
342        target.StatisticsId = source.Id;
343        target.SlaveId = source.SlaveId;
344        target.Cores = source.Cores;
345        target.CpuUtilization = source.CpuUtilization;
346        target.FreeCores = source.FreeCores;
347        target.FreeMemory = source.FreeMemory;
348        target.Memory = source.Memory;
349      }
350    }
351    #endregion
352
353    #region Statistics
354    public static DT.Statistics ToDto(DB.Statistics source) {
355      if (source == null) return null;
356      return new DT.Statistics {
357        Id = source.StatisticsId,
358        TimeStamp = source.Timestamp,
359        SlaveStatistics = source.SlaveStatistics.Select(x => Convert.ToDto(x)).ToArray(),
360        UserStatistics = source.UserStatistics.Select(x => Convert.ToDto(x)).ToArray()
361      };
362    }
363    public static DB.Statistics ToEntity(DT.Statistics source) {
364      if (source == null) return null;
365      var entity = new DB.Statistics(); ToEntity(source, entity);
366      return entity;
367    }
368    public static void ToEntity(DT.Statistics source, DB.Statistics target) {
369      if ((source != null) && (target != null)) {
370        target.StatisticsId = source.Id;
371        target.Timestamp = source.TimeStamp;
372
373      }
374    }
375    #endregion
376
377    #region UserStatistics
378    public static DT.UserStatistics ToDto(DB.UserStatistics source) {
379      if (source == null) return null;
380      return new DT.UserStatistics {
381        Id = source.StatisticsId,
382        UserId = source.UserId,
383        UsedCores = source.UsedCores,
384        ExecutionTime = TimeSpan.FromMilliseconds(source.ExecutionTimeMs),
385        ExecutionTimeFinishedJobs = TimeSpan.FromMilliseconds(source.ExecutionTimeMsFinishedJobs),
386        StartToEndTime = TimeSpan.FromMilliseconds(source.StartToEndTimeMs)
387      };
388    }
389    public static DB.UserStatistics ToEntity(DT.UserStatistics source) {
390      if (source == null) return null;
391      var entity = new DB.UserStatistics(); ToEntity(source, entity);
392      return entity;
393    }
394    public static void ToEntity(DT.UserStatistics source, DB.UserStatistics target) {
395      if ((source != null) && (target != null)) {
396        target.StatisticsId = source.Id;
397        target.UserId = source.UserId;
398        target.UsedCores = source.UsedCores;
399        target.ExecutionTimeMs = source.ExecutionTime.TotalMilliseconds;
400        target.ExecutionTimeMsFinishedJobs = source.ExecutionTimeFinishedJobs.TotalMilliseconds;
401        target.StartToEndTimeMs = source.StartToEndTime.TotalMilliseconds;
402      }
403    }
404    #endregion
405
406    #region TaskData
407    public static DT.TaskState ToDto(DB.TaskState source) {
408      if (source == DB.TaskState.Aborted) {
409        return TaskState.Aborted;
410      } else if (source == DB.TaskState.Calculating) {
411        return TaskState.Calculating;
412      } else if (source == DB.TaskState.Failed) {
413        return TaskState.Failed;
414      } else if (source == DB.TaskState.Finished) {
415        return TaskState.Finished;
416      } else if (source == DB.TaskState.Offline) {
417        return TaskState.Offline;
418      } else if (source == DB.TaskState.Paused) {
419        return TaskState.Paused;
420      } else if (source == DB.TaskState.Transferring) {
421        return TaskState.Transferring;
422      } else if (source == DB.TaskState.Waiting) {
423        return TaskState.Waiting;
424      } else
425        return TaskState.Failed;
426    }
427
428    public static DB.TaskState ToEntity(DT.TaskState source) {
429      if (source == DT.TaskState.Aborted) {
430        return DB.TaskState.Aborted;
431      } else if (source == DT.TaskState.Calculating) {
432        return DB.TaskState.Calculating;
433      } else if (source == DT.TaskState.Failed) {
434        return DB.TaskState.Failed;
435      } else if (source == DT.TaskState.Finished) {
436        return DB.TaskState.Finished;
437      } else if (source == DT.TaskState.Offline) {
438        return DB.TaskState.Offline;
439      } else if (source == DT.TaskState.Paused) {
440        return DB.TaskState.Paused;
441      } else if (source == DT.TaskState.Transferring) {
442        return DB.TaskState.Transferring;
443      } else if (source == DT.TaskState.Waiting) {
444        return DB.TaskState.Waiting;
445      } else
446        return DB.TaskState.Failed;
447    }
448    #endregion
449
450    #region Permission
451    public static DT.Permission ToDto(DB.Permission source) {
452      if (source == DB.Permission.Full) {
453        return Permission.Full;
454      } else if (source == DB.Permission.NotAllowed) {
455        return Permission.NotAllowed;
456      } else if (source == DB.Permission.Read) {
457        return Permission.Read;
458      } else
459        return Permission.NotAllowed;
460    }
461
462    public static DB.Permission ToEntity(DT.Permission source) {
463      if (source == DT.Permission.Full) {
464        return DB.Permission.Full;
465      } else if (source == DT.Permission.NotAllowed) {
466        return DB.Permission.NotAllowed;
467      } else if (source == DT.Permission.Read) {
468        return DB.Permission.Read;
469      } else
470        return DB.Permission.NotAllowed;
471    }
472    #endregion
473
474    #region Command
475    public static DT.Command? ToDto(DB.Command? source) {
476      if (source.HasValue) {
477        if (source.Value == DB.Command.Abort) {
478          return Command.Abort;
479        } else if (source.Value == DB.Command.Pause) {
480          return Command.Pause;
481        } else if (source.Value == DB.Command.Stop) {
482          return Command.Stop;
483        } else
484          return Command.Pause;
485      }
486      return null;
487    }
488
489    public static DB.Command? ToEntity(DT.Command? source) {
490      if (source.HasValue) {
491        if (source == DT.Command.Abort) {
492          return DB.Command.Abort;
493        } else if (source == DT.Command.Pause) {
494          return DB.Command.Pause;
495        } else if (source == DT.Command.Stop) {
496          return DB.Command.Stop;
497        } else
498          return DB.Command.Pause;
499      } else
500        return null;
501    }
502    #endregion
503
504    #region CpuArchiteture
505    public static DT.CpuArchitecture ToDto(DB.CpuArchitecture source) {
506      if (source == DB.CpuArchitecture.x64) {
507        return CpuArchitecture.x64;
508      } else if (source == DB.CpuArchitecture.x86) {
509        return CpuArchitecture.x86;
510      } else
511        return CpuArchitecture.x86;
512    }
513
514    public static DB.CpuArchitecture ToEntity(DT.CpuArchitecture source) {
515      if (source == DT.CpuArchitecture.x64) {
516        return DB.CpuArchitecture.x64;
517      } else if (source == DT.CpuArchitecture.x86) {
518        return DB.CpuArchitecture.x86;
519      } else
520        return DB.CpuArchitecture.x86;
521    }
522    #endregion
523
524    #region SlaveState
525    public static DT.SlaveState ToDto(DB.SlaveState source) {
526      if (source == DB.SlaveState.Calculating) {
527        return SlaveState.Calculating;
528      } else if (source == DB.SlaveState.Idle) {
529        return SlaveState.Idle;
530      } else if (source == DB.SlaveState.Offline) {
531        return SlaveState.Offline;
532      } else
533        return SlaveState.Offline;
534    }
535
536    public static DB.SlaveState ToEntity(DT.SlaveState source) {
537      if (source == DT.SlaveState.Calculating) {
538        return DB.SlaveState.Calculating;
539      } else if (source == DT.SlaveState.Idle) {
540        return DB.SlaveState.Idle;
541      } else if (source == DT.SlaveState.Offline) {
542        return DB.SlaveState.Offline;
543      } else
544        return DB.SlaveState.Offline;
545    }
546    #endregion
547
548    #region UserPriority
549    public static DT.UserPriority ToDto(DB.UserPriority source) {
550      if (source == null) return null;
551      return new DT.UserPriority() { Id = source.UserId, DateEnqueued = source.DateEnqueued };
552    }
553    public static DB.UserPriority ToEntity(DT.UserPriority source) {
554      if (source == null) return null;
555      var entity = new DB.UserPriority(); ToEntity(source, entity);
556      return entity;
557    }
558    public static void ToEntity(DT.UserPriority source, DB.UserPriority target) {
559      if ((source != null) && (target != null)) {
560        target.UserId = source.Id;
561        target.DateEnqueued = source.DateEnqueued;
562      }
563    }
564    #endregion
565  }
566}
Note: See TracBrowser for help on using the repository browser.