Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Services/Jobs/JsonTaskResolver.cs @ 13783

Last change on this file since 13783 was 13733, checked in by jlodewyc, 9 years ago

#2582 Last fixes Job Manager

File size: 1.7 KB
Line 
1using Newtonsoft.Json;
2using Newtonsoft.Json.Serialization;
3using System;
4using System.Collections.Generic;
5using System.IO;
6using System.Linq;
7using System.Reflection;
8using System.Threading.Tasks;
9
10namespace HeuristicLab.Clients.Hive.WebJobManager.Services
11{
12    /// <summary>
13    /// Throws some properties out to save on bandwidth space while refreshing
14    /// the selected job
15    /// </summary>
16    public class JsonTaskResolver : DefaultContractResolver
17    {
18        protected override JsonProperty CreateProperty(MemberInfo member,
19                                            MemberSerialization memberSerialization)
20        {
21            JsonProperty property = base.CreateProperty(member, memberSerialization);
22            if (property.PropertyName == "ItemImage" ||
23                property.PropertyName == "Parameters" ||
24                property.PropertyName == "OperatorGraph" ||
25                property.PropertyName == "DistanceMatrix" ||
26                property.PropertyName == "Operators" ||
27                property.PropertyName == "Engine" ||
28                property.PropertyName == "ActualValue" ||
29                property.PropertyName == "CurrentScope" ||
30                property.PropertyName == "Problems" ||
31                property.PropertyName == "Random" ||
32                property.PropertyName == "Optimizer" ||
33                property.PropertyName == "Optimizers" ||
34                property.PropertyName == "Problem" ||
35                property.PropertyName == "NestedOptimizers")
36            {
37                property.ShouldSerialize = instanceOfProblematic => false;
38            }
39
40            return property;
41        }
42    }
43
44}
Note: See TracBrowser for help on using the repository browser.