Compare commits
8 Commits
master
...
TIAM_v0.0.6.0
| Author | SHA1 | Date |
|---|---|---|
|
|
3b899cb8ad | |
|
|
9d0ee493ac | |
|
|
7db379cd81 | |
|
|
35c4d938e3 | |
|
|
942bac61fd | |
|
|
dca43794c8 | |
|
|
5f661991f9 | |
|
|
6fb3d0d848 |
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
@ -12,41 +12,49 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DevExpress.Blazor" Version="24.1.3" />
|
<PackageReference Include="DevExpress.Data" Version="24.2.3" />
|
||||||
<PackageReference Include="DevExpress.Blazor.Dashboard" Version="24.1.3" />
|
<PackageReference Include="DevExpress.Blazor" Version="24.2.3" />
|
||||||
<PackageReference Include="MessagePack" Version="2.5.187" />
|
<PackageReference Include="MessagePack" Version="3.1.4" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.8" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.8" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="8.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="9.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.SignalR.Core" Version="1.2.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.8" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="9.0.8" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="AyCode.Core">
|
<Reference Include="AyCode.Core">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Core.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Entities">
|
<Reference Include="AyCode.Entities">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Entities.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Entities.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Interfaces">
|
<Reference Include="AyCode.Interfaces">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Interfaces.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Interfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Models">
|
<Reference Include="AyCode.Models">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Models.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Models.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Services">
|
<Reference Include="AyCode.Services">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Services.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Services.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="AyCode.Services.Server">
|
||||||
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Services.Server.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Utils">
|
<Reference Include="AyCode.Utils">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Utils.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Utils.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Layouts\" />
|
<Folder Include="Layouts\" />
|
||||||
<Folder Include="Pages\" />
|
<Folder Include="Pages\" />
|
||||||
|
<Folder Include="Services\Logins\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\AyCode.Blazor.Models.Server\AyCode.Blazor.Models.Server.csproj" />
|
||||||
<ProjectReference Include="..\AyCode.Blazor.Models\AyCode.Blazor.Models.csproj" />
|
<ProjectReference Include="..\AyCode.Blazor.Models\AyCode.Blazor.Models.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
@ -22,22 +22,22 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="AyCode.Core">
|
<Reference Include="AyCode.Core">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Core.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Entities">
|
<Reference Include="AyCode.Entities">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Entities.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Entities.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Interfaces">
|
<Reference Include="AyCode.Interfaces">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Interfaces.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Interfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Models">
|
<Reference Include="AyCode.Models">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Models.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Models.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Services">
|
<Reference Include="AyCode.Services">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Services.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Services.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Utils">
|
<Reference Include="AyCode.Utils">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Utils.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Utils.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,367 @@
|
||||||
|
using System.ComponentModel;
|
||||||
|
using AyCode.Core;
|
||||||
|
using AyCode.Core.Enums;
|
||||||
|
using AyCode.Core.Extensions;
|
||||||
|
using AyCode.Core.Helpers;
|
||||||
|
using AyCode.Core.Interfaces;
|
||||||
|
using AyCode.Core.Loggers;
|
||||||
|
using AyCode.Services.Server.SignalRs;
|
||||||
|
using AyCode.Services.SignalRs;
|
||||||
|
using AyCode.Utils.Extensions;
|
||||||
|
using DevExpress.Blazor;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
namespace AyCode.Blazor.Components.Components.Grids;
|
||||||
|
|
||||||
|
public interface IMgGridBase : IGrid
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class MgGridBase<TSignalRDataSource, TDataItem, TLoggerClient> : DxGrid, IMgGridBase
|
||||||
|
where TSignalRDataSource : AcSignalRDataSource<TDataItem> where TDataItem : class, IId<Guid> where TLoggerClient : AcLoggerBase
|
||||||
|
{
|
||||||
|
protected bool IsFirstInitializeParameters;
|
||||||
|
private TSignalRDataSource _dataSource = null!;
|
||||||
|
private IList<TDataItem> _dataSourceParam = [];
|
||||||
|
private string _gridLogName;
|
||||||
|
|
||||||
|
public MgGridBase() : base()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[Parameter] public TLoggerClient Logger { get; set; }
|
||||||
|
[Parameter] public string GridName { get; set; }
|
||||||
|
[Parameter] public object[]? ContextIds { get; set; }
|
||||||
|
|
||||||
|
private string? _filterText = null;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string? FilterText
|
||||||
|
{
|
||||||
|
get => _filterText;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_filterText = value;
|
||||||
|
|
||||||
|
if (_dataSource != null! && _dataSource.FilterText != value)
|
||||||
|
{
|
||||||
|
_dataSource.FilterText = value;
|
||||||
|
ReloadDataSourceAsync().Forget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Parameter] public AcSignalRClientBase SignalRClient { get; set; }
|
||||||
|
|
||||||
|
[Parameter] public int GetAllMessageTag { get; set; }
|
||||||
|
[Parameter] public int GetItemMessageTag { get; set; }
|
||||||
|
[Parameter] public int AddMessageTag { get; set; }
|
||||||
|
[Parameter] public int UpdateMessageTag { get; set; }
|
||||||
|
[Parameter] public int RemoveMessageTag { get; set; }
|
||||||
|
|
||||||
|
protected new EventCallback<GridDataItemDeletingEventArgs> DataItemDeleting { get; set; }
|
||||||
|
[Parameter] public EventCallback<GridDataItemDeletingEventArgs> OnGridItemDeleting { get; set; }
|
||||||
|
|
||||||
|
protected new EventCallback<GridEditModelSavingEventArgs> EditModelSaving { get; set; }
|
||||||
|
[Parameter] public EventCallback<GridEditModelSavingEventArgs> OnGridEditModelSaving { get; set; }
|
||||||
|
|
||||||
|
[Parameter] public EventCallback<IList<TDataItem>> OnDataSourceChanged { get; set; }
|
||||||
|
[Parameter] public EventCallback<GridDataItemChangingEventArgs<TDataItem>> OnGridItemChanging { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// After the server has responded!
|
||||||
|
/// </summary>
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback<GridDataItemChangedEventArgs<TDataItem>> OnGridItemChanged { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
[DefaultValue(null)]
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "BL0007:Component parameters should be auto properties", Justification = "<Pending>")]
|
||||||
|
public IList<TDataItem> DataSource
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_dataSource == null && Data != null)
|
||||||
|
{
|
||||||
|
Logger.Error($"{_gridLogName} Use the DataSource parameter instead of Data!");
|
||||||
|
throw new NullReferenceException($"{_gridLogName} Use the DataSource parameter instead of Data!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return _dataSource!;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_dataSourceParam = value;
|
||||||
|
|
||||||
|
if (_dataSource != null! && _dataSourceParam is List<TDataItem> workingReferenceList)
|
||||||
|
_dataSource.SetWorkingReferenceList(workingReferenceList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
if (Logger == null)
|
||||||
|
throw new NullReferenceException($"[{GetType().Name}] Logger == null");
|
||||||
|
|
||||||
|
if (SignalRClient == null)
|
||||||
|
{
|
||||||
|
Logger.Error($"[{GetType().Name}] SignalRClient == null");
|
||||||
|
throw new NullReferenceException($"[{GetType().Name}] SignalRClient == null");
|
||||||
|
}
|
||||||
|
|
||||||
|
var crudTags = new SignalRCrudTags(GetAllMessageTag, GetItemMessageTag, AddMessageTag, UpdateMessageTag, RemoveMessageTag);
|
||||||
|
|
||||||
|
_dataSource =(TSignalRDataSource)Activator.CreateInstance(typeof(TSignalRDataSource), SignalRClient, crudTags, ContextIds)!;
|
||||||
|
_dataSource.FilterText = FilterText;
|
||||||
|
//_dataSource = new SignalRDataSource<TDataItem>(SignalRClient, crudTags, ContextIds) { FilterText = FilterText };
|
||||||
|
|
||||||
|
Data = _dataSource;
|
||||||
|
|
||||||
|
_dataSource.OnDataSourceLoaded += OnDataSourceLoaded;
|
||||||
|
_dataSource.OnDataSourceItemChanged += OnDataSourceItemChanged;
|
||||||
|
|
||||||
|
await base.OnInitializedAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnDataSourceItemChanged(ItemChangedEventArgs<TDataItem> args)
|
||||||
|
{
|
||||||
|
if (args.TrackingState is TrackingState.GetAll or TrackingState.None) return;
|
||||||
|
|
||||||
|
Logger.Debug($"{_gridLogName} OnDataSourceItemChanged; trackingState: {args.TrackingState}");
|
||||||
|
|
||||||
|
var changedEventArgs = new GridDataItemChangedEventArgs<TDataItem>(this, args.Item, args.TrackingState);
|
||||||
|
await OnGridItemChanged.InvokeAsync(changedEventArgs);
|
||||||
|
|
||||||
|
if (!changedEventArgs.CancelStateChangeInvoke)
|
||||||
|
{
|
||||||
|
//BeginUpdate();
|
||||||
|
await InvokeAsync(StateHasChanged); //TODO: bezárja a DetailRow-t! pl: az email-nél IsReaded=true update... - J.
|
||||||
|
//EndUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Task OnDataSourceLoaded()
|
||||||
|
{
|
||||||
|
Logger.Debug($"{_gridLogName} OnDataSourceLoaded; Count: {_dataSource.Count}");
|
||||||
|
|
||||||
|
Reload();
|
||||||
|
//_dataSource.LoadItem(_dataSource.First().Id).Forget();
|
||||||
|
return OnDataSourceChanged.InvokeAsync(_dataSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
|
{
|
||||||
|
if (firstRender)
|
||||||
|
{
|
||||||
|
if (_dataSourceParam != null!) await _dataSource.LoadDataSource(_dataSourceParam, true, true);
|
||||||
|
else _dataSource.LoadDataSourceAsync(true).Forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
await base.OnAfterRenderAsync(firstRender);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task AddDataItem(TDataItem dataItem)
|
||||||
|
{
|
||||||
|
if (dataItem.Id.IsNullOrEmpty()) dataItem.Id = Guid.NewGuid();
|
||||||
|
return _dataSource.Add(dataItem, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task AddDataItemAsync(TDataItem dataItem)
|
||||||
|
{
|
||||||
|
if (dataItem.Id.IsNullOrEmpty()) dataItem.Id = Guid.NewGuid();
|
||||||
|
_dataSource.Add(dataItem);
|
||||||
|
|
||||||
|
return SaveChangesToServerAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnItemSaving(GridEditModelSavingEventArgs e)
|
||||||
|
{
|
||||||
|
var dataItem = (e.EditModel as TDataItem)!;
|
||||||
|
|
||||||
|
if (e.IsNew && dataItem.Id.IsNullOrEmpty()) dataItem.Id = Guid.NewGuid();
|
||||||
|
|
||||||
|
var logText = e.IsNew ? "add" : "update";
|
||||||
|
Logger.Debug($"{_gridLogName} OnItemSaving {logText}; Id: {dataItem.Id}");
|
||||||
|
|
||||||
|
await OnGridEditModelSaving.InvokeAsync(e);
|
||||||
|
|
||||||
|
if (e.Cancel)
|
||||||
|
{
|
||||||
|
Logger.Debug($"{_gridLogName} OnItemSaving {logText} canceled; Id: {dataItem.Id}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.IsNew) await AddDataItemAsync(dataItem);
|
||||||
|
else await UpdateDataItemAsync(dataItem);
|
||||||
|
|
||||||
|
_dataSource.UpdateCollection(dataItem, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Task SaveChangesToServerAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _dataSource.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.Error($"{_gridLogName} SaveChangesToServerAsync->SaveChangesAsync error!", ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<bool> SaveChangesToServer()
|
||||||
|
{
|
||||||
|
var result = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var unsavedItems = await _dataSource.SaveChanges();
|
||||||
|
|
||||||
|
if ((result = unsavedItems.Count == 0) == false)
|
||||||
|
Logger.Error($"{_gridLogName} SaveChangesToServer->SaveChanges error! unsavedCount: {unsavedItems.Count}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.Error($"{_gridLogName} OnItemSaving", ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnItemDeleting(GridDataItemDeletingEventArgs e)
|
||||||
|
{
|
||||||
|
Logger.Debug($"{_gridLogName} OnItemDeleting");
|
||||||
|
|
||||||
|
await OnGridItemDeleting.InvokeAsync(e);
|
||||||
|
|
||||||
|
if (e.Cancel)
|
||||||
|
{
|
||||||
|
Logger.Debug($"{_gridLogName} OnItemDeleting canceled");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dataItem = (e.DataItem as TDataItem)!;
|
||||||
|
await RemoveDataItem(dataItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCustomizeElement(GridCustomizeElementEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.ElementType == GridElementType.DetailCell)
|
||||||
|
{
|
||||||
|
e.Style = "padding: 0.5rem; opacity: 0.75";
|
||||||
|
}
|
||||||
|
else if (false && e.ElementType == GridElementType.DataCell && e.Column.Name == nameof(IId<Guid>.Id))
|
||||||
|
{
|
||||||
|
e.Column.Visible = AcDomain.IsDeveloperVersion;
|
||||||
|
e.Column.ShowInColumnChooser = AcDomain.IsDeveloperVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Task SetParametersAsyncCore(ParameterView parameters)
|
||||||
|
{
|
||||||
|
if (!IsFirstInitializeParameters)
|
||||||
|
{
|
||||||
|
//if (typeof(TDataItem) is IId<Guid> || typeof(TDataItem) is IId<int>)
|
||||||
|
KeyFieldName = "Id";
|
||||||
|
|
||||||
|
base.DataItemDeleting = EventCallback.Factory.Create<GridDataItemDeletingEventArgs>(this, OnItemDeleting);
|
||||||
|
base.EditModelSaving = EventCallback.Factory.Create<GridEditModelSavingEventArgs>(this, OnItemSaving);
|
||||||
|
|
||||||
|
CustomizeElement += OnCustomizeElement;
|
||||||
|
|
||||||
|
//ShowFilterRow = true;
|
||||||
|
//PageSize = 4;
|
||||||
|
//ShowGroupPanel = true;
|
||||||
|
//AllowSort = false;
|
||||||
|
|
||||||
|
TextWrapEnabled = false;
|
||||||
|
AllowSelectRowByClick = true;
|
||||||
|
HighlightRowOnHover = true;
|
||||||
|
AutoCollapseDetailRow = true;
|
||||||
|
AutoExpandAllGroupRows = false;
|
||||||
|
//KeyboardNavigationEnabled = true;
|
||||||
|
|
||||||
|
//var dataColumns = GetDataColumns();
|
||||||
|
|
||||||
|
//var idColumn = dataColumns.FirstOrDefault(x => x.FieldName == nameof(IId<Guid>.Id));
|
||||||
|
//if (idColumn != null)
|
||||||
|
//{
|
||||||
|
// idColumn.ShowInColumnChooser = AcDomain.IsDeveloperVersion;
|
||||||
|
// idColumn.Visible = !AcDomain.IsDeveloperVersion;
|
||||||
|
//}
|
||||||
|
|
||||||
|
IsFirstInitializeParameters = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.SetParametersAsyncCore(parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void OnParametersSet()
|
||||||
|
{
|
||||||
|
base.OnParametersSet();
|
||||||
|
|
||||||
|
if (GridName.IsNullOrWhiteSpace()) GridName = $"{typeof(TDataItem).Name}Grid";
|
||||||
|
|
||||||
|
_gridLogName = $"[{GridName}]";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//public Task AddDataItem(TDataItem dataItem, int messageTag) => PostDataToServerAsync(dataItem, messageTag, TrackingState.Add);
|
||||||
|
|
||||||
|
public Task UpdateDataItem(TDataItem dataItem) => _dataSource.Update(dataItem, true);
|
||||||
|
|
||||||
|
public Task UpdateDataItemAsync(TDataItem dataItem)
|
||||||
|
{
|
||||||
|
_dataSource.Update(dataItem, false);
|
||||||
|
return SaveChangesToServerAsync();
|
||||||
|
}
|
||||||
|
//public Task UpdateDataItem(TDataItem dataItem, int messageTag) => PostDataToServerAsync(dataItem, messageTag, TrackingState.Update);
|
||||||
|
|
||||||
|
public Task AddOrUpdateDataItem(TDataItem dataItem) => _dataSource.AddOrUpdate(dataItem, true);
|
||||||
|
|
||||||
|
public Task RemoveDataItem(TDataItem dataItem) => _dataSource.Remove(dataItem, true);
|
||||||
|
//public Task RemoveDataItem(TDataItem dataItem, int messageTag) => PostDataToServerAsync(dataItem, messageTag, TrackingState.Remove);
|
||||||
|
|
||||||
|
public Task RemoveDataItem(Guid id) => RemoveDataItem(id, RemoveMessageTag);
|
||||||
|
|
||||||
|
public Task RemoveDataItem(Guid id, int messageTag)
|
||||||
|
{
|
||||||
|
var dataItem = _dataSource.FirstOrDefault(x => x.Id == id);
|
||||||
|
if (dataItem == null) return Task.CompletedTask;
|
||||||
|
|
||||||
|
return _dataSource.Remove(dataItem, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task ReloadDataSourceAsync()
|
||||||
|
{
|
||||||
|
return _dataSource.LoadDataSourceAsync(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GridDataItemChangingEventArgs<TDataItem> : GridDataItemChangedEventArgs<TDataItem> where TDataItem : class, IId<Guid>
|
||||||
|
{
|
||||||
|
internal GridDataItemChangingEventArgs(IMgGridBase grid, TDataItem dataItem, TrackingState trackingState) : base(grid, dataItem, trackingState)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsCanceled { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GridDataItemChangedEventArgs<TDataItem> where TDataItem : class, IId<Guid>
|
||||||
|
{
|
||||||
|
internal GridDataItemChangedEventArgs(IMgGridBase grid, TDataItem dataItem, TrackingState trackingState)
|
||||||
|
{
|
||||||
|
Grid = grid ?? throw new ArgumentNullException(nameof(grid));
|
||||||
|
DataItem = dataItem;
|
||||||
|
TrackingState = trackingState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMgGridBase Grid { get; }
|
||||||
|
public TDataItem DataItem { get; }
|
||||||
|
public TrackingState TrackingState { get; }
|
||||||
|
public bool CancelStateChangeInvoke { get; set; }
|
||||||
|
}
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using AyCode.Services.Logins;
|
|
||||||
|
|
||||||
namespace AyCode.Blazor.Components.Services;
|
|
||||||
|
|
||||||
public class AcSessionService<TSessionItem, TSessionItemId> where TSessionItem : IAcSessionItem<TSessionItemId> where TSessionItemId : notnull
|
|
||||||
{
|
|
||||||
public ConcurrentDictionary<TSessionItemId, TSessionItem> Sessions { get; private set; } = [];
|
|
||||||
|
|
||||||
public AcSessionService()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,284 +0,0 @@
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using AyCode.Core;
|
|
||||||
using AyCode.Core.Extensions;
|
|
||||||
using AyCode.Core.Helpers;
|
|
||||||
using AyCode.Core.Loggers;
|
|
||||||
using AyCode.Interfaces.Entities;
|
|
||||||
using AyCode.Services.Loggers;
|
|
||||||
using AyCode.Services.SignalRs;
|
|
||||||
using MessagePack.Resolvers;
|
|
||||||
using Microsoft.AspNetCore.SignalR.Client;
|
|
||||||
|
|
||||||
namespace AyCode.Blazor.Components.Services
|
|
||||||
{
|
|
||||||
public abstract class AcSignalRClientBase : IAcSignalRHubClient
|
|
||||||
{
|
|
||||||
private readonly ConcurrentDictionary<int, SignalRRequestModel> _responseByRequestId = new();
|
|
||||||
|
|
||||||
protected readonly HubConnection HubConnection;
|
|
||||||
protected readonly AcLoggerBase Logger;
|
|
||||||
|
|
||||||
public event Action<int, byte[], int?> OnMessageReceived = null!;
|
|
||||||
//public event Action<int, int> OnMessageRequested;
|
|
||||||
|
|
||||||
public int Timeout = 10000;
|
|
||||||
private const string TagsName = "SignalRTags";
|
|
||||||
|
|
||||||
protected AcSignalRClientBase(string fullHubName, AcLoggerBase logger)
|
|
||||||
{
|
|
||||||
Logger = logger;
|
|
||||||
|
|
||||||
HubConnection = new HubConnectionBuilder()
|
|
||||||
.WithUrl(fullHubName)
|
|
||||||
//.AddMessagePackProtocol(options => {
|
|
||||||
// options.SerializerOptions = MessagePackSerializerOptions.Standard
|
|
||||||
// .WithResolver(MessagePack.Resolvers.StandardResolver.Instance)
|
|
||||||
// .WithSecurity(MessagePackSecurity.UntrustedData)
|
|
||||||
// .WithCompression(MessagePackCompression.Lz4Block)
|
|
||||||
// .WithCompressionMinLength(256);})
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
HubConnection.Closed += HubConnection_Closed;
|
|
||||||
|
|
||||||
_ = HubConnection.On<int, byte[], int?>(nameof(IAcSignalRHubClient.OnReceiveMessage), OnReceiveMessage);
|
|
||||||
//_ = HubConnection.On<int, int>(nameof(IAcSignalRHubClient.OnRequestMessage), OnRequestMessage);
|
|
||||||
|
|
||||||
HubConnection.StartAsync().Forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Task HubConnection_Closed(Exception? arg)
|
|
||||||
{
|
|
||||||
if (_responseByRequestId.IsEmpty) Logger.DebugConditional($"Client HubConnection_Closed");
|
|
||||||
else Logger.Warning($"Client HubConnection_Closed; {nameof(_responseByRequestId)} count: {_responseByRequestId.Count}");
|
|
||||||
|
|
||||||
_responseByRequestId.Clear();
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task StartConnection()
|
|
||||||
{
|
|
||||||
if (HubConnection.State == HubConnectionState.Disconnected)
|
|
||||||
await HubConnection.StartAsync();
|
|
||||||
|
|
||||||
if (HubConnection.State != HubConnectionState.Connected)
|
|
||||||
await TaskHelper.WaitToAsync(() => HubConnection.State == HubConnectionState.Connected, Timeout, 10, 25);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task StopConnection()
|
|
||||||
{
|
|
||||||
await HubConnection.StopAsync();
|
|
||||||
await HubConnection.DisposeAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual Task SendMessageToServerAsync(int messageTag)
|
|
||||||
=> SendMessageToServerAsync(messageTag, null, AcDomain.NextUniqueInt32);
|
|
||||||
|
|
||||||
public virtual Task SendMessageToServerAsync(int messageTag, ISignalRMessage? message, int? requestId)
|
|
||||||
{
|
|
||||||
Logger.DebugConditional($"Client SendMessageToServerAsync; {nameof(requestId)}: {requestId}; {ConstHelper.NameByValue(TagsName, messageTag)}");
|
|
||||||
|
|
||||||
return StartConnection().ContinueWith(_ =>
|
|
||||||
{
|
|
||||||
var msgp = message?.ToMessagePack(ContractlessStandardResolver.Options);
|
|
||||||
return HubConnection.SendAsync(nameof(IAcSignalRHubClient.OnReceiveMessage), messageTag, msgp, requestId);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
#region CRUD
|
|
||||||
public virtual Task<TResponseData?> GetByIdAsync<TResponseData>(int messageTag, object id) //where TResponseData : class
|
|
||||||
=> SendMessageToServerAsync<TResponseData>(messageTag, new SignalPostJsonDataMessage<IdMessage>(new IdMessage(id)), AcDomain.NextUniqueInt32);
|
|
||||||
public virtual Task GetByIdAsync<TResponseData>(int messageTag, Func<ISignalResponseMessage<TResponseData?>, Task> responseCallback, object id)
|
|
||||||
=> SendMessageToServerAsync(messageTag, new SignalPostJsonDataMessage<IdMessage>(new IdMessage(id)), responseCallback);
|
|
||||||
|
|
||||||
public virtual Task<TResponseData?> GetByIdAsync<TResponseData>(int messageTag, object[] ids) //where TResponseData : class
|
|
||||||
=> SendMessageToServerAsync<TResponseData>(messageTag, new SignalPostJsonDataMessage<IdMessage>(new IdMessage(ids)), AcDomain.NextUniqueInt32);
|
|
||||||
public virtual Task GetByIdAsync<TResponseData>(int messageTag, Func<ISignalResponseMessage<TResponseData?>, Task> responseCallback, object[] ids)
|
|
||||||
=> SendMessageToServerAsync(messageTag, new SignalPostJsonDataMessage<IdMessage>(new IdMessage(ids)), responseCallback);
|
|
||||||
|
|
||||||
public virtual Task<TResponseData?> GetAllAsync<TResponseData>(int messageTag) //where TResponseData : class
|
|
||||||
=> SendMessageToServerAsync<TResponseData>(messageTag);
|
|
||||||
public virtual Task GetAllAsync<TResponseData>(int messageTag, Func<ISignalResponseMessage<TResponseData?>, Task> responseCallback)
|
|
||||||
=> SendMessageToServerAsync(messageTag, null, responseCallback);
|
|
||||||
|
|
||||||
public virtual Task GetAllAsync<TResponseData>(int messageTag, Func<ISignalResponseMessage<TResponseData?>, Task> responseCallback, object[]? contextParams)
|
|
||||||
=> SendMessageToServerAsync(messageTag, (contextParams == null || contextParams.Length == 0 ? null : new SignalPostJsonDataMessage<IdMessage>(new IdMessage(contextParams))), responseCallback);
|
|
||||||
public virtual Task<TResponseData?> GetAllAsync<TResponseData>(int messageTag, object[]? contextParams) //where TResponseData : class
|
|
||||||
=> SendMessageToServerAsync<TResponseData>(messageTag, contextParams == null || contextParams.Length == 0 ? null : new SignalPostJsonDataMessage<IdMessage>(new IdMessage(contextParams)), AcDomain.NextUniqueInt32);
|
|
||||||
|
|
||||||
public virtual Task<TPostData?> PostDataAsync<TPostData>(int messageTag, TPostData postData) where TPostData : class
|
|
||||||
=> SendMessageToServerAsync<TPostData>(messageTag, new SignalPostJsonDataMessage<TPostData>(postData), AcDomain.NextUniqueInt32);
|
|
||||||
public virtual Task<TResponseData?> PostDataAsync<TPostData, TResponseData>(int messageTag, TPostData postData) //where TPostData : class where TResponseData : class
|
|
||||||
=> SendMessageToServerAsync<TResponseData>(messageTag, new SignalPostJsonDataMessage<TPostData>(postData), AcDomain.NextUniqueInt32);
|
|
||||||
|
|
||||||
public virtual Task PostDataAsync<TPostData>(int messageTag, TPostData postData, Func<ISignalResponseMessage<TPostData?>, Task> responseCallback) //where TPostData : class
|
|
||||||
=> SendMessageToServerAsync(messageTag, new SignalPostJsonDataMessage<TPostData>(postData), responseCallback);
|
|
||||||
public virtual Task PostDataAsync<TPostData, TResponseData>(int messageTag, TPostData postData, Func<ISignalResponseMessage<TResponseData?>, Task> responseCallback) //where TPostData : class where TResponseData : class
|
|
||||||
=> SendMessageToServerAsync(messageTag, new SignalPostJsonDataMessage<TPostData>(postData), responseCallback);
|
|
||||||
|
|
||||||
public Task GetAllIntoAsync<TResponseItem>(List<TResponseItem> intoList, int messageTag, object[]? contextParams = null, Action? callback = null) where TResponseItem : IEntityGuid
|
|
||||||
{
|
|
||||||
return GetAllAsync<List<TResponseItem>>(messageTag, response =>
|
|
||||||
{
|
|
||||||
var logText = $"GetAllIntoAsync<{typeof(TResponseItem).Name}>(); status: {response.Status}; dataCount: {response.ResponseData?.Count}; {ConstHelper.NameByValue(TagsName, messageTag)};";
|
|
||||||
|
|
||||||
intoList.Clear();
|
|
||||||
|
|
||||||
if (response.Status == SignalResponseStatus.Success && response.ResponseData != null)
|
|
||||||
{
|
|
||||||
Logger.Debug(logText);
|
|
||||||
intoList.AddRange(response.ResponseData);
|
|
||||||
}
|
|
||||||
else Logger.Error(logText);
|
|
||||||
|
|
||||||
callback?.Invoke();
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}, contextParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion CRUD
|
|
||||||
|
|
||||||
public virtual Task<TResponse?> SendMessageToServerAsync<TResponse>(int messageTag) //where TResponse : class
|
|
||||||
=> SendMessageToServerAsync<TResponse>(messageTag, null, AcDomain.NextUniqueInt32);
|
|
||||||
|
|
||||||
public virtual Task<TResponse?> SendMessageToServerAsync<TResponse>(int messageTag, ISignalRMessage? message) //where TResponse : class
|
|
||||||
=> SendMessageToServerAsync<TResponse>(messageTag, message, AcDomain.NextUniqueInt32);
|
|
||||||
|
|
||||||
protected virtual async Task<TResponse?> SendMessageToServerAsync<TResponse>(int messageTag, ISignalRMessage? message, int requestId) //where TResponse : class
|
|
||||||
{
|
|
||||||
Logger.DebugConditional($"Client SendMessageToServerAsync<TResult>; {nameof(requestId)}: {requestId}; {ConstHelper.NameByValue(TagsName, messageTag)}");
|
|
||||||
|
|
||||||
_responseByRequestId[requestId] = new SignalRRequestModel();
|
|
||||||
await SendMessageToServerAsync(messageTag, message, requestId);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (await TaskHelper.WaitToAsync(() => _responseByRequestId[requestId].ResponseByRequestId != null, Timeout, 25, 50) &&
|
|
||||||
_responseByRequestId.TryRemove(requestId, out var obj) && obj.ResponseByRequestId is ISignalResponseMessage<string> responseMessage)
|
|
||||||
{
|
|
||||||
if (responseMessage.Status == SignalResponseStatus.Error || responseMessage.ResponseData == null)
|
|
||||||
{
|
|
||||||
var errorText = $"Client SendMessageToServerAsync<TResponseData> response error; await; tag: {messageTag}; Status: {responseMessage.Status}; requestId: {requestId};";
|
|
||||||
|
|
||||||
Logger.Error(errorText);
|
|
||||||
|
|
||||||
//TODO: Ideiglenes, majd a ResponseMessage-et kell visszaadni a Status miatt! - J.
|
|
||||||
return await Task.FromException<TResponse>(new Exception(errorText));
|
|
||||||
|
|
||||||
//throw new Exception(errorText);
|
|
||||||
//return default;
|
|
||||||
}
|
|
||||||
|
|
||||||
return responseMessage.ResponseData.JsonTo<TResponse>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logger.Error($"SendMessageToServerAsync; requestId: {requestId}; {ex.Message}; {ConstHelper.NameByValue(TagsName, messageTag)}", ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
_responseByRequestId.TryRemove(requestId, out _);
|
|
||||||
return default;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual Task SendMessageToServerAsync<TResponseData>(int messageTag, Func<ISignalResponseMessage<TResponseData?>, Task> responseCallback)
|
|
||||||
=> SendMessageToServerAsync(messageTag, null, responseCallback);
|
|
||||||
|
|
||||||
public virtual Task SendMessageToServerAsync<TResponseData>(int messageTag, ISignalRMessage? message, Func<ISignalResponseMessage<TResponseData?>, Task> responseCallback)
|
|
||||||
{
|
|
||||||
if (messageTag == 0)
|
|
||||||
Logger.Error($"SendMessageToServerAsync; messageTag == 0");
|
|
||||||
|
|
||||||
var requestId = AcDomain.NextUniqueInt32;
|
|
||||||
|
|
||||||
_responseByRequestId[requestId] = new SignalRRequestModel(new Action<ISignalResponseMessage<string>>(responseMessage =>
|
|
||||||
{
|
|
||||||
TResponseData? responseData = default;
|
|
||||||
|
|
||||||
if (responseMessage.Status == SignalResponseStatus.Success)
|
|
||||||
{
|
|
||||||
responseData = string.IsNullOrEmpty(responseMessage.ResponseData) ? default : responseMessage.ResponseData.JsonTo<TResponseData?>();
|
|
||||||
}
|
|
||||||
else Logger.Error($"Client SendMessageToServerAsync<TResponseData> response error; callback; Status: {responseMessage.Status}; requestId: {requestId}; {ConstHelper.NameByValue(TagsName, messageTag)}");
|
|
||||||
|
|
||||||
responseCallback(new SignalResponseMessage<TResponseData?>(messageTag, responseMessage.Status, responseData));
|
|
||||||
}));
|
|
||||||
|
|
||||||
return SendMessageToServerAsync(messageTag, message, requestId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual Task OnReceiveMessage(int messageTag, byte[] message, int? requestId)
|
|
||||||
{
|
|
||||||
var logText = $"Client OnReceiveMessage; {nameof(requestId)}: {requestId}; {ConstHelper.NameByValue(TagsName, messageTag)}";
|
|
||||||
|
|
||||||
if (message.Length == 0) Logger.Warning($"message.Length == 0! {logText}");
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (requestId.HasValue && _responseByRequestId.ContainsKey(requestId.Value))
|
|
||||||
{
|
|
||||||
var reqId = requestId.Value;
|
|
||||||
|
|
||||||
_responseByRequestId[reqId].ResponseDateTime = DateTime.UtcNow;
|
|
||||||
Logger.Info($"[{_responseByRequestId[reqId].ResponseDateTime.Subtract(_responseByRequestId[reqId].RequestDateTime).TotalMilliseconds:N0}ms][{(message.Length/1024)}kb]{logText}");
|
|
||||||
|
|
||||||
var responseMessage = message.MessagePackTo<SignalResponseJsonMessage>(ContractlessStandardResolver.Options);
|
|
||||||
|
|
||||||
switch (_responseByRequestId[reqId].ResponseByRequestId)
|
|
||||||
{
|
|
||||||
case null:
|
|
||||||
_responseByRequestId[reqId].ResponseByRequestId = responseMessage;
|
|
||||||
return Task.CompletedTask;
|
|
||||||
|
|
||||||
case Action<ISignalResponseMessage<string>> messagePackCallback:
|
|
||||||
_responseByRequestId.TryRemove(reqId, out _);
|
|
||||||
|
|
||||||
messagePackCallback.Invoke(responseMessage);
|
|
||||||
return Task.CompletedTask;
|
|
||||||
|
|
||||||
//case Action<string> jsonCallback:
|
|
||||||
// _responseByRequestId.TryRemove(reqId, out _);
|
|
||||||
|
|
||||||
// jsonCallback.Invoke(responseMessage);
|
|
||||||
// return Task.CompletedTask;
|
|
||||||
|
|
||||||
default:
|
|
||||||
Logger.Error($"Client OnReceiveMessage switch; unknown message type: {_responseByRequestId[reqId].ResponseByRequestId?.GetType().Name}; {ConstHelper.NameByValue(TagsName, messageTag)}");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
_responseByRequestId.TryRemove(reqId, out _);
|
|
||||||
}
|
|
||||||
else Logger.Info(logText);
|
|
||||||
|
|
||||||
OnMessageReceived(messageTag, message, requestId);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
if (requestId.HasValue)
|
|
||||||
_responseByRequestId.TryRemove(requestId.Value, out _);
|
|
||||||
|
|
||||||
Logger.Error($"Client OnReceiveMessage; requestId: {requestId}; {ex.Message}; {ConstHelper.NameByValue(TagsName, messageTag)}", ex);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
//public virtual Task OnRequestMessage(int messageTag, int requestId)
|
|
||||||
//{
|
|
||||||
// Logger.DebugConditional($"Client OnRequestMessage; {nameof(messageTag)}: {messageTag}; {nameof(requestId)}: {requestId};");
|
|
||||||
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// OnMessageRequested(messageTag, requestId);
|
|
||||||
// }
|
|
||||||
// catch(Exception ex)
|
|
||||||
// {
|
|
||||||
// Logger.Error($"Client OnReceiveMessage; {nameof(messageTag)}: {messageTag}; {nameof(requestId)}: {requestId}; {ex.Message}", ex);
|
|
||||||
// throw;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return Task.CompletedTask;
|
|
||||||
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,1076 +0,0 @@
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using AyCode.Core.Enums;
|
|
||||||
using AyCode.Core.Extensions;
|
|
||||||
using AyCode.Core.Helpers;
|
|
||||||
using AyCode.Core.Interfaces;
|
|
||||||
using AyCode.Services.SignalRs;
|
|
||||||
using AyCode.Utils.Extensions;
|
|
||||||
|
|
||||||
namespace AyCode.Blazor.Components.Services
|
|
||||||
{
|
|
||||||
public class TrackingItem<T>(TrackingState trackingState, T currentValue, T? originalValue = null) where T : class, IId<Guid>
|
|
||||||
{
|
|
||||||
public TrackingState TrackingState { get; internal set; } = trackingState;
|
|
||||||
public T CurrentValue { get; internal set; } = currentValue;
|
|
||||||
public T? OriginalValue { get; init; } = originalValue;
|
|
||||||
|
|
||||||
internal TrackingItem<T> UpdateItem(TrackingState trackingState, T newValue)
|
|
||||||
{
|
|
||||||
CurrentValue = newValue;
|
|
||||||
|
|
||||||
if (TrackingState != TrackingState.Add)
|
|
||||||
TrackingState = trackingState;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class ChangeTracking<T> /*: IEnumerable<TrackingItem<T>>*/ where T : class, IId<Guid>
|
|
||||||
{
|
|
||||||
private readonly List<TrackingItem<T>> _trackingItems = []; //TODO: Dictionary... - J.
|
|
||||||
|
|
||||||
internal TrackingItem<T>? AddTrackingItem(TrackingState trackingState, T newValue, T? originalValue = null)
|
|
||||||
{
|
|
||||||
if (newValue.Id.IsNullOrEmpty()) throw new ArgumentNullException(nameof(newValue), $@"currentValue.Id.IsNullOrEmpty()");
|
|
||||||
|
|
||||||
var itemIndex = _trackingItems.FindIndex(x => x.CurrentValue.Id == newValue.Id);
|
|
||||||
TrackingItem<T>? trackingItem = null;
|
|
||||||
|
|
||||||
if (itemIndex > -1)
|
|
||||||
{
|
|
||||||
trackingItem = _trackingItems[itemIndex];
|
|
||||||
|
|
||||||
if (trackingState == TrackingState.Remove && trackingItem.TrackingState == TrackingState.Add)
|
|
||||||
{
|
|
||||||
_trackingItems.RemoveAt(itemIndex);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return trackingItem.UpdateItem(trackingState, newValue);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (originalValue != null && Equals(newValue, originalValue))
|
|
||||||
originalValue = TrackingItemHelpers.JsonClone(originalValue);
|
|
||||||
|
|
||||||
trackingItem = new TrackingItem<T>(trackingState, newValue, originalValue);
|
|
||||||
_trackingItems.Add(trackingItem);
|
|
||||||
|
|
||||||
return trackingItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Count => _trackingItems.Count;
|
|
||||||
internal void Clear() => _trackingItems.Clear();
|
|
||||||
public List<TrackingItem<T>> ToList() => _trackingItems.ToList();
|
|
||||||
|
|
||||||
public bool TryGetTrackingItem(Guid id, [NotNullWhen(true)] out TrackingItem<T>? trackingItem)
|
|
||||||
{
|
|
||||||
trackingItem = _trackingItems.FirstOrDefault(x => x.CurrentValue.Id == id);
|
|
||||||
return trackingItem != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void Remove(TrackingItem<T> trackingItem) => _trackingItems.Remove(trackingItem);
|
|
||||||
|
|
||||||
//public IEnumerator<TrackingItem<T>> GetEnumerator()
|
|
||||||
//{
|
|
||||||
// return _trackingItems.GetEnumerator();
|
|
||||||
//}
|
|
||||||
|
|
||||||
//IEnumerator IEnumerable.GetEnumerator()
|
|
||||||
//{
|
|
||||||
// return GetEnumerator();
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
[DebuggerDisplay("Count = {Count}")]
|
|
||||||
public class AcSignalRDataSource<T> : IList<T>, IList, IReadOnlyList<T> where T : class, IId<Guid>
|
|
||||||
{
|
|
||||||
private readonly object _syncRoot = new();
|
|
||||||
|
|
||||||
protected List<T> InnerList = []; //TODO: Dictionary??? - J.
|
|
||||||
protected readonly ChangeTracking<T> TrackingItems = new();
|
|
||||||
|
|
||||||
public object[]? ContextIds;
|
|
||||||
public string? FilterText { get; set; }
|
|
||||||
|
|
||||||
public AcSignalRClientBase SignalRClient;
|
|
||||||
protected readonly SignalRCrudTags SignalRCrudTags;
|
|
||||||
|
|
||||||
public Func<ItemChangedEventArgs<T>, Task>? OnDataSourceItemChanged;
|
|
||||||
public Func<Task>? OnDataSourceLoaded;
|
|
||||||
|
|
||||||
public AcSignalRDataSource(AcSignalRClientBase signalRClient, SignalRCrudTags signalRCrudTags, object[]? contextIds = null)
|
|
||||||
{
|
|
||||||
//if (contextIds != null) (ContextIds = new List<object>()).AddRange(contextIds);
|
|
||||||
ContextIds = contextIds;
|
|
||||||
|
|
||||||
SignalRCrudTags = signalRCrudTags;
|
|
||||||
SignalRClient = signalRClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsSynchronized => true;
|
|
||||||
public object SyncRoot => _syncRoot;
|
|
||||||
public bool IsFixedSize => false;
|
|
||||||
|
|
||||||
public bool HasWorkingReferenceList { get; private set; }
|
|
||||||
|
|
||||||
public void SetWorkingReferenceList(List<T> workingList)
|
|
||||||
{
|
|
||||||
if (workingList == null!) return; //throw new ArgumentNullException(nameof(workingList));
|
|
||||||
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
HasWorkingReferenceList = true;
|
|
||||||
if (ReferenceEquals(InnerList, workingList)) return;
|
|
||||||
|
|
||||||
if (workingList.Count == 0) workingList.AddRange(InnerList);
|
|
||||||
|
|
||||||
Clear(true);
|
|
||||||
InnerList = workingList;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private object[]? GetContextParams()
|
|
||||||
{
|
|
||||||
var parameters = new List<object>();
|
|
||||||
if (ContextIds != null) parameters.AddRange(ContextIds);
|
|
||||||
if (FilterText != null) parameters.Add(FilterText); //Az empty string-et beletesszük, h legyen paraméter! - J.
|
|
||||||
|
|
||||||
if (parameters.Count == 0) parameters = null;
|
|
||||||
return parameters?.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// GetAllMessageTag
|
|
||||||
/// </summary>
|
|
||||||
/// <exception cref="ArgumentException"></exception>
|
|
||||||
/// <exception cref="NullReferenceException"></exception>
|
|
||||||
public async Task LoadDataSource(bool clearChangeTracking = true)
|
|
||||||
{
|
|
||||||
if (SignalRCrudTags.GetAllMessageTag == AcSignalRTags.None) throw new ArgumentException($"SignalRCrudTags.GetAllMessageTag == SignalRTags.None");
|
|
||||||
|
|
||||||
var responseData = (await SignalRClient.GetAllAsync<List<T>>(SignalRCrudTags.GetAllMessageTag, GetContextParams())) ?? throw new NullReferenceException();
|
|
||||||
|
|
||||||
await LoadDataSource(responseData, false, false, clearChangeTracking);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task LoadDataSourceAsync(bool clearChangeTracking = true)
|
|
||||||
{
|
|
||||||
if (SignalRCrudTags.GetAllMessageTag == AcSignalRTags.None) throw new ArgumentException($"SignalRCrudTags.GetAllMessageTag == SignalRTags.None");
|
|
||||||
|
|
||||||
return SignalRClient.GetAllAsync<List<T>>(SignalRCrudTags.GetAllMessageTag, result=>
|
|
||||||
{
|
|
||||||
if (result.Status != SignalResponseStatus.Success || result.ResponseData == null)
|
|
||||||
throw new NullReferenceException($"LoadDataSourceAsync; result.Status != SignalResponseStatus.Success || result.ResponseData == null; Status: {SignalResponseStatus.Success}");
|
|
||||||
|
|
||||||
return LoadDataSource(result.ResponseData, false, false, clearChangeTracking);
|
|
||||||
}, GetContextParams());
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task LoadDataSource(IList<T> fromSource, bool refreshDataFromDbAsync = false, bool setSourceToWorkingReferenceList = false, bool clearChangeTracking = true)
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!ReferenceEquals(InnerList, fromSource))
|
|
||||||
{
|
|
||||||
Clear(clearChangeTracking);
|
|
||||||
|
|
||||||
if (setSourceToWorkingReferenceList && fromSource is List<T> fromSourceList) SetWorkingReferenceList(fromSourceList);
|
|
||||||
else InnerList.AddRange(fromSource);
|
|
||||||
}
|
|
||||||
else if (clearChangeTracking) TrackingItems.Clear();
|
|
||||||
|
|
||||||
if (refreshDataFromDbAsync) LoadDataSourceAsync(false).Forget();
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (OnDataSourceLoaded != null) await OnDataSourceLoaded.Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<T?> LoadItem(Guid id)
|
|
||||||
{
|
|
||||||
if (SignalRCrudTags.GetItemMessageTag == AcSignalRTags.None) throw new ArgumentException($"SignalRCrudTags.GetItemMessageTag == SignalRTags.None");
|
|
||||||
|
|
||||||
T? resultitem = null;
|
|
||||||
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
resultitem = await SignalRClient.GetByIdAsync<T>(SignalRCrudTags.GetItemMessageTag, id);
|
|
||||||
if (resultitem == null) return null;
|
|
||||||
|
|
||||||
if (TryGetIndex(id, out var index)) InnerList[index] = resultitem;
|
|
||||||
else InnerList.Add(resultitem);
|
|
||||||
|
|
||||||
var eventArgs = new ItemChangedEventArgs<T>(resultitem, TrackingState.Get);
|
|
||||||
if (OnDataSourceItemChanged != null) await OnDataSourceItemChanged.Invoke(eventArgs);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
return resultitem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// set: UpdateMessageTag
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
|
||||||
public T this[int index]
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if ((uint)index >= (uint)Count) throw new ArgumentOutOfRangeException(nameof(index));
|
|
||||||
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return InnerList[index];
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
UpdateUnsafe(index, value);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Add(T newValue)
|
|
||||||
{
|
|
||||||
if (newValue.Id.IsNullOrEmpty()) throw new ArgumentNullException(nameof(newValue), @"Add->newValue.Id.IsNullOrEmpty()");
|
|
||||||
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (Contains(newValue))
|
|
||||||
throw new ArgumentException($@"It already contains this Id! Id: {newValue.Id}", nameof(newValue));
|
|
||||||
|
|
||||||
UnsafeAdd(newValue);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// AddMessageTag
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="newValue"></param>
|
|
||||||
/// <param name="autoSave"></param>
|
|
||||||
/// <exception cref="ArgumentException"></exception>
|
|
||||||
public async Task<T> Add(T newValue, bool autoSave)
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Add(newValue);
|
|
||||||
|
|
||||||
return autoSave ? await SaveItem(newValue, TrackingState.Add) : newValue;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// AddMessageTag or UpdateMessageTag
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="newValue"></param>
|
|
||||||
/// <param name="autoSave"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<T> AddOrUpdate(T newValue, bool autoSave)
|
|
||||||
{
|
|
||||||
if (newValue.Id.IsNullOrEmpty()) throw new ArgumentNullException(nameof(newValue), @"AddOrUpdate->newValue.Id.IsNullOrEmpty()");
|
|
||||||
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var index = IndexOf(newValue);
|
|
||||||
|
|
||||||
return index > -1 ? await Update(index, newValue, autoSave) : await Add(newValue, autoSave);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//public void AddRange(IEnumerable<T> collection)
|
|
||||||
//{
|
|
||||||
// lock (_syncRoot)
|
|
||||||
// {
|
|
||||||
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
protected void UnsafeAdd(T newValue)
|
|
||||||
{
|
|
||||||
TrackingItems.AddTrackingItem(TrackingState.Add, newValue);
|
|
||||||
InnerList.Add(newValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// AddMessageTag
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index"></param>
|
|
||||||
/// <param name="newValue"></param>
|
|
||||||
/// <param name="autoSave"></param>
|
|
||||||
/// <exception cref="ArgumentException"></exception>
|
|
||||||
/// <exception cref="NullReferenceException"></exception>
|
|
||||||
public void Insert(int index, T newValue)
|
|
||||||
{
|
|
||||||
if (newValue.Id.IsNullOrEmpty()) throw new ArgumentNullException(nameof(newValue), @"Insert->newValue.Id.IsNullOrEmpty()");
|
|
||||||
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (Contains(newValue))
|
|
||||||
throw new ArgumentException($@"Insert; It already contains this Id! Id: {newValue.Id}", nameof(newValue));
|
|
||||||
|
|
||||||
TrackingItems.AddTrackingItem(TrackingState.Add, newValue);
|
|
||||||
InnerList.Insert(index, newValue);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<T> Insert(int index, T newValue, bool autoSave)
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Insert(index, newValue);
|
|
||||||
|
|
||||||
return autoSave ? await SaveItem(newValue, TrackingState.Add) : newValue;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// UpdateMessageTag
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="newItem"></param>
|
|
||||||
/// <param name="autoSave"></param>
|
|
||||||
public Task<T> Update(T newItem, bool autoSave) => Update(IndexOf(newItem), newItem, autoSave);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// UpdateMessageTag
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index"></param>
|
|
||||||
/// <param name="newValue"></param>
|
|
||||||
/// <param name="autoSave"></param>
|
|
||||||
/// /// <exception cref="ArgumentException"></exception>
|
|
||||||
/// /// <exception cref="NullReferenceException"></exception>
|
|
||||||
/// <exception cref="ArgumentNullException"></exception>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
|
||||||
public async Task<T> Update(int index, T newValue, bool autoSave)
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
UpdateUnsafe(index, newValue);
|
|
||||||
|
|
||||||
return autoSave ? await SaveItem(newValue, TrackingState.Update) : newValue;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateUnsafe(int index, T newValue)
|
|
||||||
{
|
|
||||||
if (default(T) != null && newValue == null) throw new NullReferenceException(nameof(newValue));
|
|
||||||
if (newValue.Id.IsNullOrEmpty()) throw new ArgumentNullException(nameof(newValue), @"UpdateUnsafe->newValue.Id.IsNullOrEmpty()");
|
|
||||||
if ((uint)index >= (uint)Count) throw new ArgumentOutOfRangeException(nameof(index));
|
|
||||||
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var currentItem = InnerList[index];
|
|
||||||
|
|
||||||
if (currentItem.Id != newValue.Id)
|
|
||||||
throw new ArgumentException($@"UpdateUnsafe; currentItem.Id != item.Id! Id: {newValue.Id}", nameof(newValue));
|
|
||||||
|
|
||||||
TrackingItems.AddTrackingItem(TrackingState.Update, newValue, currentItem);
|
|
||||||
InnerList[index] = newValue;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// RemoveMessageTag
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool Remove(T item)
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var index = IndexOf(item);
|
|
||||||
|
|
||||||
if (index < 0) return false;
|
|
||||||
|
|
||||||
RemoveAt(index);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<bool> Remove(T item, bool autoSave)
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var result = Remove(item);
|
|
||||||
|
|
||||||
if (!autoSave || !result) return result;
|
|
||||||
|
|
||||||
await SaveItem(item, TrackingState.Remove);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id"></param>
|
|
||||||
/// <param name="item"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool TryRemove(Guid id, out T? item)
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return TryGetValue(id, out item) && Remove(item);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// RemoveMessageTag
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index"></param>
|
|
||||||
/// <exception cref="ArgumentException"></exception>
|
|
||||||
/// /// <exception cref="ArgumentNullException"></exception>
|
|
||||||
/// <exception cref="NullReferenceException"></exception>
|
|
||||||
public void RemoveAt(int index)
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var currentItem = InnerList[index];
|
|
||||||
if (currentItem.Id.IsNullOrEmpty()) throw new ArgumentNullException(nameof(currentItem), $@"RemoveAt->item.Id.IsNullOrEmpty(); index: {index}");
|
|
||||||
|
|
||||||
TrackingItems.AddTrackingItem(TrackingState.Remove, currentItem, currentItem);
|
|
||||||
InnerList.RemoveAt(index);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task RemoveAt(int index, bool autoSave)
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var currentItem = InnerList[index];
|
|
||||||
RemoveAt(index);
|
|
||||||
|
|
||||||
if (autoSave)
|
|
||||||
{
|
|
||||||
await SaveItem(currentItem, TrackingState.Remove);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public List<TrackingItem<T>> GetTrackingItems()
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return TrackingItems.ToList();
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetTrackingStateToUpdate(T item)
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (TrackingItems.TryGetTrackingItem(item.Id, out var trackingItem))
|
|
||||||
{
|
|
||||||
if (trackingItem.TrackingState != TrackingState.Add)
|
|
||||||
trackingItem.TrackingState = TrackingState.Update;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!TryGetValue(item.Id, out var originalItem)) return;
|
|
||||||
TrackingItems.AddTrackingItem(TrackingState.Update, item, originalItem);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id"></param>
|
|
||||||
/// <param name="trackingItem"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool TryGetTrackingItem(Guid id, [NotNullWhen(true)] out TrackingItem<T>? trackingItem)
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return TrackingItems.TryGetTrackingItem(id, out trackingItem);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Unsaved items</returns>
|
|
||||||
public async Task<List<TrackingItem<T>>> SaveChanges()
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
foreach (var trackingItem in TrackingItems.ToList())
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await SaveTrackingItemUnsafe(trackingItem);
|
|
||||||
}
|
|
||||||
catch(Exception ex)
|
|
||||||
{
|
|
||||||
TryRollbackItem(trackingItem.CurrentValue.Id, out _);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return TrackingItems.ToList();
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task SaveChangesAsync()
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
foreach (var trackingItem in TrackingItems.ToList())
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
await SaveTrackingItemUnsafeAsync(trackingItem);
|
|
||||||
}
|
|
||||||
catch(Exception ex)
|
|
||||||
{
|
|
||||||
TryRollbackItem(trackingItem.CurrentValue.Id, out _);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<T> SaveItem(Guid id)
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
T resultItem = null!;
|
|
||||||
|
|
||||||
if (TryGetTrackingItem(id, out var trackingItem))
|
|
||||||
resultItem = await SaveTrackingItemUnsafe(trackingItem);
|
|
||||||
|
|
||||||
if (resultItem == null) throw new NullReferenceException($"SaveItem; resultItem == null");
|
|
||||||
return resultItem;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<T> SaveItem(Guid id, TrackingState trackingState)
|
|
||||||
{
|
|
||||||
//Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
T resultItem = null!;
|
|
||||||
|
|
||||||
if (TryGetValue(id, out var item))
|
|
||||||
resultItem = await SaveItem(item, trackingState);
|
|
||||||
|
|
||||||
if (resultItem == null) throw new NullReferenceException($"SaveItem; resultItem == null");
|
|
||||||
return resultItem;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
//Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<T> SaveItem(T item, TrackingState trackingState) => SaveItemUnsafe(item, trackingState);
|
|
||||||
|
|
||||||
protected Task<T> SaveTrackingItemUnsafe(TrackingItem<T> trackingItem)
|
|
||||||
=> SaveItemUnsafe(trackingItem.CurrentValue, trackingItem.TrackingState);
|
|
||||||
|
|
||||||
protected Task SaveTrackingItemUnsafeAsync(TrackingItem<T> trackingItem)
|
|
||||||
=> SaveItemUnsafeAsync(trackingItem.CurrentValue, trackingItem.TrackingState);
|
|
||||||
|
|
||||||
protected Task<T> SaveItemUnsafe(T item, TrackingState trackingState)
|
|
||||||
{
|
|
||||||
var messageTag = SignalRCrudTags.GetMessageTagByTrackingState(trackingState);
|
|
||||||
if (messageTag == AcSignalRTags.None) throw new ArgumentException($"SaveItemUnsafe; messageTag == SignalRTags.None");
|
|
||||||
|
|
||||||
return SignalRClient.PostDataAsync(messageTag, item).ContinueWith(x =>
|
|
||||||
{
|
|
||||||
if (x.Result == null)
|
|
||||||
{
|
|
||||||
if (TryRollbackItem(item.Id, out _)) return item;
|
|
||||||
|
|
||||||
throw new NullReferenceException($"SaveItemUnsafe; result == null");
|
|
||||||
}
|
|
||||||
|
|
||||||
ProcessSavedResponseItem(x.Result, trackingState);
|
|
||||||
return x.Result;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Task SaveItemUnsafeAsync(T item, TrackingState trackingState)
|
|
||||||
{
|
|
||||||
var messageTag = SignalRCrudTags.GetMessageTagByTrackingState(trackingState);
|
|
||||||
if (messageTag == AcSignalRTags.None) return Task.CompletedTask;
|
|
||||||
|
|
||||||
return SignalRClient.PostDataAsync(messageTag, item, response =>
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (response.Status != SignalResponseStatus.Success || response.ResponseData == null)
|
|
||||||
{
|
|
||||||
if (TryRollbackItem(item.Id, out _)) return Task.CompletedTask;
|
|
||||||
|
|
||||||
throw new NullReferenceException($"SaveItemUnsafeAsync; result.Status != SignalResponseStatus.Success || result.ResponseData == null; Status: {SignalResponseStatus.Success}");
|
|
||||||
}
|
|
||||||
|
|
||||||
return ProcessSavedResponseItem(response.ResponseData, trackingState);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private Task ProcessSavedResponseItem(T? resultItem, TrackingState trackingState)
|
|
||||||
{
|
|
||||||
if (resultItem == null) return Task.CompletedTask;
|
|
||||||
|
|
||||||
if (TryGetTrackingItem(resultItem.Id, out var trackingItem))
|
|
||||||
TrackingItems.Remove(trackingItem);
|
|
||||||
|
|
||||||
if (TryGetIndex(resultItem.Id, out var index))
|
|
||||||
InnerList[index] = resultItem;
|
|
||||||
|
|
||||||
var eventArgs = new ItemChangedEventArgs<T>(resultItem, trackingState);
|
|
||||||
if (OnDataSourceItemChanged != null) return OnDataSourceItemChanged.Invoke(eventArgs);
|
|
||||||
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void RollbackItemUnsafe(TrackingItem<T> trackingItem)
|
|
||||||
{
|
|
||||||
if (TryGetIndex(trackingItem.CurrentValue.Id, out var index))
|
|
||||||
{
|
|
||||||
if (trackingItem.TrackingState == TrackingState.Add) InnerList.RemoveAt(index);
|
|
||||||
else InnerList[index] = trackingItem.OriginalValue!;
|
|
||||||
}
|
|
||||||
else if (trackingItem.TrackingState != TrackingState.Add)
|
|
||||||
InnerList.Add(trackingItem.OriginalValue!);
|
|
||||||
|
|
||||||
TrackingItems.Remove(trackingItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool TryRollbackItem(Guid id, out T? originalValue)
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (TryGetTrackingItem(id, out var trackingItem))
|
|
||||||
{
|
|
||||||
originalValue = trackingItem.OriginalValue;
|
|
||||||
|
|
||||||
RollbackItemUnsafe(trackingItem);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
originalValue = null;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Rollback()
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
foreach (var trackingItem in TrackingItems.ToList())
|
|
||||||
RollbackItemUnsafe(trackingItem);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Count
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return InnerList.Count;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Clear() => Clear(true);
|
|
||||||
|
|
||||||
public void Clear(bool clearChangeTracking)
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (clearChangeTracking) TrackingItems.Clear();
|
|
||||||
InnerList.Clear();
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int IndexOf(Guid id)
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return InnerList.FindIndex(x => x.Id == id);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public int IndexOf(T item) => IndexOf(item.Id);
|
|
||||||
public bool TryGetIndex(Guid id, out int index) => (index = IndexOf(id)) > -1;
|
|
||||||
|
|
||||||
public bool Contains(T item) => IndexOf(item) > -1;
|
|
||||||
|
|
||||||
public bool TryGetValue(Guid id, [NotNullWhen(true)] out T? item)
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
item = InnerList.FirstOrDefault(x => x.Id == id);
|
|
||||||
return item != null;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CopyTo(T[] array) => CopyTo(array, 0);
|
|
||||||
|
|
||||||
public void CopyTo(T[] array, int arrayIndex)
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
InnerList.CopyTo(array, arrayIndex);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public int BinarySearch(int index, int count, T item, IComparer<T>? comparer)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException($"BinarySearch");
|
|
||||||
if (index < 0)
|
|
||||||
throw new ArgumentOutOfRangeException(nameof(index));
|
|
||||||
if (count < 0)
|
|
||||||
throw new ArgumentOutOfRangeException(nameof(count));
|
|
||||||
if (Count - index < count)
|
|
||||||
throw new ArgumentException("Invalid length");
|
|
||||||
|
|
||||||
//Monitor.Enter(_syncRoot);
|
|
||||||
//try
|
|
||||||
//{
|
|
||||||
// return InnerList.BinarySearch(index, count, item, comparer);
|
|
||||||
//}
|
|
||||||
//finally
|
|
||||||
//{
|
|
||||||
// Monitor.Exit(_syncRoot);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int BinarySearch(T item) => BinarySearch(0, Count, item, null);
|
|
||||||
public int BinarySearch(T item, IComparer<T>? comparer) => BinarySearch(0, Count, item, comparer);
|
|
||||||
|
|
||||||
public IEnumerator<T> GetEnumerator()
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//return InnerList.ToList().GetEnumerator();
|
|
||||||
return InnerList.GetEnumerator();
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReadOnlyCollection<T> AsReadOnly() => new(this);
|
|
||||||
private static bool IsCompatibleObject(object? value) => (value is T) || (value == null && default(T) == null);
|
|
||||||
|
|
||||||
|
|
||||||
#region IList, ICollection
|
|
||||||
|
|
||||||
bool IList.IsReadOnly => false;
|
|
||||||
|
|
||||||
object? IList.this[int index]
|
|
||||||
{
|
|
||||||
get => this[index];
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (default(T) != null && value == null) throw new NullReferenceException(nameof(value));
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
this[index] = (T)value!;
|
|
||||||
}
|
|
||||||
catch (InvalidCastException)
|
|
||||||
{
|
|
||||||
throw new InvalidCastException(nameof(value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int IList.Add(object? item)
|
|
||||||
{
|
|
||||||
if (default(T) != null && item == null) throw new NullReferenceException(nameof(item));
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Add((T)item!);
|
|
||||||
}
|
|
||||||
catch (InvalidCastException)
|
|
||||||
{
|
|
||||||
throw new InvalidCastException(nameof(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
return Count - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IList.Clear() => Clear(true);
|
|
||||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
|
||||||
bool IList.Contains(object? item) => IsCompatibleObject(item) && Contains((T)item!);
|
|
||||||
int IList.IndexOf(object? item) => (IsCompatibleObject(item)) ? IndexOf((T)item!) : -1;
|
|
||||||
|
|
||||||
void IList.Insert(int index, object? item)
|
|
||||||
{
|
|
||||||
if (default(T) != null && item == null) throw new NullReferenceException(nameof(item));
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Insert(index, (T)item!);
|
|
||||||
}
|
|
||||||
catch (InvalidCastException)
|
|
||||||
{
|
|
||||||
throw new InvalidCastException(nameof(item));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IList.Remove(object? item)
|
|
||||||
{
|
|
||||||
if (IsCompatibleObject(item)) Remove((T)item!);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ICollection<T>.Clear() => Clear(true);
|
|
||||||
|
|
||||||
void ICollection.CopyTo(Array array, int arrayIndex)
|
|
||||||
{
|
|
||||||
if ((array != null) && (array.Rank != 1))
|
|
||||||
{
|
|
||||||
throw new ArgumentException();
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Monitor.Enter(_syncRoot);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//TODO: _list.ToArray() - ez nem az igazi... - J.
|
|
||||||
Array.Copy(InnerList.ToArray(), 0, array!, arrayIndex, InnerList.Count);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Monitor.Exit(_syncRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (ArrayTypeMismatchException)
|
|
||||||
{
|
|
||||||
throw new ArrayTypeMismatchException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int ICollection.Count => Count;
|
|
||||||
int ICollection<T>.Count => Count;
|
|
||||||
bool ICollection<T>.IsReadOnly => false;
|
|
||||||
void IList<T>.RemoveAt(int index) => RemoveAt(index);
|
|
||||||
int IReadOnlyCollection<T>.Count => Count;
|
|
||||||
|
|
||||||
#endregion IList, ICollection
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ItemChangedEventArgs<T> where T : IId<Guid>
|
|
||||||
{
|
|
||||||
internal ItemChangedEventArgs(T item, TrackingState trackingState)
|
|
||||||
{
|
|
||||||
Item = item;
|
|
||||||
TrackingState = trackingState;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T Item { get; }
|
|
||||||
public TrackingState TrackingState { get; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
namespace AyCode.Blazor.Components.Services;
|
|
||||||
|
|
||||||
public interface IAcSessionItem<TSessionItemId> where TSessionItemId : notnull
|
|
||||||
{
|
|
||||||
public TSessionItemId SessionId { get; set; }
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
namespace AyCode.Blazor.Components.Services.Logins;
|
||||||
|
|
||||||
|
public class AcWebAuthService
|
||||||
|
{
|
||||||
|
public virtual void Logout()
|
||||||
|
{}
|
||||||
|
}
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
namespace AyCode.Blazor.Components.Services;
|
|
||||||
|
|
||||||
public class SignalRRequestModel
|
|
||||||
{
|
|
||||||
public DateTime RequestDateTime;
|
|
||||||
public DateTime ResponseDateTime;
|
|
||||||
public object? ResponseByRequestId = null;
|
|
||||||
|
|
||||||
public SignalRRequestModel()
|
|
||||||
{
|
|
||||||
RequestDateTime = DateTime.UtcNow;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SignalRRequestModel(object responseByRequestId) : this()
|
|
||||||
{
|
|
||||||
ResponseByRequestId = responseByRequestId;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
using System.Reflection;
|
|
||||||
using AyCode.Core.Extensions;
|
|
||||||
|
|
||||||
namespace AyCode.Blazor.Components.Services;
|
|
||||||
|
|
||||||
public static class TrackingItemHelpers
|
|
||||||
{
|
|
||||||
public static T JsonClone<T>(T source) => source.ToJson().JsonTo<T>()!;
|
|
||||||
|
|
||||||
public static T ReflectionClone<T>(T source)
|
|
||||||
{
|
|
||||||
var type = source!.GetType();
|
|
||||||
|
|
||||||
if (type.IsPrimitive || typeof(string) == type)
|
|
||||||
return source;
|
|
||||||
|
|
||||||
if (type.IsArray)
|
|
||||||
{
|
|
||||||
var elementType = Type.GetType(type.FullName!.Replace("[]", string.Empty))!;
|
|
||||||
var array = (source as Array)!;
|
|
||||||
var cloned = Array.CreateInstance(elementType, array.Length);
|
|
||||||
|
|
||||||
for (var i = 0; i < array.Length; i++)
|
|
||||||
cloned.SetValue(ReflectionClone(array.GetValue(i)), i);
|
|
||||||
|
|
||||||
return (T)Convert.ChangeType(cloned, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
var clone = Activator.CreateInstance(type);
|
|
||||||
|
|
||||||
while (type != null && type != typeof(object))
|
|
||||||
{
|
|
||||||
foreach (var field in type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance))
|
|
||||||
{
|
|
||||||
var fieldValue = field.GetValue(source);
|
|
||||||
if (fieldValue == null) continue;
|
|
||||||
|
|
||||||
field.SetValue(clone, ReflectionClone(fieldValue));
|
|
||||||
}
|
|
||||||
|
|
||||||
type = type.BaseType;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (T)clone!;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
@ -13,40 +13,40 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="AyCode.Core">
|
<Reference Include="AyCode.Core">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Core.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Core.Server">
|
<Reference Include="AyCode.Core.Server">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Core.Server.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Core.Server.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Database">
|
<Reference Include="AyCode.Database">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Database.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Database.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Entities">
|
<Reference Include="AyCode.Entities">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Entities.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Entities.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Entities.Server">
|
<Reference Include="AyCode.Entities.Server">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Entities.Server.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Entities.Server.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Interfaces">
|
<Reference Include="AyCode.Interfaces">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Interfaces.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Interfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Interfaces.Server">
|
<Reference Include="AyCode.Interfaces.Server">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Interfaces.Server.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Interfaces.Server.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Models">
|
<Reference Include="AyCode.Models">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Models.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Models.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Models.Server">
|
<Reference Include="AyCode.Models.Server">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Models.Server.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Models.Server.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Services">
|
<Reference Include="AyCode.Services">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Services.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Services.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Services.Server">
|
<Reference Include="AyCode.Services.Server">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Services.Server.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Services.Server.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Utils">
|
<Reference Include="AyCode.Utils">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Utils.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Utils.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
@ -55,10 +55,9 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MessagePack" Version="2.5.187" />
|
<PackageReference Include="MessagePack" Version="3.1.4" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.8" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="8.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="9.0.8" />
|
||||||
<PackageReference Include="Serialize.Linq" Version="3.1.160" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -1,42 +1,50 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="AyCode.Core">
|
<Reference Include="AyCode.Core">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Core.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Core.Server">
|
<Reference Include="AyCode.Core.Server">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Core.Server.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Core.Server.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Database">
|
<Reference Include="AyCode.Database">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Database.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Database.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Entities">
|
<Reference Include="AyCode.Entities">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Entities.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Entities.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Entities.Server">
|
<Reference Include="AyCode.Entities.Server">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Entities.Server.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Entities.Server.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Interfaces">
|
<Reference Include="AyCode.Interfaces">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Interfaces.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Interfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Interfaces.Server">
|
<Reference Include="AyCode.Interfaces.Server">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Interfaces.Server.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Interfaces.Server.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Models.Server">
|
<Reference Include="AyCode.Models.Server">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Models.Server.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Models.Server.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="AyCode.Services">
|
||||||
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Services.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Services.Server">
|
<Reference Include="AyCode.Services.Server">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Services.Server.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Services.Server.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Utils">
|
<Reference Include="AyCode.Utils">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Utils.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Utils.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Models\" />
|
||||||
|
<Folder Include="Services\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,44 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="AyCode.Core">
|
<Reference Include="AyCode.Core">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Core.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Core.Server">
|
<Reference Include="AyCode.Core.Server">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Core.Server.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Core.Server.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Entities">
|
<Reference Include="AyCode.Entities">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Entities.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Entities.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Entities.Server">
|
<Reference Include="AyCode.Entities.Server">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Entities.Server.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Entities.Server.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Interfaces">
|
<Reference Include="AyCode.Interfaces">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Interfaces.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Interfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Interfaces.Server">
|
<Reference Include="AyCode.Interfaces.Server">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Interfaces.Server.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Interfaces.Server.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Models">
|
<Reference Include="AyCode.Models">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Models.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Models.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Models.Server">
|
<Reference Include="AyCode.Models.Server">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Models.Server.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Models.Server.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Services">
|
<Reference Include="AyCode.Services">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Services.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Services.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Services.Server">
|
<Reference Include="AyCode.Services.Server">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Services.Server.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Services.Server.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Utils">
|
<Reference Include="AyCode.Utils">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Utils.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Utils.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,47 +1,55 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net8.0;net8.0-maccatalyst;net8.0-ios;net8.0-android34.0</TargetFrameworks>
|
<TargetFrameworks>net9.0;net9.0-maccatalyst;net9.0-ios;net9.0-android35.0</TargetFrameworks>
|
||||||
|
|
||||||
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
|
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
|
||||||
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->
|
<!-- <TargetFrameworks>$(TargetFrameworks);net9.0-tizen</TargetFrameworks> -->
|
||||||
<UseMaui>true</UseMaui>
|
<UseMaui>true</UseMaui>
|
||||||
<SingleProject>true</SingleProject>
|
<SingleProject>true</SingleProject>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
|
||||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
|
||||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
|
||||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">29.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">31.0</SupportedOSPlatformVersion>
|
||||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
|
||||||
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
|
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
|
||||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MessagePack" Version="2.5.187" />
|
<PackageReference Include="MessagePack" Version="3.1.4" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.8" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="8.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="9.0.8" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="AyCode.Core">
|
<Reference Include="AyCode.Core">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Core.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Entities">
|
<Reference Include="AyCode.Entities">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Entities.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Entities.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Interfaces">
|
<Reference Include="AyCode.Interfaces">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Interfaces.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Interfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Models">
|
<Reference Include="AyCode.Models">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Models.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Models.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Services">
|
<Reference Include="AyCode.Services">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Services.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Services.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AyCode.Utils">
|
<Reference Include="AyCode.Utils">
|
||||||
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Utils.dll</HintPath>
|
<HintPath>..\..\AyCode.Core\AyCode.Services.Server\bin\TIAM\Debug\net9.0\AyCode.Utils.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Update="Microsoft.AspNetCore.Components.WebView.Maui" Version="9.0.100" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Update="Microsoft.Maui.Controls" Version="9.0.100" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue