Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed the binding source to support ParameterBindingSource #99

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
{
}
}
Loading