Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
7c557e2
Basic E2E test
dariatiurina Dec 10, 2025
8f21417
First simple implementation that holds values no matter what
dariatiurina Dec 10, 2025
43608b0
Made TempData connected to the HttpContext and improved TempData
dariatiurina Dec 11, 2025
5612308
Fixed E2E test to be SSR
dariatiurina Dec 11, 2025
c73f370
Add for manual testing
dariatiurina Dec 11, 2025
9948bcd
Added new E2E tests
dariatiurina Dec 12, 2025
edb2244
Merge branch 'main' into 49683-tempdata
dariatiurina Dec 12, 2025
a9385a6
Merge branch '49683-tempdata' of https://github.com/dariatiurina/aspn…
dariatiurina Dec 12, 2025
9869aa7
Added XML comment
dariatiurina Dec 12, 2025
d93d266
Added new tests
dariatiurina Dec 15, 2025
7630764
Added inheritance from IDictionary
dariatiurina Dec 15, 2025
8b5bbe2
Added IDataProtector to TempDataService
dariatiurina Dec 15, 2025
1d2fc6d
Fix + Enumerator
dariatiurina Dec 15, 2025
31ead26
Fix + unit tests
dariatiurina Dec 15, 2025
68f401d
Merge branch 'main' into 49683-tempdata
dariatiurina Dec 15, 2025
21a3c3b
Fix
dariatiurina Dec 16, 2025
7b50676
TempDataTest
dariatiurina Dec 16, 2025
ecebef8
Fix
dariatiurina Dec 16, 2025
6002ab1
Clean-up
dariatiurina Dec 16, 2025
902cdc9
Add limit for encoded value
dariatiurina Dec 16, 2025
eff02b6
Small decoupling
dariatiurina Dec 17, 2025
1f23e69
Moved to Endpoints
dariatiurina Dec 18, 2025
98ece70
Lazy loading
dariatiurina Dec 18, 2025
bfcace9
Added ITempDataProvider and CookieTempDataProvider
dariatiurina Dec 23, 2025
e5e26c6
Fixed visibility modifiers for TempData and CookieTempDataProvider
dariatiurina Dec 23, 2025
5817356
Decoupling and small fix
dariatiurina Dec 23, 2025
677c014
Update serializer
dariatiurina Dec 23, 2025
c5b0365
Fixes
dariatiurina Dec 23, 2025
8f91662
Fix
dariatiurina Dec 23, 2025
968a345
Fixed lazy loading in TempData
dariatiurina Dec 29, 2025
fab6474
Added options to the ServiceExtensions for Cookie TempData
dariatiurina Dec 29, 2025
0e36b05
Added CookieChunkingManager
dariatiurina Dec 29, 2025
5789c74
Clean-up
dariatiurina Dec 30, 2025
90d1a91
Fix serializer
dariatiurina Dec 30, 2025
03fbc76
Added SessionStorageTempDataProvider
dariatiurina Jan 2, 2026
082a035
Minor fixes
dariatiurina Jan 2, 2026
10fd4d9
Feedback
dariatiurina Jan 12, 2026
077baae
Some small improvements
dariatiurina Jan 12, 2026
12a538d
Changed options
dariatiurina Jan 14, 2026
533f1d4
Made ITempDataProvider internal
dariatiurina Jan 15, 2026
77aa240
Made loadFunc non nullable in the constructor
dariatiurina Jan 15, 2026
90310c4
fix
dariatiurina Jan 15, 2026
4ecd5ed
Changed JsonTempDataSerializer
dariatiurina Jan 16, 2026
c95e54c
fix
dariatiurina Jan 16, 2026
fb958f8
Change naming for test component
dariatiurina Jan 19, 2026
e5bc396
Changed AddTempData
dariatiurina Jan 19, 2026
eb5a42e
Changed RazorComponentsServiceCollectionExtensions
dariatiurina Jan 19, 2026
dd473d7
Changed to internal
dariatiurina Jan 21, 2026
c0e729b
Feedback
dariatiurina Feb 2, 2026
a0d0dff
Fix
dariatiurina Feb 2, 2026
c146364
[SupplyParameterFromTempData] and tests for it
dariatiurina Feb 2, 2026
5ecedf6
Merge branch 'main' into 49683-supply-parameter-from-tempdata
dariatiurina Feb 3, 2026
2063a75
E2E test and fixes
dariatiurina Feb 3, 2026
7f25222
Merge branch '49683-supply-parameter-from-tempdata' of https://github…
dariatiurina Feb 3, 2026
2f301f4
Feedback
dariatiurina Feb 6, 2026
ffb0962
Added usage of the existing reflection
dariatiurina Feb 9, 2026
61df8be
Feedback
dariatiurina Feb 9, 2026
a7596b1
Update src/Components/Components/src/SupplyParameterFromTempDataAttri…
dariatiurina Feb 9, 2026
326b38e
Update src/Components/test/E2ETest/Tests/TempDataCookieTest.cs
dariatiurina Feb 9, 2026
23a2437
Update src/Components/test/E2ETest/Tests/TempDataSessionStorageTest.cs
dariatiurina Feb 9, 2026
e4576ae
Update src/Components/test/E2ETest/Tests/TempDataCookieTest.cs
dariatiurina Feb 9, 2026
6503334
Update src/Components/test/testassets/Components.TestServer/RazorComp…
dariatiurina Feb 9, 2026
c7181e3
Update src/Components/Endpoints/src/TempData/ITempDataValueMapper.cs
dariatiurina Feb 9, 2026
e542502
Update src/Components/test/E2ETest/Tests/TempDataSessionStorageTest.cs
dariatiurina Feb 9, 2026
ef55229
Fix
dariatiurina Feb 11, 2026
f755d97
Fixed namespace
dariatiurina Feb 11, 2026
fef2126
Changed layering
dariatiurina Feb 13, 2026
269272e
Fix
dariatiurina Feb 13, 2026
5284b0f
Changed the design
dariatiurina Mar 5, 2026
43bf05e
Fixed the "duplicate implementation types" error
dariatiurina Mar 12, 2026
68113d2
Merge branch 'main' into 49683-supply-parameter-from-tempdata
dariatiurina Mar 12, 2026
d4ca5ac
Addressing feedback
dariatiurina Mar 18, 2026
47aa7a7
Merge branch '49683-supply-parameter-from-tempdata' of https://github…
dariatiurina Mar 18, 2026
849c7b2
Merge branch 'main' into 49683-supply-parameter-from-tempdata
dariatiurina Apr 16, 2026
27dbe93
Feedback
dariatiurina Apr 17, 2026
cca4f91
Fix
dariatiurina Apr 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/Components/Components/src/CascadingParameterSubscription.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Microsoft.AspNetCore.Components;

/// <summary>
/// This class represents an active subscription to a cascading parameter. The implementation is responsible for providing the current value and notifying about changes by causing the subscriber component to re-render when necessary.
/// </summary>
public abstract class CascadingParameterSubscription : IDisposable
{
/// <summary>
/// Function that returns the current value for the subscription.
/// </summary>
public abstract object? GetCurrentValue();

/// <inheritdoc/>
public abstract void Dispose();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.AspNetCore.Components.Infrastructure;
using Microsoft.AspNetCore.Components.Rendering;

namespace Microsoft.AspNetCore.Components;

internal class CascadingParameterValueProvider<TAttribute> : ICascadingValueSupplier
where TAttribute : CascadingParameterAttributeBase
{
private readonly Dictionary<ComponentSubscriptionKey, CascadingParameterSubscription> _subscriptions = new();
private readonly Func<ComponentState, TAttribute, CascadingParameterInfo, CascadingParameterSubscription> _subscribeFactory;

public CascadingParameterValueProvider(Func<ComponentState, TAttribute, CascadingParameterInfo, CascadingParameterSubscription> subscribeFactory)
{
_subscribeFactory = subscribeFactory;
}

public bool IsFixed => false;

public bool CanSupplyValue(in CascadingParameterInfo parameterInfo)
=> parameterInfo.Attribute is TAttribute;

public object? GetCurrentValue(object? key, in CascadingParameterInfo parameterInfo)
{
var subscriptionKey = new ComponentSubscriptionKey((ComponentState)key!, parameterInfo.PropertyName);
if (_subscriptions.TryGetValue(subscriptionKey, out var subscription))
{
return subscription.GetCurrentValue();
}
return null;
}

public void Subscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo)
{
var key = new ComponentSubscriptionKey(subscriber, parameterInfo.PropertyName);
_subscriptions[key] = _subscribeFactory(subscriber, (TAttribute)parameterInfo.Attribute, parameterInfo);
}

public void Unsubscribe(ComponentState subscriber, in CascadingParameterInfo parameterInfo)
{
var key = new ComponentSubscriptionKey(subscriber, parameterInfo.PropertyName);
if (_subscriptions.Remove(key, out var subscription))
{
subscription.Dispose();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Rendering;
using Microsoft.Extensions.DependencyInjection.Extensions;

namespace Microsoft.Extensions.DependencyInjection;
Expand Down Expand Up @@ -52,6 +53,24 @@ public static IServiceCollection AddCascadingValue<TValue>(
this IServiceCollection serviceCollection, Func<IServiceProvider, CascadingValueSource<TValue>> sourceFactory)
=> serviceCollection.AddScoped<ICascadingValueSupplier>(sourceFactory);

/// <summary>
/// Adds a cascading value supplier to the <paramref name="serviceCollection"/>. This allows supplying cascading values based on custom attributes, which can be used to support multiple cascading values of the same type with different matching criteria.
/// </summary>
/// <typeparam name="TAttribute">The attribute type.</typeparam>
/// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param>
/// <param name="subscribeFactory">A callback that supplies a <see cref="CascadingParameterSubscription"/> that handles subscriptions for attribute.</param>
/// <returns>The <see cref="IServiceCollection"/>.</returns>
public static IServiceCollection TryAddCascadingValueSupplier<TAttribute>(
this IServiceCollection serviceCollection,
Func<IServiceProvider, Func<ComponentState, TAttribute, CascadingParameterInfo, CascadingParameterSubscription>> subscribeFactory)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a public API and a top-level IServiceCollection extension that uses ComponentState in its signature. While ComponentState is also public, it is in the Rendering namespace and is explicitly documented as being an internal implementation detail of Renderer. Is that intentional? (@javiercn)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's a trade-off between this and having to put TempData and all other similar concepts in Components. The main consumers for this are other libraries on the stack, and while I don't love it. The alternative of having to put the attribute on a core assembly and a bunch of the infrastructure there, is worse.

The key tension here is that hosts, lack the ability to define their own host specific cascading values that aren't top level (AddCascadingValue exists, but it's a single value (like we do for HttpContext))

We can review what we use componentstate for (we use it as a key) and consider doing something else (like wrapping it into a struct and call it something like StateKey) but I don't think we get much out of it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The tradeoff is what we do in persistent component state and what we would need to also do in SupplyParameterFromSession, so we will end up with N host specific method registrations in the core assembly. With this approach, the hosts can register them in their setups using this common method.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sounds reasonable. Thanks for the explanation 👍

where TAttribute : CascadingParameterAttributeBase
{
serviceCollection.TryAddEnumerable(
ServiceDescriptor.Scoped<ICascadingValueSupplier, CascadingParameterValueProvider<TAttribute>>(
sp => new CascadingParameterValueProvider<TAttribute>(subscribeFactory(sp))));
return serviceCollection;
}

/// <summary>
/// Adds a cascading value to the <paramref name="serviceCollection"/>, if none is already registered
/// with the value type. This is equivalent to having a fixed <see cref="CascadingValue{TValue}"/> at
Expand Down Expand Up @@ -91,7 +110,7 @@ public static void TryAddCascadingValue<TValue>(
/// Adds a cascading value to the <paramref name="serviceCollection"/>, if none is already registered
/// with the value type. This is equivalent to having a fixed <see cref="CascadingValue{TValue}"/> at
/// the root of the component hierarchy.
///
///
/// With this overload, you can supply a <see cref="CascadingValueSource{TValue}"/> which allows you
/// to notify about updates to the value later, causing recipients to re-render. This overload should
/// only be used if you plan to update the value dynamically.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<Compile Include="$(ComponentsSharedSourceRoot)src\JsonSerializerOptionsProvider.cs" />
<Compile Include="$(ComponentsSharedSourceRoot)src\HotReloadManager.cs" LinkBase="HotReload" />
<Compile Include="$(ComponentsSharedSourceRoot)src\RootTypeCache.cs" LinkBase="Shared" />
<Compile Include="$(ComponentsSharedSourceRoot)src\Reflection\PropertyGetter.cs" LinkBase="Shared" />
<Compile Include="$(ComponentsSharedSourceRoot)src\Reflection\PropertySetter.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)LinkerFlags.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)PooledArrayBufferWriter.cs" LinkBase="Shared" />
<Compile Include="$(SharedSourceRoot)QueryStringEnumerable.cs" LinkBase="Shared" />
Expand Down
5 changes: 5 additions & 0 deletions src/Components/Components/src/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#nullable enable
abstract Microsoft.AspNetCore.Components.CascadingParameterSubscription.Dispose() -> void
abstract Microsoft.AspNetCore.Components.CascadingParameterSubscription.GetCurrentValue() -> object?
Microsoft.AspNetCore.Components.CascadingParameterSubscription
Microsoft.AspNetCore.Components.CascadingParameterSubscription.CascadingParameterSubscription() -> void
static Microsoft.AspNetCore.Components.NavigationManagerExtensions.GetUriWithHash(this Microsoft.AspNetCore.Components.NavigationManager! navigationManager, string! hash) -> string!
Microsoft.AspNetCore.Components.NavigationOptions.RelativeToCurrentUri.get -> bool
Microsoft.AspNetCore.Components.NavigationOptions.RelativeToCurrentUri.init -> void
Expand All @@ -7,6 +11,7 @@ Microsoft.AspNetCore.Components.IComponentPropertyActivator.GetActivator(System.
*REMOVED*Microsoft.AspNetCore.Components.ResourceAsset.ResourceAsset(string! url, System.Collections.Generic.IReadOnlyList<Microsoft.AspNetCore.Components.ResourceAssetProperty!>? properties) -> void
*REMOVED*Microsoft.AspNetCore.Components.Routing.Router.PreferExactMatches.get -> bool
*REMOVED*Microsoft.AspNetCore.Components.Routing.Router.PreferExactMatches.set -> void
static Microsoft.Extensions.DependencyInjection.CascadingValueServiceCollectionExtensions.TryAddCascadingValueSupplier<TAttribute>(this Microsoft.Extensions.DependencyInjection.IServiceCollection! serviceCollection, System.Func<System.IServiceProvider!, System.Func<Microsoft.AspNetCore.Components.Rendering.ComponentState!, TAttribute!, Microsoft.AspNetCore.Components.CascadingParameterInfo, Microsoft.AspNetCore.Components.CascadingParameterSubscription!>!>! subscribeFactory) -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
Microsoft.AspNetCore.Components.BrowserConfiguration
Microsoft.AspNetCore.Components.BrowserConfiguration.BrowserConfiguration() -> void
Microsoft.AspNetCore.Components.BrowserConfiguration.LogLevel.get -> int?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ public static IRazorComponentsBuilder AddRazorComponents(this IServiceCollection
services.TryAddCascadingValue(sp => sp.GetRequiredService<EndpointHtmlRenderer>().HttpContext);
services.TryAddScoped<ResourcePreloadService>();
services.AddTempData();
services.TryAddScoped<TempDataCascadingValueSupplier>();
services.TryAddCascadingValueSupplier<SupplyParameterFromTempDataAttribute>(
sp => sp.GetRequiredService<TempDataCascadingValueSupplier>().CreateSubscription);

services.TryAddScoped<ResourceCollectionProvider>();
RegisterPersistentComponentStateServiceCollectionExtensions.AddPersistentServiceRegistration<ResourceCollectionProvider>(services, RenderMode.InteractiveWebAssembly);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;

namespace Microsoft.AspNetCore.Components.Endpoints;

Expand All @@ -26,6 +27,11 @@ public TempData CreateEmpty(HttpContext httpContext)

public void Save(HttpContext httpContext, TempData tempData)
{
if (httpContext.RequestServices.GetService<TempDataCascadingValueSupplier>() is { } supplier)
{
supplier.PersistValues(tempData);
}

if (!tempData.WasLoaded)
{
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
<Compile Include="$(SharedSourceRoot)ChunkingCookieManager\**\*.cs" LinkBase="Internal" />
<Compile Include="$(SharedSourceRoot)Components\ComponentsActivityLinkStore.cs" LinkBase="Shared" />
<Compile Include="$(ComponentsSharedSourceRoot)src\HotReloadManager.cs" LinkBase="HotReload" />
<Compile Include="$(ComponentsSharedSourceRoot)src\Reflection\PropertyGetter.cs" />
<Compile Include="$(ComponentsSharedSourceRoot)src\Reflection\PropertySetter.cs" />

<Compile Include="$(SharedSourceRoot)PropertyHelper\**\*.cs" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ internal async Task InitializeStandardComponentServicesAsync(
antiforgery.SetRequestContext(httpContext);
}

if (httpContext.RequestServices.GetService<TempDataCascadingValueSupplier>() is {} tempDataSupplier)
{
tempDataSupplier.SetRequestContext(httpContext);
}

// It's important that this is initialized since a component might try to restore state during prerendering
// (which will obviously not work, but should not fail)
var componentApplicationLifetime = httpContext.RequestServices.GetRequiredService<ComponentStatePersistenceManager>();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Concurrent;
using System.Reflection;
using Microsoft.AspNetCore.Components.Reflection;
using Microsoft.AspNetCore.Components.Rendering;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;

namespace Microsoft.AspNetCore.Components.Endpoints;

internal partial class TempDataCascadingValueSupplier
{
private static readonly ConcurrentDictionary<(Type, string), PropertyGetter> _propertyGetterCache = new();
private HttpContext? _httpContext;
private readonly Dictionary<string, Func<object?>> _valueCallbacks = new(StringComparer.OrdinalIgnoreCase);
Comment thread
dariatiurina marked this conversation as resolved.
Resolved
private readonly ILogger<TempDataCascadingValueSupplier> _logger;

public TempDataCascadingValueSupplier(ILogger<TempDataCascadingValueSupplier> logger)
{
_logger = logger;
}

internal void SetRequestContext(HttpContext httpContext)
{
_httpContext = httpContext;
}

internal CascadingParameterSubscription CreateSubscription(
ComponentState componentState,
SupplyParameterFromTempDataAttribute attribute,
CascadingParameterInfo parameterInfo)
{
var tempDataKey = attribute.Name ?? parameterInfo.PropertyName;
var componentType = componentState.Component.GetType();
var getter = _propertyGetterCache.GetOrAdd((componentType, parameterInfo.PropertyName), PropertyGetterFactory);
Func<object?> valueGetter = () => getter.GetValue(componentState.Component);
RegisterValueCallback(tempDataKey, valueGetter);
return new TempDataSubscription(this, tempDataKey, parameterInfo.PropertyType, valueGetter);
}

private static PropertyGetter PropertyGetterFactory((Type type, string propertyName) key)
{
var (type, propertyName) = key;
var propertyInfo = type.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (propertyInfo is null)
{
throw new InvalidOperationException($"A property '{propertyName}' on component type '{type.FullName}' wasn't found.");
}
return new PropertyGetter(type, propertyInfo);
}

internal ITempData? GetTempData() => _httpContext is null
? null
: TempDataProviderServiceCollectionExtensions.GetOrCreateTempData(_httpContext);

internal void RegisterValueCallback(string tempDataKey, Func<object?> valueGetter)
{
if (!_valueCallbacks.TryAdd(tempDataKey, valueGetter))
{
throw new InvalidOperationException($"A callback is already registered for the TempData key '{tempDataKey}'. Multiple components cannot use the same TempData key for multiple [SupplyParameterFromTempData] attributes.");
}
}

internal void PersistValues(ITempData tempData)
{
if (_valueCallbacks.Count == 0)
{
return;
}

foreach (var (key, valueGetter) in _valueCallbacks)
{
object? value = null;
try
{
value = valueGetter();
}
catch (Exception ex)
{
Log.TempDataPersistFail(_logger, ex);
continue;
}
tempData[key] = value;
}
}

internal void DeleteValueCallback(string tempDataKey)
{
_valueCallbacks.Remove(tempDataKey);
}

private static partial class Log
{
[LoggerMessage(1, LogLevel.Warning, "Persisting of the TempData element failed.", EventName = "TempDataPersistFail")]
public static partial void TempDataPersistFail(ILogger logger, Exception exception);

[LoggerMessage(2, LogLevel.Warning, "Deserialization of the element from TempData failed.", EventName = "TempDataDeserializeFail")]
public static partial void TempDataDeserializeFail(ILogger logger, Exception exception);
}

internal partial class TempDataSubscription : CascadingParameterSubscription
{
private readonly TempDataCascadingValueSupplier _owner;
private readonly string _tempDataKey;
private readonly Type _underlyingType;
private readonly bool _isEnum;
private readonly Func<object?> _currentValueGetter;
private bool _delivered;

public TempDataSubscription(
TempDataCascadingValueSupplier owner,
string tempDataKey,
Type propertyType,
Func<object?> currentValueGetter)
{
_owner = owner;
_tempDataKey = tempDataKey;
_underlyingType = Nullable.GetUnderlyingType(propertyType) ?? propertyType;
_isEnum = _underlyingType.IsEnum;
_currentValueGetter = currentValueGetter;
}

public override object? GetCurrentValue()
{
if (_delivered)
{
// After the first delivery, return the component's current property value
// to avoid overriding modifications the component made during rendering.
return _currentValueGetter();
}

_delivered = true;

var tempData = _owner.GetTempData();
if (tempData is null)
{
return null;
}

try
{
var value = tempData.Get(_tempDataKey);
if (value is null)
{
return null;
}

if (_isEnum && value is int intValue)
{
return Enum.ToObject(_underlyingType, intValue);
}

if (!_underlyingType.IsAssignableFrom(value.GetType()))
{
return null;
}

return value;
}
catch (Exception ex)
{
Log.TempDataDeserializeFail(_owner._logger, ex);
return null;
}
}

public override void Dispose()
{
_owner.DeleteValueCallback(_tempDataKey);
}
}
}
Loading
Loading