Skip to content

Commit

Permalink
Added metadata configuration method without the need to provide the e…
Browse files Browse the repository at this point in the history
…ntity type. (#27)
  • Loading branch information
mgernand authored Nov 1, 2024
1 parent b4a3f94 commit 1c26f9d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
10 changes: 9 additions & 1 deletion src/Fluxera.Queries/Options/EntitySetOptionsBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,21 @@ public IEntitySetOptionsBuilder<T> SetDefaultTop(int defaultTop)
}

/// <inheritdoc />
public IEntitySetOptionsBuilder<T> WithMetadata(string key, object value)
public IEntitySetOptionsBuilder WithMetadata(string key, object value)
{
this.options.Metadata[key] = value;

return this;
}

/// <inheritdoc />
public IEntitySetOptionsBuilder<T> WithMetadataTyped(string key, object value)
{
this.WithMetadata(key, value);

return this;
}

/// <inheritdoc />
public IEntitySetOptionsBuilder<T> AllowFilter(bool isEnabled = true)
{
Expand Down
19 changes: 17 additions & 2 deletions src/Fluxera.Queries/Options/IEntitySetOptionsBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,22 @@
/// Build the options for the entity set.
/// </summary>
[PublicAPI]
public interface IEntitySetOptionsBuilder<T>
public interface IEntitySetOptionsBuilder
{
/// <summary>
/// Adds a metadata entry for the entity set.
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
/// <returns></returns>
IEntitySetOptionsBuilder WithMetadata(string key, object value);
}

/// <summary>
/// Build the options for the entity set.
/// </summary>
[PublicAPI]
public interface IEntitySetOptionsBuilder<T> : IEntitySetOptionsBuilder
where T : class
{
/// <summary>
Expand Down Expand Up @@ -37,7 +52,7 @@ public interface IEntitySetOptionsBuilder<T>
/// <param name="key"></param>
/// <param name="value"></param>
/// <returns></returns>
IEntitySetOptionsBuilder<T> WithMetadata(string key, object value);
IEntitySetOptionsBuilder<T> WithMetadataTyped(string key, object value);

/// <summary>
/// Enables or disables the $filter query option.
Expand Down

0 comments on commit 1c26f9d

Please sign in to comment.