adminsystem/UI/Components/Pages/TableDemo.razor.cs

27 lines
806 B
C#
Raw Normal View History

2024-05-30 10:49:02 +08:00
using BootstrapBlazor.Components;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using System.Collections.Concurrent;
using System.Diagnostics.CodeAnalysis;
using UI.Data;
namespace UI.Components.Pages {
/// <summary>
///
/// </summary>
public partial class TableDemo : ComponentBase {
[Inject]
[NotNull]
private IStringLocalizer<Foo>? Localizer { get; set; }
private readonly ConcurrentDictionary<Foo, IEnumerable<SelectedItem>> _cache = new();
private IEnumerable<SelectedItem> GetHobbys(Foo item) => _cache.GetOrAdd(item, f => Foo.GenerateHobbys(Localizer));
/// <summary>
///
/// </summary>
private static IEnumerable<int> PageItemsSource => new int[] { 20, 40 };
}
}