Skip to content

Commit

Permalink
chore(deps): update dependency prism.forms to v9 (#1182)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency prism.forms to v9

* fix: match nullability of prism

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Glenn Watson <glenn@glennwatson.net>
  • Loading branch information
renovate[bot] and glennawatson authored Sep 3, 2024
1 parent bf34016 commit 6428c12
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<PackageVersion Include="Ninject" Version="3.3.6" />
<PackageVersion Include="NLog" Version="5.3.3" />
<PackageVersion Include="Prism.Core" Version="9.0.537" />
<PackageVersion Include="Prism.Forms" Version="8.1.97" />
<PackageVersion Include="Prism.Forms" Version="9.0.537" />
<PackageVersion Include="ReactiveUI" Version="20.1.1" />
<PackageVersion Include="Roslynator.Analyzers" Version="4.12.4" />
<PackageVersion Include="Serilog" Version="4.0.1" />
Expand Down
21 changes: 8 additions & 13 deletions src/Splat.Prism/SplatContainerExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ public void Dispose()
GC.SuppressFinalize(this);
}

/// <inheritdoc/>
public void FinalizeExtension()
{
}

/// <inheritdoc/>
public IContainerRegistry RegisterScoped(Type type, Func<IContainerProvider, object> factoryMethod) => throw new NotSupportedException();

Expand Down Expand Up @@ -208,28 +203,28 @@ public IContainerRegistry RegisterSingleton(Type from, Type to, string name)
public IContainerRegistry RegisterSingleton(Type type, Func<IContainerProvider, object> factoryMethod) => throw new NotSupportedException();

/// <inheritdoc/>
public object? Resolve(Type type) => Instance.GetService(type);
public object Resolve(Type type) => Instance.GetService(type) ?? throw new InvalidOperationException("Must be a valid value");

/// <inheritdoc/>
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1316:Tuple element names should use correct casing", Justification = "Defined by outside interface not in Splat")]
public object? Resolve(Type type, params (Type Type, object Instance)[] parameters) =>
_types.TryGetValue((type, null), out var resolvedType)
public object Resolve(Type type, params (Type Type, object Instance)[] parameters) =>
(_types.TryGetValue((type, null), out var resolvedType)
? Activator.CreateInstance(resolvedType, parameters.Select(x => x.Instance)) ?? throw new InvalidOperationException("Could not create type")
: default;
: default) ?? throw new InvalidOperationException("Must be a valid value");

/// <inheritdoc/>
public object? Resolve(Type type, string name) => Instance.GetService(type, name);
public object Resolve(Type type, string name) => Instance.GetService(type, name) ?? throw new InvalidOperationException("Must be a valid value");

/// <inheritdoc/>
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1316:Tuple element names should use correct casing", Justification = "Defined by outside interface not in Splat")]
public object? Resolve(Type type, string name, params (Type Type, object Instance)[] parameters) =>
!_types.TryGetValue((type, name), out var resolvedType)
public object Resolve(Type type, string name, params (Type Type, object Instance)[] parameters) =>
(!_types.TryGetValue((type, name), out var resolvedType)
? resolvedType switch
{
null => default,
_ => Activator.CreateInstance(resolvedType, parameters.Select(x => x.Instance))
}
: default;
: default) ?? throw new InvalidOperationException("Must be a valid value");

/// <summary>
/// Disposes data associated with the extension.
Expand Down

0 comments on commit 6428c12

Please sign in to comment.