Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OaaS/HeuristicLab.Services.Hive/3.3/Convert.cs @ 10207

Last change on this file since 10207 was 9363, checked in by spimming, 12 years ago

#1888:

  • Merged revisions from trunk
File size: 23.9 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        if (target.StateLogs == null) target.StateLogs = new EntitySet<DB.StateLog>();
70        foreach (DT.StateLog sl in source.StateLog.Where(x => x.Id == Guid.Empty)) {
71          target.StateLogs.Add(Convert.ToEntity(sl));
72        }
73        target.IsParentTask = source.IsParentTask;
74        target.FinishWhenChildJobsFinished = source.FinishWhenChildJobsFinished;
75        target.Command = Convert.ToEntity(source.Command);
76        // RequiredPlugins are added by Dao
77        target.JobId = source.JobId;
78        target.IsPrivileged = source.IsPrivileged;
79      }
80    }
81
82    public static void ToEntityTaskOnly(DT.Task source, DB.Task target) {
83      if ((source != null) && (target != null)) {
84        target.TaskId = source.Id;
85        target.CoresNeeded = source.CoresNeeded;
86        target.ExecutionTimeMs = source.ExecutionTime.TotalMilliseconds;
87        target.MemoryNeeded = source.MemoryNeeded;
88        target.ParentTaskId = source.ParentTaskId;
89        target.Priority = source.Priority;
90        target.LastHeartbeat = source.LastHeartbeat;
91        target.State = Convert.ToEntity(source.State);
92        target.IsParentTask = source.IsParentTask;
93        target.FinishWhenChildJobsFinished = source.FinishWhenChildJobsFinished;
94        target.Command = Convert.ToEntity(source.Command);
95        // RequiredPlugins are added by Dao
96        target.JobId = source.JobId;
97        target.IsPrivileged = source.IsPrivileged;
98      }
99    }
100    #endregion
101
102    #region TaskData
103    public static DT.TaskData ToDto(DB.TaskData source) {
104      if (source == null) return null;
105      return new DT.TaskData { TaskId = source.TaskId, Data = source.Data.ToArray(), LastUpdate = source.LastUpdate };
106    }
107    public static DB.TaskData ToEntity(DT.TaskData source) {
108      if (source == null) return null;
109      var entity = new DB.TaskData(); ToEntity(source, entity);
110      return entity;
111    }
112    public static void ToEntity(DT.TaskData source, DB.TaskData target) {
113      if ((source != null) && (target != null)) {
114        target.TaskId = source.TaskId; target.Data = new Binary(source.Data); target.LastUpdate = source.LastUpdate;
115      }
116    }
117    #endregion
118
119    #region StateLog
120    public static DT.StateLog ToDto(DB.StateLog source) {
121      if (source == null) return null;
122      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 };
123    }
124    public static DB.StateLog ToEntity(DT.StateLog source) {
125      if (source == null) return null;
126      var entity = new DB.StateLog(); ToEntity(source, entity);
127      return entity;
128    }
129    public static void ToEntity(DT.StateLog source, DB.StateLog target) {
130      if ((source != null) && (target != null)) {
131        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;
132      }
133    }
134    #endregion
135
136    #region Downtimes
137    public static DT.Downtime ToDto(DB.Downtime source) {
138      if (source == null) return null;
139      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 };
140    }
141    public static DB.Downtime ToEntity(DT.Downtime source) {
142      if (source == null) return null;
143      var entity = new DB.Downtime(); ToEntity(source, entity);
144      return entity;
145    }
146    public static void ToEntity(DT.Downtime source, DB.Downtime target) {
147      if ((source != null) && (target != null)) {
148        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;
149      }
150    }
151    #endregion
152
153    #region Job
154    public static DT.Job ToDto(DB.Job source) {
155      if (source == null) return null;
156      return new DT.Job { Id = source.JobId, Description = source.Description, Name = source.Name, OwnerUserId = source.OwnerUserId, DateCreated = source.DateCreated, ResourceNames = source.ResourceIds };
157    }
158    public static DB.Job ToEntity(DT.Job source) {
159      if (source == null) return null;
160      var entity = new DB.Job(); ToEntity(source, entity);
161      return entity;
162    }
163    public static void ToEntity(DT.Job source, DB.Job target) {
164      if ((source != null) && (target != null)) {
165        target.JobId = source.Id; target.Description = source.Description; target.Name = source.Name; target.OwnerUserId = source.OwnerUserId; target.DateCreated = source.DateCreated; target.ResourceIds = source.ResourceNames;
166      }
167    }
168    #endregion
169
170    #region JobPermission
171    public static DT.JobPermission ToDto(DB.JobPermission source) {
172      if (source == null) return null;
173      return new DT.JobPermission { JobId = source.JobId, GrantedUserId = source.GrantedUserId, GrantedByUserId = source.GrantedByUserId, Permission = Convert.ToDto(source.Permission) };
174    }
175    public static DB.JobPermission ToEntity(DT.JobPermission source) {
176      if (source == null) return null;
177      var entity = new DB.JobPermission(); ToEntity(source, entity);
178      return entity;
179    }
180    public static void ToEntity(DT.JobPermission source, DB.JobPermission target) {
181      if ((source != null) && (target != null)) {
182        target.JobId = source.JobId; target.GrantedUserId = source.GrantedUserId; target.GrantedByUserId = source.GrantedByUserId; target.Permission = Convert.ToEntity(source.Permission);
183      }
184    }
185    #endregion
186
187    #region Plugin
188    public static DT.Plugin ToDto(DB.Plugin source) {
189      if (source == null) return null;
190      return new DT.Plugin { Id = source.PluginId, Name = source.Name, Version = new Version(source.Version), UserId = source.UserId, DateCreated = source.DateCreated, Hash = source.Hash };
191    }
192    public static DB.Plugin ToEntity(DT.Plugin source) {
193      if (source == null) return null;
194      var entity = new DB.Plugin(); ToEntity(source, entity);
195      return entity;
196    }
197    public static void ToEntity(DT.Plugin source, DB.Plugin target) {
198      if ((source != null) && (target != null)) {
199        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;
200      }
201    }
202    #endregion
203
204    #region PluginData
205    public static DT.PluginData ToDto(DB.PluginData source) {
206      if (source == null) return null;
207      return new DT.PluginData { Id = source.PluginDataId, PluginId = source.PluginId, Data = source.Data.ToArray(), FileName = source.FileName };
208    }
209    public static DB.PluginData ToEntity(DT.PluginData source) {
210      if (source == null) return null;
211      var entity = new DB.PluginData(); ToEntity(source, entity);
212      return entity;
213    }
214    public static void ToEntity(DT.PluginData source, DB.PluginData target) {
215      if ((source != null) && (target != null)) {
216        target.PluginDataId = source.Id; target.PluginId = source.PluginId; target.Data = new Binary(source.Data); target.FileName = source.FileName;
217      }
218    }
219    #endregion
220
221    #region Resource
222    public static DT.Resource ToDto(DB.Resource source) {
223      if (source == null) return null;
224      return new DT.Resource { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId, HbInterval = source.HbInterval, OwnerUserId = source.OwnerUserId };
225    }
226    public static DB.Resource ToEntity(DT.Resource source) {
227      if (source == null) return null;
228      var entity = new DB.Resource(); ToEntity(source, entity);
229      return entity;
230    }
231    public static void ToEntity(DT.Resource source, DB.Resource target) {
232      if ((source != null) && (target != null)) {
233        target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId; target.HbInterval = source.HbInterval; target.OwnerUserId = source.OwnerUserId;
234      }
235    }
236    #endregion
237
238    #region SlaveGroup
239    public static DT.SlaveGroup ToDto(DB.SlaveGroup source) {
240      if (source == null) return null;
241      return new DT.SlaveGroup { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId, HbInterval = source.HbInterval, OwnerUserId = source.OwnerUserId };
242    }
243    public static DB.SlaveGroup ToEntity(DT.SlaveGroup source) {
244      if (source == null) return null;
245      var entity = new DB.SlaveGroup(); ToEntity(source, entity);
246      return entity;
247    }
248    public static void ToEntity(DT.SlaveGroup source, DB.SlaveGroup target) {
249      if ((source != null) && (target != null)) {
250        target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId; target.HbInterval = source.HbInterval; target.OwnerUserId = source.OwnerUserId;
251      }
252    }
253    #endregion
254
255    #region Slave
256    public static DT.Slave ToDto(DB.Slave source) {
257      if (source == null) return null;
258      return new DT.Slave {
259        Id = source.ResourceId,
260        ParentResourceId = source.ParentResourceId,
261        Cores = source.Cores,
262        CpuSpeed = source.CpuSpeed,
263        FreeCores = source.FreeCores,
264        FreeMemory = source.FreeMemory,
265        IsAllowedToCalculate = source.IsAllowedToCalculate,
266        Memory = source.Memory,
267        Name = source.Name,
268        SlaveState = Convert.ToDto(source.SlaveState),
269        CpuArchitecture = Convert.ToDto(source.CpuArchitecture),
270        OperatingSystem = source.OperatingSystem,
271        LastHeartbeat = source.LastHeartbeat,
272        CpuUtilization = source.CpuUtilization,
273        HbInterval = source.HbInterval,
274        IsDisposable = source.IsDisposable,
275        OwnerUserId = source.OwnerUserId
276      };
277    }
278    public static DB.Slave ToEntity(DT.Slave source) {
279      if (source == null) return null;
280      var entity = new DB.Slave(); ToEntity(source, entity);
281      return entity;
282    }
283    public static void ToEntity(DT.Slave source, DB.Slave target) {
284      if ((source != null) && (target != null)) {
285        target.ResourceId = source.Id;
286        target.ParentResourceId = source.ParentResourceId;
287        target.Cores = source.Cores;
288        target.CpuSpeed = source.CpuSpeed;
289        target.FreeCores = source.FreeCores;
290        target.FreeMemory = source.FreeMemory;
291        target.IsAllowedToCalculate = source.IsAllowedToCalculate;
292        target.Memory = source.Memory;
293        target.Name = source.Name;
294        target.SlaveState = Convert.ToEntity(source.SlaveState);
295        target.CpuArchitecture = Convert.ToEntity(source.CpuArchitecture);
296        target.OperatingSystem = source.OperatingSystem;
297        target.LastHeartbeat = source.LastHeartbeat;
298        target.CpuUtilization = source.CpuUtilization;
299        target.HbInterval = source.HbInterval;
300        target.IsDisposable = source.IsDisposable;
301        target.OwnerUserId = source.OwnerUserId;
302      }
303    }
304    #endregion
305
306    #region ResourcePermission
307    public static DT.ResourcePermission ToDto(DB.ResourcePermission source) {
308      if (source == null) return null;
309      return new DT.ResourcePermission { ResourceId = source.ResourceId, GrantedUserId = source.GrantedUserId, GrantedByUserId = source.GrantedByUserId };
310    }
311    public static DB.ResourcePermission ToEntity(DT.ResourcePermission source) {
312      if (source == null) return null;
313      var entity = new DB.ResourcePermission(); ToEntity(source, entity);
314      return entity;
315    }
316    public static void ToEntity(DT.ResourcePermission source, DB.ResourcePermission target) {
317      if ((source != null) && (target != null)) {
318        target.ResourceId = source.ResourceId; target.GrantedUserId = source.GrantedUserId; target.GrantedByUserId = source.GrantedByUserId;
319      }
320    }
321    #endregion
322
323    #region SlaveStatistics
324    public static DT.SlaveStatistics ToDto(DB.SlaveStatistics source) {
325      if (source == null) return null;
326      return new DT.SlaveStatistics {
327        Id = source.StatisticsId,
328        SlaveId = source.SlaveId,
329        Cores = source.Cores,
330        CpuUtilization = source.CpuUtilization,
331        FreeCores = source.FreeCores,
332        FreeMemory = source.FreeMemory,
333        Memory = source.Memory
334      };
335    }
336    public static DB.SlaveStatistics ToEntity(DT.SlaveStatistics source) {
337      if (source == null) return null;
338      var entity = new DB.SlaveStatistics(); ToEntity(source, entity);
339      return entity;
340    }
341    public static void ToEntity(DT.SlaveStatistics source, DB.SlaveStatistics target) {
342      if ((source != null) && (target != null)) {
343        target.StatisticsId = source.Id;
344        target.SlaveId = source.SlaveId;
345        target.Cores = source.Cores;
346        target.CpuUtilization = source.CpuUtilization;
347        target.FreeCores = source.FreeCores;
348        target.FreeMemory = source.FreeMemory;
349        target.Memory = source.Memory;
350      }
351    }
352    #endregion
353
354    #region Statistics
355    public static DT.Statistics ToDto(DB.Statistics source) {
356      if (source == null) return null;
357      return new DT.Statistics {
358        Id = source.StatisticsId,
359        TimeStamp = source.Timestamp,
360        SlaveStatistics = source.SlaveStatistics.Select(x => Convert.ToDto(x)).ToArray(),
361        UserStatistics = source.UserStatistics.Select(x => Convert.ToDto(x)).ToArray()
362      };
363    }
364    public static DB.Statistics ToEntity(DT.Statistics source) {
365      if (source == null) return null;
366      var entity = new DB.Statistics(); ToEntity(source, entity);
367      return entity;
368    }
369    public static void ToEntity(DT.Statistics source, DB.Statistics target) {
370      if ((source != null) && (target != null)) {
371        target.StatisticsId = source.Id;
372        target.Timestamp = source.TimeStamp;
373
374      }
375    }
376    #endregion
377
378    #region UserStatistics
379    public static DT.UserStatistics ToDto(DB.UserStatistics source) {
380      if (source == null) return null;
381      return new DT.UserStatistics {
382        Id = source.StatisticsId,
383        UserId = source.UserId,
384        UsedCores = source.UsedCores,
385        ExecutionTime = TimeSpan.FromMilliseconds(source.ExecutionTimeMs),
386        ExecutionTimeFinishedJobs = TimeSpan.FromMilliseconds(source.ExecutionTimeMsFinishedJobs),
387        StartToEndTime = TimeSpan.FromMilliseconds(source.StartToEndTimeMs)
388      };
389    }
390    public static DB.UserStatistics ToEntity(DT.UserStatistics source) {
391      if (source == null) return null;
392      var entity = new DB.UserStatistics(); ToEntity(source, entity);
393      return entity;
394    }
395    public static void ToEntity(DT.UserStatistics source, DB.UserStatistics target) {
396      if ((source != null) && (target != null)) {
397        target.StatisticsId = source.Id;
398        target.UserId = source.UserId;
399        target.UsedCores = source.UsedCores;
400        target.ExecutionTimeMs = source.ExecutionTime.TotalMilliseconds;
401        target.ExecutionTimeMsFinishedJobs = source.ExecutionTimeFinishedJobs.TotalMilliseconds;
402        target.StartToEndTimeMs = source.StartToEndTime.TotalMilliseconds;
403      }
404    }
405    #endregion
406
407    #region TaskData
408    public static DT.TaskState ToDto(DB.TaskState source) {
409      if (source == DB.TaskState.Aborted) {
410        return TaskState.Aborted;
411      } else if (source == DB.TaskState.Calculating) {
412        return TaskState.Calculating;
413      } else if (source == DB.TaskState.Failed) {
414        return TaskState.Failed;
415      } else if (source == DB.TaskState.Finished) {
416        return TaskState.Finished;
417      } else if (source == DB.TaskState.Offline) {
418        return TaskState.Offline;
419      } else if (source == DB.TaskState.Paused) {
420        return TaskState.Paused;
421      } else if (source == DB.TaskState.Transferring) {
422        return TaskState.Transferring;
423      } else if (source == DB.TaskState.Waiting) {
424        return TaskState.Waiting;
425      } else
426        return TaskState.Failed;
427    }
428
429    public static DB.TaskState ToEntity(DT.TaskState source) {
430      if (source == DT.TaskState.Aborted) {
431        return DB.TaskState.Aborted;
432      } else if (source == DT.TaskState.Calculating) {
433        return DB.TaskState.Calculating;
434      } else if (source == DT.TaskState.Failed) {
435        return DB.TaskState.Failed;
436      } else if (source == DT.TaskState.Finished) {
437        return DB.TaskState.Finished;
438      } else if (source == DT.TaskState.Offline) {
439        return DB.TaskState.Offline;
440      } else if (source == DT.TaskState.Paused) {
441        return DB.TaskState.Paused;
442      } else if (source == DT.TaskState.Transferring) {
443        return DB.TaskState.Transferring;
444      } else if (source == DT.TaskState.Waiting) {
445        return DB.TaskState.Waiting;
446      } else
447        return DB.TaskState.Failed;
448    }
449    #endregion
450
451    #region Permission
452    public static DT.Permission ToDto(DB.Permission source) {
453      if (source == DB.Permission.Full) {
454        return Permission.Full;
455      } else if (source == DB.Permission.NotAllowed) {
456        return Permission.NotAllowed;
457      } else if (source == DB.Permission.Read) {
458        return Permission.Read;
459      } else
460        return Permission.NotAllowed;
461    }
462
463    public static DB.Permission ToEntity(DT.Permission source) {
464      if (source == DT.Permission.Full) {
465        return DB.Permission.Full;
466      } else if (source == DT.Permission.NotAllowed) {
467        return DB.Permission.NotAllowed;
468      } else if (source == DT.Permission.Read) {
469        return DB.Permission.Read;
470      } else
471        return DB.Permission.NotAllowed;
472    }
473    #endregion
474
475    #region Command
476    public static DT.Command? ToDto(DB.Command? source) {
477      if (source.HasValue) {
478        if (source.Value == DB.Command.Abort) {
479          return Command.Abort;
480        } else if (source.Value == DB.Command.Pause) {
481          return Command.Pause;
482        } else if (source.Value == DB.Command.Stop) {
483          return Command.Stop;
484        } else
485          return Command.Pause;
486      }
487      return null;
488    }
489
490    public static DB.Command? ToEntity(DT.Command? source) {
491      if (source.HasValue) {
492        if (source == DT.Command.Abort) {
493          return DB.Command.Abort;
494        } else if (source == DT.Command.Pause) {
495          return DB.Command.Pause;
496        } else if (source == DT.Command.Stop) {
497          return DB.Command.Stop;
498        } else
499          return DB.Command.Pause;
500      } else
501        return null;
502    }
503    #endregion
504
505    #region CpuArchiteture
506    public static DT.CpuArchitecture ToDto(DB.CpuArchitecture source) {
507      if (source == DB.CpuArchitecture.x64) {
508        return CpuArchitecture.x64;
509      } else if (source == DB.CpuArchitecture.x86) {
510        return CpuArchitecture.x86;
511      } else
512        return CpuArchitecture.x86;
513    }
514
515    public static DB.CpuArchitecture ToEntity(DT.CpuArchitecture source) {
516      if (source == DT.CpuArchitecture.x64) {
517        return DB.CpuArchitecture.x64;
518      } else if (source == DT.CpuArchitecture.x86) {
519        return DB.CpuArchitecture.x86;
520      } else
521        return DB.CpuArchitecture.x86;
522    }
523    #endregion
524
525    #region SlaveState
526    public static DT.SlaveState ToDto(DB.SlaveState source) {
527      if (source == DB.SlaveState.Calculating) {
528        return SlaveState.Calculating;
529      } else if (source == DB.SlaveState.Idle) {
530        return SlaveState.Idle;
531      } else if (source == DB.SlaveState.Offline) {
532        return SlaveState.Offline;
533      } else
534        return SlaveState.Offline;
535    }
536
537    public static DB.SlaveState ToEntity(DT.SlaveState source) {
538      if (source == DT.SlaveState.Calculating) {
539        return DB.SlaveState.Calculating;
540      } else if (source == DT.SlaveState.Idle) {
541        return DB.SlaveState.Idle;
542      } else if (source == DT.SlaveState.Offline) {
543        return DB.SlaveState.Offline;
544      } else
545        return DB.SlaveState.Offline;
546    }
547    #endregion
548
549    #region UserPriority
550    public static DT.UserPriority ToDto(DB.UserPriority source) {
551      if (source == null) return null;
552      return new DT.UserPriority() { Id = source.UserId, DateEnqueued = source.DateEnqueued };
553    }
554    public static DB.UserPriority ToEntity(DT.UserPriority source) {
555      if (source == null) return null;
556      var entity = new DB.UserPriority(); ToEntity(source, entity);
557      return entity;
558    }
559    public static void ToEntity(DT.UserPriority source, DB.UserPriority target) {
560      if ((source != null) && (target != null)) {
561        target.UserId = source.Id;
562        target.DateEnqueued = source.DateEnqueued;
563      }
564    }
565    #endregion
566  }
567}
Note: See TracBrowser for help on using the repository browser.