Skip to content

Conversation

@halilsafakkilic
Copy link

DynamicQueryAttributeGlobalConfig can be make possible change DynamicQueryAttribute constructor params.


namespace DynamicQueryBuilder
{
public static class DynamicQueryAttributeGlobalConfig
Copy link
Contributor

@cyilcode cyilcode Sep 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As much as i like the simple development aspect of this static context, this probably will come with its prices like thread safety and all. Instead, i would advise to use dependency injection through the ActionContext and get our settings from there. Here is an example of that.

Edit: Static objects also come with testing challenges since we dont run tests sequentially so if that would create concurrency issues as well.

public void ShouldNotSetCTorValuesWhenApplyGlobalFilter()
{
var defaultInstance = new DynamicQueryAttribute();
string queryExceedingMaxCount = DYNAMIC_QUERY_STRING.Replace("count=10", $"count={DynamicQueryAttributeGlobalConfig.MaxCountSize + 1}");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as i understand we are missing integration tests here. Can we please add those as well ?

@cyilcode cyilcode added the enhancement New feature or request label Sep 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants