diff --git a/Source/Blazorise/Licensing/BlazoriseLicenseChecker.cs b/Source/Blazorise/Licensing/BlazoriseLicenseChecker.cs
index 7259ccdf4a..0842228eba 100644
--- a/Source/Blazorise/Licensing/BlazoriseLicenseChecker.cs
+++ b/Source/Blazorise/Licensing/BlazoriseLicenseChecker.cs
@@ -87,7 +87,7 @@ internal string GetPrintMessage()
/// Null if no limit is set.
///
///
- public int? GetAutoCompleteRowsLimit()
+ public int? GetAutocompleteRowsLimit()
{
return blazoriseLicenseProvider.GetAutocompleteRowsLimit();
}
diff --git a/Source/Blazorise/Licensing/BlazoriseLicenseLimitsHelper.cs b/Source/Blazorise/Licensing/BlazoriseLicenseLimitsHelper.cs
new file mode 100644
index 0000000000..f7826f9cae
--- /dev/null
+++ b/Source/Blazorise/Licensing/BlazoriseLicenseLimitsHelper.cs
@@ -0,0 +1,57 @@
+namespace Blazorise.Licensing;
+
+///
+/// Ultimately provides sane defaults for Blazorise licensing, in case required scoped services are not provided
+///
+public static class BlazoriseLicenseLimitsHelper
+{
+ ///
+ /// Returns the maximum number of rows that can be displayed.
+ /// Null if no limit is set.
+ ///
+ ///
+ public static int? GetDataGridRowsLimit( BlazoriseLicenseChecker blazoriseLicenseChecker )
+ {
+ return blazoriseLicenseChecker is null ? BlazoriseLicenseProvider.DEFAULT_UNLICENSED_LIMIT_DATAGRID_MAX_ROWS : blazoriseLicenseChecker.GetDataGridRowsLimit();
+ }
+
+ ///
+ /// Returns the maximum number of rows that can be displayed.
+ /// Null if no limit is set.
+ ///
+ ///
+ public static int? GetAutocompleteRowsLimit( BlazoriseLicenseChecker blazoriseLicenseChecker )
+ {
+ return blazoriseLicenseChecker is null ? BlazoriseLicenseProvider.DEFAULT_UNLICENSED_LIMIT_AUTOCOMPLETE_MAX_ROWS : blazoriseLicenseChecker.GetAutocompleteRowsLimit();
+ }
+
+ ///
+ /// Returns the maximum number of rows that can be displayed.
+ /// Null if no limit is set.
+ ///
+ ///
+ public static int? GetChartsRowsLimit( BlazoriseLicenseChecker blazoriseLicenseChecker )
+ {
+ return blazoriseLicenseChecker is null ? BlazoriseLicenseProvider.DEFAULT_UNLICENSED_LIMIT_CHARTS_MAX_ROWS : blazoriseLicenseChecker.GetChartsRowsLimit();
+ }
+
+ ///
+ /// Returns the maximum number of rows that can be displayed.
+ /// Null if no limit is set.
+ ///
+ ///
+ public static int? GetListViewRowsLimit( BlazoriseLicenseChecker blazoriseLicenseChecker )
+ {
+ return blazoriseLicenseChecker is null ? BlazoriseLicenseProvider.DEFAULT_UNLICENSED_LIMIT_LISTVIEW_MAX_ROWS : blazoriseLicenseChecker.GetListViewRowsLimit();
+ }
+
+ ///
+ /// Returns the maximum number of rows that can be displayed.
+ /// Null if no limit is set.
+ ///
+ ///
+ public static int? GetTreeViewRowsLimit( BlazoriseLicenseChecker blazoriseLicenseChecker )
+ {
+ return blazoriseLicenseChecker is null ? BlazoriseLicenseProvider.DEFAULT_UNLICENSED_LIMIT_TREEVIEW_MAX_ROWS : blazoriseLicenseChecker.GetTreeViewRowsLimit();
+ }
+}
diff --git a/Source/Blazorise/Licensing/BlazoriseLicenseProvider.cs b/Source/Blazorise/Licensing/BlazoriseLicenseProvider.cs
index eb20c6d427..a26faae3ce 100644
--- a/Source/Blazorise/Licensing/BlazoriseLicenseProvider.cs
+++ b/Source/Blazorise/Licensing/BlazoriseLicenseProvider.cs
@@ -14,6 +14,11 @@ namespace Blazorise.Licensing;
public sealed class BlazoriseLicenseProvider
{
#region Members
+ internal const int DEFAULT_UNLICENSED_LIMIT_DATAGRID_MAX_ROWS = 1000;
+ internal const int DEFAULT_UNLICENSED_LIMIT_AUTOCOMPLETE_MAX_ROWS = 1000;
+ internal const int DEFAULT_UNLICENSED_LIMIT_CHARTS_MAX_ROWS = 10;
+ internal const int DEFAULT_UNLICENSED_LIMIT_LISTVIEW_MAX_ROWS = 1000;
+ internal const int DEFAULT_UNLICENSED_LIMIT_TREEVIEW_MAX_ROWS = 100;
private static readonly Assembly CurrentAssembly = typeof( BlazoriseLicenseProvider ).Assembly;
@@ -205,7 +210,7 @@ private static BlazoriseLicenseResult ResolveBlazoriseLicenseResult( License lic
}
else if ( Result == BlazoriseLicenseResult.Unlicensed )
{
- limitsDataGridMaxRows = 1000;
+ limitsDataGridMaxRows = DEFAULT_UNLICENSED_LIMIT_DATAGRID_MAX_ROWS;
}
return limitsDataGridMaxRows;
@@ -233,7 +238,7 @@ private static BlazoriseLicenseResult ResolveBlazoriseLicenseResult( License lic
}
else if ( Result == BlazoriseLicenseResult.Unlicensed )
{
- limitsAutocompleteMaxRows = 1000;
+ limitsAutocompleteMaxRows = DEFAULT_UNLICENSED_LIMIT_AUTOCOMPLETE_MAX_ROWS;
}
return limitsAutocompleteMaxRows;
@@ -261,7 +266,7 @@ private static BlazoriseLicenseResult ResolveBlazoriseLicenseResult( License lic
}
else if ( Result == BlazoriseLicenseResult.Unlicensed )
{
- limitsChartsMaxRows = 10;
+ limitsChartsMaxRows = DEFAULT_UNLICENSED_LIMIT_CHARTS_MAX_ROWS;
}
return limitsChartsMaxRows;
@@ -289,7 +294,7 @@ private static BlazoriseLicenseResult ResolveBlazoriseLicenseResult( License lic
}
else if ( Result == BlazoriseLicenseResult.Unlicensed )
{
- limitsListViewMaxRows = 1000;
+ limitsListViewMaxRows = DEFAULT_UNLICENSED_LIMIT_LISTVIEW_MAX_ROWS;
}
return limitsListViewMaxRows;
@@ -317,7 +322,7 @@ private static BlazoriseLicenseResult ResolveBlazoriseLicenseResult( License lic
}
else if ( Result == BlazoriseLicenseResult.Unlicensed )
{
- limitsTreeViewMaxRows = 100;
+ limitsTreeViewMaxRows = DEFAULT_UNLICENSED_LIMIT_TREEVIEW_MAX_ROWS;
}
return limitsTreeViewMaxRows;
diff --git a/Source/Extensions/Blazorise.Charts/BaseChart.cs b/Source/Extensions/Blazorise.Charts/BaseChart.cs
index d6369c37f3..d757c14830 100644
--- a/Source/Extensions/Blazorise.Charts/BaseChart.cs
+++ b/Source/Extensions/Blazorise.Charts/BaseChart.cs
@@ -79,7 +79,7 @@ private void LimitDataSets( params TDataSet[] datasets )
if ( datasets.IsNullOrEmpty() )
return;
- var chartsRowLimit = LicenseChecker.GetChartsRowsLimit();
+ var chartsRowLimit = BlazoriseLicenseLimitsHelper.GetChartsRowsLimit( LicenseChecker );
if ( !chartsRowLimit.HasValue )
return;
@@ -92,7 +92,7 @@ private void LimitDataSets( params TDataSet[] datasets )
private List LimitData( List data )
{
- var chartsRowLimit = LicenseChecker.GetChartsRowsLimit();
+ var chartsRowLimit = BlazoriseLicenseLimitsHelper.GetChartsRowsLimit( LicenseChecker );
if ( !chartsRowLimit.HasValue )
return data;
diff --git a/Source/Extensions/Blazorise.Components/Autocomplete.razor.cs b/Source/Extensions/Blazorise.Components/Autocomplete.razor.cs
index 4d2e9d0672..af8fb0be2d 100644
--- a/Source/Extensions/Blazorise.Components/Autocomplete.razor.cs
+++ b/Source/Extensions/Blazorise.Components/Autocomplete.razor.cs
@@ -862,7 +862,7 @@ where text.StartsWith( Search, StringComparison.OrdinalIgnoreCase )
}
}
- var maxRowsLimit = LicenseChecker.GetAutoCompleteRowsLimit();
+ var maxRowsLimit = BlazoriseLicenseLimitsHelper.GetAutocompleteRowsLimit( LicenseChecker );
if ( maxRowsLimit.HasValue )
{
diff --git a/Source/Extensions/Blazorise.Components/ListView.razor.cs b/Source/Extensions/Blazorise.Components/ListView.razor.cs
index c3f54ea66d..f96c004e3f 100644
--- a/Source/Extensions/Blazorise.Components/ListView.razor.cs
+++ b/Source/Extensions/Blazorise.Components/ListView.razor.cs
@@ -21,7 +21,7 @@ public partial class ListView : ComponentBase
private IEnumerable GetData()
{
- var maxRowsLimit = LicenseChecker.GetListViewRowsLimit();
+ var maxRowsLimit = BlazoriseLicenseLimitsHelper.GetListViewRowsLimit( LicenseChecker );
if ( maxRowsLimit.HasValue )
{
diff --git a/Source/Extensions/Blazorise.DataGrid/DataGrid.razor.cs b/Source/Extensions/Blazorise.DataGrid/DataGrid.razor.cs
index a0e0e9190a..be4e30b369 100644
--- a/Source/Extensions/Blazorise.DataGrid/DataGrid.razor.cs
+++ b/Source/Extensions/Blazorise.DataGrid/DataGrid.razor.cs
@@ -2357,7 +2357,7 @@ where CompareFilterValues( cellStringValue, stringSearchValue, column.GetFilterM
}
}
- var maxRowsLimit = LicenseChecker.GetDataGridRowsLimit();
+ var maxRowsLimit = BlazoriseLicenseLimitsHelper.GetDataGridRowsLimit( LicenseChecker );
if ( maxRowsLimit.HasValue )
{
diff --git a/Source/Extensions/Blazorise.TreeView/TreeView.razor.cs b/Source/Extensions/Blazorise.TreeView/TreeView.razor.cs
index 5e10e4cc13..0cb7b643e8 100644
--- a/Source/Extensions/Blazorise.TreeView/TreeView.razor.cs
+++ b/Source/Extensions/Blazorise.TreeView/TreeView.razor.cs
@@ -10,7 +10,6 @@
using Blazorise.TreeView.Internal;
using Blazorise.Utilities;
using Microsoft.AspNetCore.Components;
-using Microsoft.AspNetCore.Components.Web;
#endregion
namespace Blazorise.TreeView;
@@ -131,8 +130,6 @@ private void SearchTryRemoveNode( List> nodeStates, TNo
/// Returns the awaitable task.
public async Task Reload()
{
- var maxRowsLimit = LicenseChecker.GetTreeViewRowsLimit();
-
treeViewNodeStates = new();
await foreach ( var nodeState in Nodes.ToNodeStates( HasChildNodesAsync, DetermineHasChildNodes, ( node ) => ExpandedNodes?.Contains( node ) == true, DetermineIsDisabled ) )
@@ -145,7 +142,7 @@ public async Task Reload()
private void AddTreeViewNodeState( TreeViewNodeState treeViewNodeState )
{
- var maxRowsLimit = LicenseChecker.GetTreeViewRowsLimit();
+ var maxRowsLimit = BlazoriseLicenseLimitsHelper.GetTreeViewRowsLimit( LicenseChecker );
if ( maxRowsLimit.HasValue )
{