1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2010 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 |
|
---|
22 | using System.Collections.Generic;
|
---|
23 | using System.Data.Linq;
|
---|
24 | using System.Linq;
|
---|
25 | using DA = HeuristicLab.Services.OKB.DataAccess;
|
---|
26 | using DT = HeuristicLab.Services.OKB.DataTransfer;
|
---|
27 |
|
---|
28 | namespace HeuristicLab.Services.OKB {
|
---|
29 | public static class Convert {
|
---|
30 | #region Platform
|
---|
31 | public static DT.Platform ToDto(DA.Platform source) {
|
---|
32 | if (source == null) return null;
|
---|
33 | return new DT.Platform { Id = source.Id, Name = source.Name, Description = source.Description };
|
---|
34 | }
|
---|
35 | public static DA.Platform ToEntity(DT.Platform source) {
|
---|
36 | if (source == null) return null;
|
---|
37 | return new DA.Platform { Id = source.Id, Name = source.Name, Description = source.Description };
|
---|
38 | }
|
---|
39 | public static void ToEntity(DT.Platform source, DA.Platform target) {
|
---|
40 | if ((source != null) && (target != null)) {
|
---|
41 | target.Id = source.Id; target.Name = source.Name; target.Description = source.Description;
|
---|
42 | }
|
---|
43 | }
|
---|
44 | #endregion
|
---|
45 |
|
---|
46 | #region DataType
|
---|
47 | public static DT.DataType ToDto(DA.DataType source) {
|
---|
48 | if (source == null) return null;
|
---|
49 | return new DT.DataType { Id = source.Id, Name = source.Name, SqlName = source.SqlName, PlatformId = source.PlatformId };
|
---|
50 | }
|
---|
51 | public static DA.DataType ToEntity(DT.DataType source) {
|
---|
52 | if (source == null) return null;
|
---|
53 | return new DA.DataType { Id = source.Id, Name = source.Name, SqlName = source.SqlName, PlatformId = source.PlatformId };
|
---|
54 | }
|
---|
55 | public static void ToEntity(DT.DataType source, DA.DataType target) {
|
---|
56 | if ((source != null) && (target != null)) {
|
---|
57 | target.Id = source.Id; target.Name = source.Name; target.SqlName = source.SqlName; target.PlatformId = source.PlatformId;
|
---|
58 | }
|
---|
59 | }
|
---|
60 | #endregion
|
---|
61 |
|
---|
62 | #region AlgorithmClass
|
---|
63 | public static DT.AlgorithmClass ToDto(DA.AlgorithmClass source) {
|
---|
64 | if (source == null) return null;
|
---|
65 | return new DT.AlgorithmClass { Id = source.Id, Name = source.Name, Description = source.Description };
|
---|
66 | }
|
---|
67 | public static DA.AlgorithmClass ToEntity(DT.AlgorithmClass source) {
|
---|
68 | if (source == null) return null;
|
---|
69 | return new DA.AlgorithmClass { Id = source.Id, Name = source.Name, Description = source.Description };
|
---|
70 | }
|
---|
71 | public static void ToEntity(DT.AlgorithmClass source, DA.AlgorithmClass target) {
|
---|
72 | if ((source != null) && (target != null)) {
|
---|
73 | target.Id = source.Id; target.Name = source.Name; target.Description = source.Description;
|
---|
74 | }
|
---|
75 | }
|
---|
76 | #endregion
|
---|
77 |
|
---|
78 | #region Algorithm
|
---|
79 | public static DT.Algorithm ToDto(DA.Algorithm source) {
|
---|
80 | if (source == null) return null;
|
---|
81 | return new DT.Algorithm { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, AlgorithmClassId = source.AlgorithmClassId };
|
---|
82 | }
|
---|
83 | public static DA.Algorithm ToEntity(DT.Algorithm source) {
|
---|
84 | if (source == null) return null;
|
---|
85 | return new DA.Algorithm { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, AlgorithmClassId = source.AlgorithmClassId };
|
---|
86 | }
|
---|
87 | public static void ToEntity(DT.Algorithm source, DA.Algorithm target) {
|
---|
88 | if ((source != null) && (target != null)) {
|
---|
89 | target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.PlatformId = source.PlatformId; target.AlgorithmClassId = source.AlgorithmClassId;
|
---|
90 | }
|
---|
91 | }
|
---|
92 | #endregion
|
---|
93 |
|
---|
94 | #region AlgorithmData
|
---|
95 | public static DT.AlgorithmData ToDto(DA.AlgorithmData source) {
|
---|
96 | if (source == null) return null;
|
---|
97 | return new DT.AlgorithmData { AlgorithmId = source.AlgorithmId, DataTypeId = source.DataTypeId, Data = source.Data.ToArray() };
|
---|
98 | }
|
---|
99 | public static DA.AlgorithmData ToEntity(DT.AlgorithmData source) {
|
---|
100 | if (source == null) return null;
|
---|
101 | return new DA.AlgorithmData { AlgorithmId = source.AlgorithmId, DataTypeId = source.DataTypeId, Data = new Binary(source.Data) };
|
---|
102 | }
|
---|
103 | public static void ToEntity(DT.AlgorithmData source, DA.AlgorithmData target) {
|
---|
104 | if ((source != null) && (target != null)) {
|
---|
105 | target.AlgorithmId = source.AlgorithmId; target.DataTypeId = source.DataTypeId; target.Data = new Binary(source.Data);
|
---|
106 | }
|
---|
107 | }
|
---|
108 | #endregion
|
---|
109 |
|
---|
110 | #region AlgorithmParameter
|
---|
111 | public static DT.AlgorithmParameter ToDto(DA.AlgorithmParameter source) {
|
---|
112 | if (source == null) return null;
|
---|
113 | return new DT.AlgorithmParameter { Id = source.Id, Name = source.Name, Description = source.Description, Alias = source.Alias, AlgorithmId = source.AlgorithmId, DataTypeId = source.DataTypeId };
|
---|
114 | }
|
---|
115 | public static DA.AlgorithmParameter ToEntity(DT.AlgorithmParameter source) {
|
---|
116 | if (source == null) return null;
|
---|
117 | return new DA.AlgorithmParameter { Id = source.Id, Name = source.Name, Description = source.Description, Alias = source.Alias, AlgorithmId = source.AlgorithmId, DataTypeId = source.DataTypeId };
|
---|
118 | }
|
---|
119 | public static void ToEntity(DT.AlgorithmParameter source, DA.AlgorithmParameter target) {
|
---|
120 | if ((source != null) && (target != null)) {
|
---|
121 | target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.Alias = source.Alias; target.AlgorithmId = source.AlgorithmId; target.DataTypeId = source.DataTypeId;
|
---|
122 | }
|
---|
123 | }
|
---|
124 | #endregion
|
---|
125 |
|
---|
126 | #region AlgorithmParameterBlobValue
|
---|
127 | public static DT.AlgorithmParameterBlobValue ToDto(DA.AlgorithmParameterBlobValue source) {
|
---|
128 | if (source == null) return null;
|
---|
129 | return new DT.AlgorithmParameterBlobValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value.ToArray() };
|
---|
130 | }
|
---|
131 | public static DA.AlgorithmParameterBlobValue ToEntity(DT.AlgorithmParameterBlobValue source) {
|
---|
132 | if (source == null) return null;
|
---|
133 | return new DA.AlgorithmParameterBlobValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = new Binary(source.Value) };
|
---|
134 | }
|
---|
135 | public static void ToEntity(DT.AlgorithmParameterBlobValue source, DA.AlgorithmParameterBlobValue target) {
|
---|
136 | if ((source != null) && (target != null)) {
|
---|
137 | target.AlgorithmParameterId = source.AlgorithmParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = new Binary(source.Value);
|
---|
138 | }
|
---|
139 | }
|
---|
140 | #endregion
|
---|
141 |
|
---|
142 | #region AlgorithmParameterBoolValue
|
---|
143 | public static DT.AlgorithmParameterBoolValue ToDto(DA.AlgorithmParameterBoolValue source) {
|
---|
144 | if (source == null) return null;
|
---|
145 | return new DT.AlgorithmParameterBoolValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
146 | }
|
---|
147 | public static DA.AlgorithmParameterBoolValue ToEntity(DT.AlgorithmParameterBoolValue source) {
|
---|
148 | if (source == null) return null;
|
---|
149 | return new DA.AlgorithmParameterBoolValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
150 | }
|
---|
151 | public static void ToEntity(DT.AlgorithmParameterBoolValue source, DA.AlgorithmParameterBoolValue target) {
|
---|
152 | if ((source != null) && (target != null)) {
|
---|
153 | target.AlgorithmParameterId = source.AlgorithmParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = source.Value;
|
---|
154 | }
|
---|
155 | }
|
---|
156 | #endregion
|
---|
157 |
|
---|
158 | #region AlgorithmParameterFloatValue
|
---|
159 | public static DT.AlgorithmParameterFloatValue ToDto(DA.AlgorithmParameterFloatValue source) {
|
---|
160 | if (source == null) return null;
|
---|
161 | return new DT.AlgorithmParameterFloatValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
162 | }
|
---|
163 | public static DA.AlgorithmParameterFloatValue ToEntity(DT.AlgorithmParameterFloatValue source) {
|
---|
164 | if (source == null) return null;
|
---|
165 | return new DA.AlgorithmParameterFloatValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
166 | }
|
---|
167 | public static void ToEntity(DT.AlgorithmParameterFloatValue source, DA.AlgorithmParameterFloatValue target) {
|
---|
168 | if ((source != null) && (target != null)) {
|
---|
169 | target.AlgorithmParameterId = source.AlgorithmParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = source.Value;
|
---|
170 | }
|
---|
171 | }
|
---|
172 | #endregion
|
---|
173 |
|
---|
174 | #region AlgorithmParameterIntValue
|
---|
175 | public static DT.AlgorithmParameterIntValue ToDto(DA.AlgorithmParameterIntValue source) {
|
---|
176 | if (source == null) return null;
|
---|
177 | return new DT.AlgorithmParameterIntValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
178 | }
|
---|
179 | public static DA.AlgorithmParameterIntValue ToEntity(DT.AlgorithmParameterIntValue source) {
|
---|
180 | if (source == null) return null;
|
---|
181 | return new DA.AlgorithmParameterIntValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
182 | }
|
---|
183 | public static void ToEntity(DT.AlgorithmParameterIntValue source, DA.AlgorithmParameterIntValue target) {
|
---|
184 | if ((source != null) && (target != null)) {
|
---|
185 | target.AlgorithmParameterId = source.AlgorithmParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = source.Value;
|
---|
186 | }
|
---|
187 | }
|
---|
188 | #endregion
|
---|
189 |
|
---|
190 | #region AlgorithmParameterStringValue
|
---|
191 | public static DT.AlgorithmParameterStringValue ToDto(DA.AlgorithmParameterStringValue source) {
|
---|
192 | if (source == null) return null;
|
---|
193 | return new DT.AlgorithmParameterStringValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
194 | }
|
---|
195 | public static DA.AlgorithmParameterStringValue ToEntity(DT.AlgorithmParameterStringValue source) {
|
---|
196 | if (source == null) return null;
|
---|
197 | return new DA.AlgorithmParameterStringValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
198 | }
|
---|
199 | public static void ToEntity(DT.AlgorithmParameterStringValue source, DA.AlgorithmParameterStringValue target) {
|
---|
200 | if ((source != null) && (target != null)) {
|
---|
201 | target.AlgorithmParameterId = source.AlgorithmParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = source.Value;
|
---|
202 | }
|
---|
203 | }
|
---|
204 | #endregion
|
---|
205 |
|
---|
206 | #region ProblemClass
|
---|
207 | public static DT.ProblemClass ToDto(DA.ProblemClass source) {
|
---|
208 | if (source == null) return null;
|
---|
209 | return new DT.ProblemClass { Id = source.Id, Name = source.Name, Description = source.Description };
|
---|
210 | }
|
---|
211 | public static DA.ProblemClass ToEntity(DT.ProblemClass source) {
|
---|
212 | if (source == null) return null;
|
---|
213 | return new DA.ProblemClass { Id = source.Id, Name = source.Name, Description = source.Description };
|
---|
214 | }
|
---|
215 | public static void ToEntity(DT.ProblemClass source, DA.ProblemClass target) {
|
---|
216 | if ((source != null) && (target != null)) {
|
---|
217 | target.Id = source.Id; target.Name = source.Name; target.Description = source.Description;
|
---|
218 | }
|
---|
219 | }
|
---|
220 | #endregion
|
---|
221 |
|
---|
222 | #region Problem
|
---|
223 | public static DT.Problem ToDto(DA.Problem source) {
|
---|
224 | if (source == null) return null;
|
---|
225 | return new DT.Problem { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, ProblemClassId = source.ProblemClassId };
|
---|
226 | }
|
---|
227 | public static DA.Problem ToEntity(DT.Problem source) {
|
---|
228 | if (source == null) return null;
|
---|
229 | return new DA.Problem { Id = source.Id, Name = source.Name, Description = source.Description, PlatformId = source.PlatformId, ProblemClassId = source.ProblemClassId };
|
---|
230 | }
|
---|
231 | public static void ToEntity(DT.Problem source, DA.Problem target) {
|
---|
232 | if ((source != null) && (target != null)) {
|
---|
233 | target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.PlatformId = source.PlatformId; target.ProblemClassId = source.ProblemClassId;
|
---|
234 | }
|
---|
235 | }
|
---|
236 | #endregion
|
---|
237 |
|
---|
238 | #region ProblemData
|
---|
239 | public static DT.ProblemData ToDto(DA.ProblemData source) {
|
---|
240 | if (source == null) return null;
|
---|
241 | return new DT.ProblemData { ProblemId = source.ProblemId, DataTypeId = source.DataTypeId, Data = source.Data.ToArray() };
|
---|
242 | }
|
---|
243 | public static DA.ProblemData ToEntity(DT.ProblemData source) {
|
---|
244 | if (source == null) return null;
|
---|
245 | return new DA.ProblemData { ProblemId = source.ProblemId, DataTypeId = source.DataTypeId, Data = new Binary(source.Data) };
|
---|
246 | }
|
---|
247 | public static void ToEntity(DT.ProblemData source, DA.ProblemData target) {
|
---|
248 | if ((source != null) && (target != null)) {
|
---|
249 | target.ProblemId = source.ProblemId; target.DataTypeId = source.DataTypeId; target.Data = new Binary(source.Data);
|
---|
250 | }
|
---|
251 | }
|
---|
252 | #endregion
|
---|
253 |
|
---|
254 | #region ProblemParameter
|
---|
255 | public static DT.ProblemParameter ToDto(DA.ProblemParameter source) {
|
---|
256 | if (source == null) return null;
|
---|
257 | return new DT.ProblemParameter { Id = source.Id, Name = source.Name, Description = source.Description, Alias = source.Alias, ProblemId = source.ProblemId, DataTypeId = source.DataTypeId };
|
---|
258 | }
|
---|
259 | public static DA.ProblemParameter ToEntity(DT.ProblemParameter source) {
|
---|
260 | if (source == null) return null;
|
---|
261 | return new DA.ProblemParameter { Id = source.Id, Name = source.Name, Description = source.Description, Alias = source.Alias, ProblemId = source.ProblemId, DataTypeId = source.DataTypeId };
|
---|
262 | }
|
---|
263 | public static void ToEntity(DT.ProblemParameter source, DA.ProblemParameter target) {
|
---|
264 | if ((source != null) && (target != null)) {
|
---|
265 | target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.Alias = source.Alias; target.ProblemId = source.ProblemId; target.DataTypeId = source.DataTypeId;
|
---|
266 | }
|
---|
267 | }
|
---|
268 | #endregion
|
---|
269 |
|
---|
270 | #region ProblemParameterBlobValue
|
---|
271 | public static DT.ProblemParameterBlobValue ToDto(DA.ProblemParameterBlobValue source) {
|
---|
272 | if (source == null) return null;
|
---|
273 | return new DT.ProblemParameterBlobValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value.ToArray() };
|
---|
274 | }
|
---|
275 | public static DA.ProblemParameterBlobValue ToEntity(DT.ProblemParameterBlobValue source) {
|
---|
276 | if (source == null) return null;
|
---|
277 | return new DA.ProblemParameterBlobValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = new Binary(source.Value) };
|
---|
278 | }
|
---|
279 | public static void ToEntity(DT.ProblemParameterBlobValue source, DA.ProblemParameterBlobValue target) {
|
---|
280 | if ((source != null) && (target != null)) {
|
---|
281 | target.ProblemParameterId = source.ProblemParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = new Binary(source.Value);
|
---|
282 | }
|
---|
283 | }
|
---|
284 | #endregion
|
---|
285 |
|
---|
286 | #region ProblemParameterBoolValue
|
---|
287 | public static DT.ProblemParameterBoolValue ToDto(DA.ProblemParameterBoolValue source) {
|
---|
288 | if (source == null) return null;
|
---|
289 | return new DT.ProblemParameterBoolValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
290 | }
|
---|
291 | public static DA.ProblemParameterBoolValue ToEntity(DT.ProblemParameterBoolValue source) {
|
---|
292 | if (source == null) return null;
|
---|
293 | return new DA.ProblemParameterBoolValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
294 | }
|
---|
295 | public static void ToEntity(DT.ProblemParameterBoolValue source, DA.ProblemParameterBoolValue target) {
|
---|
296 | if ((source != null) && (target != null)) {
|
---|
297 | target.ProblemParameterId = source.ProblemParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = source.Value;
|
---|
298 | }
|
---|
299 | }
|
---|
300 | #endregion
|
---|
301 |
|
---|
302 | #region ProblemParameterFloatValue
|
---|
303 | public static DT.ProblemParameterFloatValue ToDto(DA.ProblemParameterFloatValue source) {
|
---|
304 | if (source == null) return null;
|
---|
305 | return new DT.ProblemParameterFloatValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
306 | }
|
---|
307 | public static DA.ProblemParameterFloatValue ToEntity(DT.ProblemParameterFloatValue source) {
|
---|
308 | if (source == null) return null;
|
---|
309 | return new DA.ProblemParameterFloatValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
310 | }
|
---|
311 | public static void ToEntity(DT.ProblemParameterFloatValue source, DA.ProblemParameterFloatValue target) {
|
---|
312 | if ((source != null) && (target != null)) {
|
---|
313 | target.ProblemParameterId = source.ProblemParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = source.Value;
|
---|
314 | }
|
---|
315 | }
|
---|
316 | #endregion
|
---|
317 |
|
---|
318 | #region ProblemParameterIntValue
|
---|
319 | public static DT.ProblemParameterIntValue ToDto(DA.ProblemParameterIntValue source) {
|
---|
320 | if (source == null) return null;
|
---|
321 | return new DT.ProblemParameterIntValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
322 | }
|
---|
323 | public static DA.ProblemParameterIntValue ToEntity(DT.ProblemParameterIntValue source) {
|
---|
324 | if (source == null) return null;
|
---|
325 | return new DA.ProblemParameterIntValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
326 | }
|
---|
327 | public static void ToEntity(DT.ProblemParameterIntValue source, DA.ProblemParameterIntValue target) {
|
---|
328 | if ((source != null) && (target != null)) {
|
---|
329 | target.ProblemParameterId = source.ProblemParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = source.Value;
|
---|
330 | }
|
---|
331 | }
|
---|
332 | #endregion
|
---|
333 |
|
---|
334 | #region ProblemParameterStringValue
|
---|
335 | public static DT.ProblemParameterStringValue ToDto(DA.ProblemParameterStringValue source) {
|
---|
336 | if (source == null) return null;
|
---|
337 | return new DT.ProblemParameterStringValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
338 | }
|
---|
339 | public static DA.ProblemParameterStringValue ToEntity(DT.ProblemParameterStringValue source) {
|
---|
340 | if (source == null) return null;
|
---|
341 | return new DA.ProblemParameterStringValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
342 | }
|
---|
343 | public static void ToEntity(DT.ProblemParameterStringValue source, DA.ProblemParameterStringValue target) {
|
---|
344 | if ((source != null) && (target != null)) {
|
---|
345 | target.ProblemParameterId = source.ProblemParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = source.Value;
|
---|
346 | }
|
---|
347 | }
|
---|
348 | #endregion
|
---|
349 |
|
---|
350 | #region Result
|
---|
351 | public static DT.Result ToDto(DA.Result source) {
|
---|
352 | if (source == null) return null;
|
---|
353 | return new DT.Result { Id = source.Id, Name = source.Name, Description = source.Description, Alias = source.Alias, AlgorithmId = source.AlgorithmId, DataTypeId = source.DataTypeId };
|
---|
354 | }
|
---|
355 | public static DA.Result ToEntity(DT.Result source) {
|
---|
356 | if (source == null) return null;
|
---|
357 | return new DA.Result { Id = source.Id, Name = source.Name, Description = source.Description, Alias = source.Alias, AlgorithmId = source.AlgorithmId, DataTypeId = source.DataTypeId };
|
---|
358 | }
|
---|
359 | public static void ToEntity(DT.Result source, DA.Result target) {
|
---|
360 | if ((source != null) && (target != null)) {
|
---|
361 | target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.Alias = source.Alias; target.AlgorithmId = source.AlgorithmId; target.DataTypeId = source.DataTypeId;
|
---|
362 | }
|
---|
363 | }
|
---|
364 | #endregion
|
---|
365 |
|
---|
366 | #region ResultBlobValue
|
---|
367 | public static DT.ResultBlobValue ToDto(DA.ResultBlobValue source) {
|
---|
368 | if (source == null) return null;
|
---|
369 | return new DT.ResultBlobValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = source.Value.ToArray() };
|
---|
370 | }
|
---|
371 | public static DA.ResultBlobValue ToEntity(DT.ResultBlobValue source) {
|
---|
372 | if (source == null) return null;
|
---|
373 | return new DA.ResultBlobValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = new Binary(source.Value) };
|
---|
374 | }
|
---|
375 | public static void ToEntity(DT.ResultBlobValue source, DA.ResultBlobValue target) {
|
---|
376 | if ((source != null) && (target != null)) {
|
---|
377 | target.ResultId = source.ResultId; target.RunId = source.RunId; target.DataTypeId = source.DataTypeId; target.Value = new Binary(source.Value);
|
---|
378 | }
|
---|
379 | }
|
---|
380 | #endregion
|
---|
381 |
|
---|
382 | #region ResultBoolValue
|
---|
383 | public static DT.ResultBoolValue ToDto(DA.ResultBoolValue source) {
|
---|
384 | if (source == null) return null;
|
---|
385 | return new DT.ResultBoolValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
386 | }
|
---|
387 | public static DA.ResultBoolValue ToEntity(DT.ResultBoolValue source) {
|
---|
388 | if (source == null) return null;
|
---|
389 | return new DA.ResultBoolValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
390 | }
|
---|
391 | public static void ToEntity(DT.ResultBoolValue source, DA.ResultBoolValue target) {
|
---|
392 | if ((source != null) && (target != null)) {
|
---|
393 | target.ResultId = source.ResultId; target.RunId = source.RunId; target.DataTypeId = source.DataTypeId; target.Value = source.Value;
|
---|
394 | }
|
---|
395 | }
|
---|
396 | #endregion
|
---|
397 |
|
---|
398 | #region ResultFloatValue
|
---|
399 | public static DT.ResultFloatValue ToDto(DA.ResultFloatValue source) {
|
---|
400 | if (source == null) return null;
|
---|
401 | return new DT.ResultFloatValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
402 | }
|
---|
403 | public static DA.ResultFloatValue ToEntity(DT.ResultFloatValue source) {
|
---|
404 | if (source == null) return null;
|
---|
405 | return new DA.ResultFloatValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
406 | }
|
---|
407 | public static void ToEntity(DT.ResultFloatValue source, DA.ResultFloatValue target) {
|
---|
408 | if ((source != null) && (target != null)) {
|
---|
409 | target.ResultId = source.ResultId; target.RunId = source.RunId; target.DataTypeId = source.DataTypeId; target.Value = source.Value;
|
---|
410 | }
|
---|
411 | }
|
---|
412 | #endregion
|
---|
413 |
|
---|
414 | #region ResultIntValue
|
---|
415 | public static DT.ResultIntValue ToDto(DA.ResultIntValue source) {
|
---|
416 | if (source == null) return null;
|
---|
417 | return new DT.ResultIntValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
418 | }
|
---|
419 | public static DA.ResultIntValue ToEntity(DT.ResultIntValue source) {
|
---|
420 | if (source == null) return null;
|
---|
421 | return new DA.ResultIntValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
422 | }
|
---|
423 | public static void ToEntity(DT.ResultIntValue source, DA.ResultIntValue target) {
|
---|
424 | if ((source != null) && (target != null)) {
|
---|
425 | target.ResultId = source.ResultId; target.RunId = source.RunId; target.DataTypeId = source.DataTypeId; target.Value = source.Value;
|
---|
426 | }
|
---|
427 | }
|
---|
428 | #endregion
|
---|
429 |
|
---|
430 | #region ResultStringValue
|
---|
431 | public static DT.ResultStringValue ToDto(DA.ResultStringValue source) {
|
---|
432 | if (source == null) return null;
|
---|
433 | return new DT.ResultStringValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
434 | }
|
---|
435 | public static DA.ResultStringValue ToEntity(DT.ResultStringValue source) {
|
---|
436 | if (source == null) return null;
|
---|
437 | return new DA.ResultStringValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = source.Value };
|
---|
438 | }
|
---|
439 | public static void ToEntity(DT.ResultStringValue source, DA.ResultStringValue target) {
|
---|
440 | if ((source != null) && (target != null)) {
|
---|
441 | target.ResultId = source.ResultId; target.RunId = source.RunId; target.DataTypeId = source.DataTypeId; target.Value = source.Value;
|
---|
442 | }
|
---|
443 | }
|
---|
444 | #endregion
|
---|
445 |
|
---|
446 | #region Experiment
|
---|
447 | public static DT.Experiment ToDto(DA.Experiment source) {
|
---|
448 | if (source == null) return null;
|
---|
449 | DT.Experiment target = new DT.Experiment { Id = source.Id, AlgorithmId = source.AlgorithmId, ProblemId = source.ProblemId };
|
---|
450 |
|
---|
451 | List<DT.AlgorithmParameterValue> algorithmParameterValues = new List<DT.AlgorithmParameterValue>();
|
---|
452 | foreach (DA.AlgorithmParameterBlobValue value in source.AlgorithmParameterBlobValues)
|
---|
453 | algorithmParameterValues.Add(Convert.ToDto(value));
|
---|
454 | foreach (DA.AlgorithmParameterBoolValue value in source.AlgorithmParameterBoolValues)
|
---|
455 | algorithmParameterValues.Add(Convert.ToDto(value));
|
---|
456 | foreach (DA.AlgorithmParameterFloatValue value in source.AlgorithmParameterFloatValues)
|
---|
457 | algorithmParameterValues.Add(Convert.ToDto(value));
|
---|
458 | foreach (DA.AlgorithmParameterIntValue value in source.AlgorithmParameterIntValues)
|
---|
459 | algorithmParameterValues.Add(Convert.ToDto(value));
|
---|
460 | foreach (DA.AlgorithmParameterStringValue value in source.AlgorithmParameterStringValues)
|
---|
461 | algorithmParameterValues.Add(Convert.ToDto(value));
|
---|
462 | target.AlgorithmParameterValues = algorithmParameterValues.ToArray();
|
---|
463 |
|
---|
464 | List<DT.ProblemParameterValue> problemParameterValues = new List<DT.ProblemParameterValue>();
|
---|
465 | foreach (DA.ProblemParameterBlobValue value in source.ProblemParameterBlobValues)
|
---|
466 | problemParameterValues.Add(Convert.ToDto(value));
|
---|
467 | foreach (DA.ProblemParameterBoolValue value in source.ProblemParameterBoolValues)
|
---|
468 | problemParameterValues.Add(Convert.ToDto(value));
|
---|
469 | foreach (DA.ProblemParameterFloatValue value in source.ProblemParameterFloatValues)
|
---|
470 | problemParameterValues.Add(Convert.ToDto(value));
|
---|
471 | foreach (DA.ProblemParameterIntValue value in source.ProblemParameterIntValues)
|
---|
472 | problemParameterValues.Add(Convert.ToDto(value));
|
---|
473 | foreach (DA.ProblemParameterStringValue value in source.ProblemParameterStringValues)
|
---|
474 | problemParameterValues.Add(Convert.ToDto(value));
|
---|
475 | target.ProblemParameterValues = problemParameterValues.ToArray();
|
---|
476 |
|
---|
477 | return target;
|
---|
478 | }
|
---|
479 | public static DA.Experiment ToEntity(DT.Experiment source) {
|
---|
480 | if (source == null) return null;
|
---|
481 | DA.Experiment target = new DA.Experiment();
|
---|
482 | Convert.ToEntity(source, target);
|
---|
483 | return target;
|
---|
484 | }
|
---|
485 | public static void ToEntity(DT.Experiment source, DA.Experiment target) {
|
---|
486 | if ((source != null) && (target != null)) {
|
---|
487 | target.Id = source.Id; target.AlgorithmId = source.AlgorithmId; target.ProblemId = source.ProblemId;
|
---|
488 |
|
---|
489 | foreach (DT.AlgorithmParameterBlobValue value in source.AlgorithmParameterValues.OfType<DT.AlgorithmParameterBlobValue>())
|
---|
490 | target.AlgorithmParameterBlobValues.Add(Convert.ToEntity(value));
|
---|
491 | foreach (DT.AlgorithmParameterBoolValue value in source.AlgorithmParameterValues.OfType<DT.AlgorithmParameterBoolValue>())
|
---|
492 | target.AlgorithmParameterBoolValues.Add(Convert.ToEntity(value));
|
---|
493 | foreach (DT.AlgorithmParameterFloatValue value in source.AlgorithmParameterValues.OfType<DT.AlgorithmParameterFloatValue>())
|
---|
494 | target.AlgorithmParameterFloatValues.Add(Convert.ToEntity(value));
|
---|
495 | foreach (DT.AlgorithmParameterIntValue value in source.AlgorithmParameterValues.OfType<DT.AlgorithmParameterIntValue>())
|
---|
496 | target.AlgorithmParameterIntValues.Add(Convert.ToEntity(value));
|
---|
497 | foreach (DT.AlgorithmParameterStringValue value in source.AlgorithmParameterValues.OfType<DT.AlgorithmParameterStringValue>())
|
---|
498 | target.AlgorithmParameterStringValues.Add(Convert.ToEntity(value));
|
---|
499 |
|
---|
500 | foreach (DT.ProblemParameterBlobValue value in source.ProblemParameterValues.OfType<DT.ProblemParameterBlobValue>())
|
---|
501 | target.ProblemParameterBlobValues.Add(Convert.ToEntity(value));
|
---|
502 | foreach (DT.ProblemParameterBoolValue value in source.ProblemParameterValues.OfType<DT.ProblemParameterBoolValue>())
|
---|
503 | target.ProblemParameterBoolValues.Add(Convert.ToEntity(value));
|
---|
504 | foreach (DT.ProblemParameterFloatValue value in source.ProblemParameterValues.OfType<DT.ProblemParameterFloatValue>())
|
---|
505 | target.ProblemParameterFloatValues.Add(Convert.ToEntity(value));
|
---|
506 | foreach (DT.ProblemParameterIntValue value in source.ProblemParameterValues.OfType<DT.ProblemParameterIntValue>())
|
---|
507 | target.ProblemParameterIntValues.Add(Convert.ToEntity(value));
|
---|
508 | foreach (DT.ProblemParameterStringValue value in source.ProblemParameterValues.OfType<DT.ProblemParameterStringValue>())
|
---|
509 | target.ProblemParameterStringValues.Add(Convert.ToEntity(value));
|
---|
510 | }
|
---|
511 | }
|
---|
512 | #endregion
|
---|
513 |
|
---|
514 | #region Run
|
---|
515 | public static DT.Run ToDto(DA.Run source) {
|
---|
516 | if (source == null) return null;
|
---|
517 | DT.Run target = new DT.Run { Id = source.Id, RandomSeed = source.RandomSeed, FinishedDate = source.FinishedDate, ExperimentId = source.ExperimentId, UserId = source.UserId, ClientId = source.ClientId };
|
---|
518 |
|
---|
519 | List<DT.ResultValue> resultValues = new List<DT.ResultValue>();
|
---|
520 | foreach (DA.ResultBlobValue value in source.ResultBlobValues)
|
---|
521 | resultValues.Add(Convert.ToDto(value));
|
---|
522 | foreach (DA.ResultBoolValue value in source.ResultBoolValues)
|
---|
523 | resultValues.Add(Convert.ToDto(value));
|
---|
524 | foreach (DA.ResultFloatValue value in source.ResultFloatValues)
|
---|
525 | resultValues.Add(Convert.ToDto(value));
|
---|
526 | foreach (DA.ResultIntValue value in source.ResultIntValues)
|
---|
527 | resultValues.Add(Convert.ToDto(value));
|
---|
528 | foreach (DA.ResultStringValue value in source.ResultStringValues)
|
---|
529 | resultValues.Add(Convert.ToDto(value));
|
---|
530 | target.ResultValues = resultValues.ToArray();
|
---|
531 |
|
---|
532 | return target;
|
---|
533 | }
|
---|
534 | public static DA.Run ToEntity(DT.Run source) {
|
---|
535 | if (source == null) return null;
|
---|
536 | DA.Run target = new DA.Run();
|
---|
537 | Convert.ToEntity(source, target);
|
---|
538 | return target;
|
---|
539 | }
|
---|
540 | public static void ToEntity(DT.Run source, DA.Run target) {
|
---|
541 | if ((source != null) && (target != null)) {
|
---|
542 | target.Id = source.Id; target.RandomSeed = source.RandomSeed; target.FinishedDate = source.FinishedDate; target.ExperimentId = source.ExperimentId; target.UserId = source.UserId; target.ClientId = source.ClientId;
|
---|
543 |
|
---|
544 | foreach (DT.ResultBlobValue value in source.ResultValues.OfType<DT.ResultBlobValue>())
|
---|
545 | target.ResultBlobValues.Add(Convert.ToEntity(value));
|
---|
546 | foreach (DT.ResultBoolValue value in source.ResultValues.OfType<DT.ResultBoolValue>())
|
---|
547 | target.ResultBoolValues.Add(Convert.ToEntity(value));
|
---|
548 | foreach (DT.ResultFloatValue value in source.ResultValues.OfType<DT.ResultFloatValue>())
|
---|
549 | target.ResultFloatValues.Add(Convert.ToEntity(value));
|
---|
550 | foreach (DT.ResultIntValue value in source.ResultValues.OfType<DT.ResultIntValue>())
|
---|
551 | target.ResultIntValues.Add(Convert.ToEntity(value));
|
---|
552 | foreach (DT.ResultStringValue value in source.ResultValues.OfType<DT.ResultStringValue>())
|
---|
553 | target.ResultStringValues.Add(Convert.ToEntity(value));
|
---|
554 | }
|
---|
555 | }
|
---|
556 | #endregion
|
---|
557 | }
|
---|
558 | }
|
---|