aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.BL/ObservableEntity.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-12-31 14:15:49 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-12-31 14:15:49 +0200
commit650af0554b902837f8e146d690aca24e4f60ec29 (patch)
tree30f3795d9579129395fd987c3e790ce33181c0e5 /Software/Visual_Studio/Tango.BL/ObservableEntity.cs
parentcfe28eaf0adcd54776c0a369210e6f7b4bca9558 (diff)
downloadTango-650af0554b902837f8e146d690aca24e4f60ec29.tar.gz
Tango-650af0554b902837f8e146d690aca24e4f60ec29.zip
Removed Default configuration from machine version.
Implemented custom ToJson for observables. Implemented Apply & Create prototype machine for machine version.
Diffstat (limited to 'Software/Visual_Studio/Tango.BL/ObservableEntity.cs')
-rw-r--r--Software/Visual_Studio/Tango.BL/ObservableEntity.cs43
1 files changed, 43 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.BL/ObservableEntity.cs b/Software/Visual_Studio/Tango.BL/ObservableEntity.cs
index 52ecbbbc5..8ec0b30d6 100644
--- a/Software/Visual_Studio/Tango.BL/ObservableEntity.cs
+++ b/Software/Visual_Studio/Tango.BL/ObservableEntity.cs
@@ -23,6 +23,8 @@ using System.Xml.Serialization;
using Newtonsoft.Json;
using Tango.Logging;
using System.ComponentModel;
+using Tango.Core.Json;
+using Newtonsoft.Json.Converters;
namespace Tango.BL
{
@@ -376,6 +378,47 @@ Maybe you have deleted an entity that was no yet inserted into database?", LogCa
{
return GetDbContextFromEntity(this);
}
+
+ public virtual List<string> GetIgnoreProperties()
+ {
+ return new List<string>()
+ {
+ nameof(this.HasErrors),
+ nameof(this.Parameters),
+ nameof(this.DesignMode),
+ nameof(this.LogManager),
+ nameof(this.ObjectType),
+ nameof(this.TemporaryManager),
+ nameof(this.ValidateOnPropertyChanged),
+ nameof(this.ValidationErrors),
+ nameof(this.LastUpdated),
+ nameof(this.ID),
+ nameof(this.Guid),
+ "_entityWrapper",
+ };
+ }
+
+ public static T FromJson(String json)
+ {
+ var settings = new JsonSerializerSettings()
+ {
+ ContractResolver = new SerializationControllerContractResolver(),
+ };
+ settings.Converters.Add(new StringEnumConverter { CamelCaseText = false });
+ return JsonConvert.DeserializeObject<T>(json, settings);
+ }
+
+ public String ToJson()
+ {
+ var settings = new JsonSerializerSettings()
+ {
+ ContractResolver = new SerializationControllerContractResolver(),
+ };
+ settings.Converters.Add(new StringEnumConverter { CamelCaseText = false });
+ String json = JsonConvert.SerializeObject(this, Formatting.Indented, settings);
+ return json;
+ }
+
#endregion
#region Private Methods