Skip to content

Commit

Permalink
Merge pull request #99 from RevealBi/binding-source-fix
Browse files Browse the repository at this point in the history
fixed the binding source to support ParameterBindingSource
  • Loading branch information
brianlagunas authored Nov 22, 2024
2 parents da39000 + 97d4a51 commit 6ab6e69
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Reveal.Sdk.Dom.Core.Serialization.Converters
{
internal class BindingSourceConverter : TypeMapConverter<BindingSource>
internal class BindingSourceConverter : TypeMapConverter<IBindingSource>
{
public BindingSourceConverter()
{
Expand Down
11 changes: 6 additions & 5 deletions src/Reveal.Sdk.Dom/Filters/Bindings/Binding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

namespace Reveal.Sdk.Dom.Filters
{
public abstract class Binding<TSource, TTarget> : Binding
where TSource : BindingSource, new()
public abstract class Binding<TTarget> : 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; }
}
Expand Down
8 changes: 0 additions & 8 deletions src/Reveal.Sdk.Dom/Filters/Bindings/BindingSource.cs

This file was deleted.

1 change: 1 addition & 0 deletions src/Reveal.Sdk.Dom/Filters/Bindings/BindingTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Reveal.Sdk.Dom.Filters
{
//does this need to be an interface?
public abstract class BindingTarget : SchemaType
{

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Reveal.Sdk.Dom.Filters
{
public sealed class DashboardDataFilterBinding : Binding<FieldBindingSource, DashboardDataFilterBindingTarget>
public sealed class DashboardDataFilterBinding : Binding<DashboardDataFilterBindingTarget>
{
internal DashboardDataFilterBinding() { }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Reveal.Sdk.Dom.Filters
{
public sealed class DashboardDateFilterBinding : Binding<FieldBindingSource, DashboardDateFilterBindingTarget>
public sealed class DashboardDateFilterBinding : Binding<DashboardDateFilterBindingTarget>
{
internal DashboardDateFilterBinding() : this(string.Empty) { }

Expand Down
5 changes: 3 additions & 2 deletions src/Reveal.Sdk.Dom/Filters/Bindings/FieldBindingSource.cs
Original file line number Diff line number Diff line change
@@ -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; }

Expand Down
12 changes: 10 additions & 2 deletions src/Reveal.Sdk.Dom/Filters/Bindings/ParameterBindingSource.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
10 changes: 10 additions & 0 deletions src/Reveal.Sdk.Dom/Filters/Interfaces/IBindingSource.cs
Original file line number Diff line number Diff line change
@@ -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
{
}
}

0 comments on commit 6ab6e69

Please sign in to comment.