From 97d4a51325c0ff6afc98e5085be3bd71a7ba36cc Mon Sep 17 00:00:00 2001 From: Brian Lagunas <835562+brianlagunas@users.noreply.github.com> Date: Fri, 22 Nov 2024 15:51:51 -0700 Subject: [PATCH] fixed the binding source to support ParameterBindingSource --- .../Converters/BindingSourceConverter.cs | 2 +- src/Reveal.Sdk.Dom/Filters/Bindings/Binding.cs | 11 ++++++----- src/Reveal.Sdk.Dom/Filters/Bindings/BindingSource.cs | 8 -------- src/Reveal.Sdk.Dom/Filters/Bindings/BindingTarget.cs | 1 + .../Filters/Bindings/DashboardDataFilterBinding.cs | 2 +- .../Filters/Bindings/DashboardDateFilterBinding.cs | 2 +- .../Filters/Bindings/FieldBindingSource.cs | 5 +++-- .../Filters/Bindings/ParameterBindingSource.cs | 12 ++++++++++-- .../Filters/Interfaces/IBindingSource.cs | 10 ++++++++++ 9 files changed, 33 insertions(+), 20 deletions(-) delete mode 100644 src/Reveal.Sdk.Dom/Filters/Bindings/BindingSource.cs create mode 100644 src/Reveal.Sdk.Dom/Filters/Interfaces/IBindingSource.cs diff --git a/src/Reveal.Sdk.Dom/Core/Serialization/Converters/BindingSourceConverter.cs b/src/Reveal.Sdk.Dom/Core/Serialization/Converters/BindingSourceConverter.cs index 6ef8d4e3..aad8dcf7 100644 --- a/src/Reveal.Sdk.Dom/Core/Serialization/Converters/BindingSourceConverter.cs +++ b/src/Reveal.Sdk.Dom/Core/Serialization/Converters/BindingSourceConverter.cs @@ -4,7 +4,7 @@ namespace Reveal.Sdk.Dom.Core.Serialization.Converters { - internal class BindingSourceConverter : TypeMapConverter + internal class BindingSourceConverter : TypeMapConverter { public BindingSourceConverter() { diff --git a/src/Reveal.Sdk.Dom/Filters/Bindings/Binding.cs b/src/Reveal.Sdk.Dom/Filters/Bindings/Binding.cs index 7739ec65..f7b1f746 100644 --- a/src/Reveal.Sdk.Dom/Filters/Bindings/Binding.cs +++ b/src/Reveal.Sdk.Dom/Filters/Bindings/Binding.cs @@ -4,13 +4,14 @@ namespace Reveal.Sdk.Dom.Filters { - public abstract class Binding : Binding - where TSource : BindingSource, new() + public abstract class Binding : Binding where TTarget : BindingTarget, new() - { - [JsonConverter(typeof(BindingSourceConverter))] - public TSource Source { get; set; } + { + public IBindingSource Source { get; set; } + //todo: how does this work? does this need to be an interface too? + //if so then the parent classes may not be needed at all + //the filter bidnings might need a redesign [JsonConverter(typeof(BindingTargetConverter))] public TTarget Target { get; set; } } diff --git a/src/Reveal.Sdk.Dom/Filters/Bindings/BindingSource.cs b/src/Reveal.Sdk.Dom/Filters/Bindings/BindingSource.cs deleted file mode 100644 index 19062af2..00000000 --- a/src/Reveal.Sdk.Dom/Filters/Bindings/BindingSource.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Reveal.Sdk.Dom.Core; - -namespace Reveal.Sdk.Dom.Filters -{ - public abstract class BindingSource : SchemaType - { - } -} diff --git a/src/Reveal.Sdk.Dom/Filters/Bindings/BindingTarget.cs b/src/Reveal.Sdk.Dom/Filters/Bindings/BindingTarget.cs index 84f273f9..fb06a274 100644 --- a/src/Reveal.Sdk.Dom/Filters/Bindings/BindingTarget.cs +++ b/src/Reveal.Sdk.Dom/Filters/Bindings/BindingTarget.cs @@ -2,6 +2,7 @@ namespace Reveal.Sdk.Dom.Filters { + //does this need to be an interface? public abstract class BindingTarget : SchemaType { diff --git a/src/Reveal.Sdk.Dom/Filters/Bindings/DashboardDataFilterBinding.cs b/src/Reveal.Sdk.Dom/Filters/Bindings/DashboardDataFilterBinding.cs index e65bf650..a8bf985d 100644 --- a/src/Reveal.Sdk.Dom/Filters/Bindings/DashboardDataFilterBinding.cs +++ b/src/Reveal.Sdk.Dom/Filters/Bindings/DashboardDataFilterBinding.cs @@ -1,6 +1,6 @@ namespace Reveal.Sdk.Dom.Filters { - public sealed class DashboardDataFilterBinding : Binding + public sealed class DashboardDataFilterBinding : Binding { internal DashboardDataFilterBinding() { } diff --git a/src/Reveal.Sdk.Dom/Filters/Bindings/DashboardDateFilterBinding.cs b/src/Reveal.Sdk.Dom/Filters/Bindings/DashboardDateFilterBinding.cs index d249989d..7bd9cc56 100644 --- a/src/Reveal.Sdk.Dom/Filters/Bindings/DashboardDateFilterBinding.cs +++ b/src/Reveal.Sdk.Dom/Filters/Bindings/DashboardDateFilterBinding.cs @@ -1,6 +1,6 @@ namespace Reveal.Sdk.Dom.Filters { - public sealed class DashboardDateFilterBinding : Binding + public sealed class DashboardDateFilterBinding : Binding { internal DashboardDateFilterBinding() : this(string.Empty) { } diff --git a/src/Reveal.Sdk.Dom/Filters/Bindings/FieldBindingSource.cs b/src/Reveal.Sdk.Dom/Filters/Bindings/FieldBindingSource.cs index a5b68e86..cea6918a 100644 --- a/src/Reveal.Sdk.Dom/Filters/Bindings/FieldBindingSource.cs +++ b/src/Reveal.Sdk.Dom/Filters/Bindings/FieldBindingSource.cs @@ -1,8 +1,9 @@ -using Reveal.Sdk.Dom.Core.Constants; +using Reveal.Sdk.Dom.Core; +using Reveal.Sdk.Dom.Core.Constants; namespace Reveal.Sdk.Dom.Filters { - public sealed class FieldBindingSource : BindingSource + public sealed class FieldBindingSource : SchemaType, IBindingSource { public string FieldName { get; set; } diff --git a/src/Reveal.Sdk.Dom/Filters/Bindings/ParameterBindingSource.cs b/src/Reveal.Sdk.Dom/Filters/Bindings/ParameterBindingSource.cs index 73901cf2..7acc9d7a 100644 --- a/src/Reveal.Sdk.Dom/Filters/Bindings/ParameterBindingSource.cs +++ b/src/Reveal.Sdk.Dom/Filters/Bindings/ParameterBindingSource.cs @@ -1,7 +1,15 @@ -namespace Reveal.Sdk.Dom.Filters +using Reveal.Sdk.Dom.Core; +using Reveal.Sdk.Dom.Core.Constants; + +namespace Reveal.Sdk.Dom.Filters { - public sealed class ParameterBindingSource : BindingSource + public sealed class ParameterBindingSource : SchemaType, IBindingSource { public string ParameterName { get; set; } + + public ParameterBindingSource() + { + SchemaTypeName = SchemaTypeNames.ParameterBindingSourceType; + } } } diff --git a/src/Reveal.Sdk.Dom/Filters/Interfaces/IBindingSource.cs b/src/Reveal.Sdk.Dom/Filters/Interfaces/IBindingSource.cs new file mode 100644 index 00000000..be560190 --- /dev/null +++ b/src/Reveal.Sdk.Dom/Filters/Interfaces/IBindingSource.cs @@ -0,0 +1,10 @@ +using Newtonsoft.Json; +using Reveal.Sdk.Dom.Core.Serialization.Converters; + +namespace Reveal.Sdk.Dom.Filters +{ + [JsonConverter(typeof(BindingSourceConverter))] + public interface IBindingSource + { + } +}