From 20a3e55be6034ea03a173599b3a218b7f2a6b229 Mon Sep 17 00:00:00 2001 From: RonSijm Date: Wed, 28 Feb 2024 18:06:24 +0100 Subject: [PATCH] - Upgraded packages to support dotnet8 --- ...ncyInjectionAbstractionsForFramework.props | 13 +++ BuildSettings/NuGetVersioning.props | 7 ++ BuildSettings/SupportedFrameworks.props | 9 ++ BuildSettings/WebAssemblyForFramework.props | 13 +++ ...emo.Blazyload.WeatherLib4.Component.csproj | 4 +- ...ijm.Demo.Blazyload.WeatherLib4.Page.csproj | 4 +- .../App.razor | 8 +- .../Auth/DummyAuthHandler.cs | 2 +- .../Pages/AWSAuth.razor.cs | 2 +- ...m.Demo.Blazyload.CustomPathing.Host.csproj | 23 +++-- ...Blazyload.WeatherLibOptionalNotNull.csproj | 12 ++- ...mo.Blazyload.WeatherLibOptionalNull.csproj | 10 +- .../RonSijm.Demo.Blazyload.Host/App.razor | 12 +-- .../RonSijm.Demo.Blazyload.Host.csproj | 20 ++-- .../RonSijm.Demo.Blazyload.WeatherLib1.csproj | 11 ++- .../RonSijm.Demo.Blazyload.WeatherLib2.csproj | 4 +- .../RonSijm.Demo.Blazyload.WeatherLib3.csproj | 16 ++- README.md | 18 ++-- .../ClickAllMenuItemsTest.cs | 9 +- .../RonSijm.Demo.Blazyload.Host.Tests.csproj | 24 ++--- .../_Imports.razor | 2 - .../Features/Mode/ModeWrapper.cs | 97 +++++++++---------- .../RonSijm.Blazyload.Library.csproj | 18 +--- .../DIComponents/BlazyAssemblyLoader.cs | 2 +- .../Features/Options/Models/BlazyOptions.cs | 4 +- .../Properties/GlobalUsings.TypeAliases.cs | 2 +- .../RonSijm.Blazyload.csproj | 21 ++-- 27 files changed, 211 insertions(+), 156 deletions(-) create mode 100644 BuildSettings/DependencyInjectionAbstractionsForFramework.props create mode 100644 BuildSettings/NuGetVersioning.props create mode 100644 BuildSettings/SupportedFrameworks.props create mode 100644 BuildSettings/WebAssemblyForFramework.props diff --git a/BuildSettings/DependencyInjectionAbstractionsForFramework.props b/BuildSettings/DependencyInjectionAbstractionsForFramework.props new file mode 100644 index 0000000..7d53529 --- /dev/null +++ b/BuildSettings/DependencyInjectionAbstractionsForFramework.props @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/BuildSettings/NuGetVersioning.props b/BuildSettings/NuGetVersioning.props new file mode 100644 index 0000000..9b0658f --- /dev/null +++ b/BuildSettings/NuGetVersioning.props @@ -0,0 +1,7 @@ + + + Ron Sijm + Ron Sijm + 1.2.0 + + \ No newline at end of file diff --git a/BuildSettings/SupportedFrameworks.props b/BuildSettings/SupportedFrameworks.props new file mode 100644 index 0000000..40eff71 --- /dev/null +++ b/BuildSettings/SupportedFrameworks.props @@ -0,0 +1,9 @@ + + + preview + net6.0;net7.0;net8.0 + enable + Ron Sijm + Ron Sijm + + \ No newline at end of file diff --git a/BuildSettings/WebAssemblyForFramework.props b/BuildSettings/WebAssemblyForFramework.props new file mode 100644 index 0000000..4636d1a --- /dev/null +++ b/BuildSettings/WebAssemblyForFramework.props @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/Examples/Cascade/RonSijm.Demo.Blazyload.WeatherLib4.Component/RonSijm.Demo.Blazyload.WeatherLib4.Component.csproj b/Examples/Cascade/RonSijm.Demo.Blazyload.WeatherLib4.Component/RonSijm.Demo.Blazyload.WeatherLib4.Component.csproj index 2bef127..9b8633d 100644 --- a/Examples/Cascade/RonSijm.Demo.Blazyload.WeatherLib4.Component/RonSijm.Demo.Blazyload.WeatherLib4.Component.csproj +++ b/Examples/Cascade/RonSijm.Demo.Blazyload.WeatherLib4.Component/RonSijm.Demo.Blazyload.WeatherLib4.Component.csproj @@ -1,12 +1,12 @@  - net7.0 + net8.0 enable - + diff --git a/Examples/Cascade/RonSijm.Demo.Blazyload.WeatherLib4.Page/RonSijm.Demo.Blazyload.WeatherLib4.Page.csproj b/Examples/Cascade/RonSijm.Demo.Blazyload.WeatherLib4.Page/RonSijm.Demo.Blazyload.WeatherLib4.Page.csproj index f86094f..6c7c779 100644 --- a/Examples/Cascade/RonSijm.Demo.Blazyload.WeatherLib4.Page/RonSijm.Demo.Blazyload.WeatherLib4.Page.csproj +++ b/Examples/Cascade/RonSijm.Demo.Blazyload.WeatherLib4.Page/RonSijm.Demo.Blazyload.WeatherLib4.Page.csproj @@ -1,12 +1,12 @@  - net7.0 + net8.0 enable - + diff --git a/Examples/CustomPathing/RonSijm.Demo.Blazyload.CustomPathing.Host/App.razor b/Examples/CustomPathing/RonSijm.Demo.Blazyload.CustomPathing.Host/App.razor index 1e78a37..19a131e 100644 --- a/Examples/CustomPathing/RonSijm.Demo.Blazyload.CustomPathing.Host/App.razor +++ b/Examples/CustomPathing/RonSijm.Demo.Blazyload.CustomPathing.Host/App.razor @@ -35,20 +35,20 @@ { if (args.Path == "fetchdata1") { - var assemblies = await BlazyAssemblyLoader.LoadAssembliesAsync(new[] { "RonSijm.Demo.Blazyload.WeatherLib1.dll" }); + var assemblies = await BlazyAssemblyLoader.LoadAssembliesAsync(new[] { "RonSijm.Demo.Blazyload.WeatherLib1.wasm" }); _lazyLoadedAssemblies.AddRange(assemblies); } else if (args.Path == "fetchdata2") { - var assemblies = await BlazyAssemblyLoader.LoadAssembliesAsync(new[] { "RonSijm.Demo.Blazyload.WeatherLib2.dll" }); + var assemblies = await BlazyAssemblyLoader.LoadAssembliesAsync(new[] { "RonSijm.Demo.Blazyload.WeatherLib2.wasm" }); } else if (args.Path == "fetchdata3") { - var assemblies = await BlazyAssemblyLoader.LoadAssembliesAsync(new[] { "RonSijm.Demo.Blazyload.WeatherLib3.dll" }); + var assemblies = await BlazyAssemblyLoader.LoadAssembliesAsync(new[] { "RonSijm.Demo.Blazyload.WeatherLib3.wasm" }); } else if (args.Path == "fetchdata4") { - var assemblies = await BlazyAssemblyLoader.LoadAssembliesAsync(new[] { "RonSijm.Demo.Blazyload.WeatherLib4.Page.dll" }); + var assemblies = await BlazyAssemblyLoader.LoadAssembliesAsync(new[] { "RonSijm.Demo.Blazyload.WeatherLib4.Page.wasm" }); } } catch (Exception) diff --git a/Examples/CustomPathing/RonSijm.Demo.Blazyload.CustomPathing.Host/Auth/DummyAuthHandler.cs b/Examples/CustomPathing/RonSijm.Demo.Blazyload.CustomPathing.Host/Auth/DummyAuthHandler.cs index a1b695e..b9b9360 100644 --- a/Examples/CustomPathing/RonSijm.Demo.Blazyload.CustomPathing.Host/Auth/DummyAuthHandler.cs +++ b/Examples/CustomPathing/RonSijm.Demo.Blazyload.CustomPathing.Host/Auth/DummyAuthHandler.cs @@ -4,7 +4,7 @@ public class DummyAuthHandler { public bool HandleAuth(string assembly, HttpRequestMessage httpMessage, BlazyAssemblyOptions assemblyOptions) { - if (assembly == "RonSijm.Demo.Blazyload.WeatherLib2.dll") + if (assembly == "RonSijm.Demo.Blazyload.WeatherLib2.wasm") { httpMessage.Headers.Add("authorization", "Bearer eyJhb-mock-auth-header"); if (httpMessage.RequestUri != null) diff --git a/Examples/CustomPathing/RonSijm.Demo.Blazyload.CustomPathing.Host/Pages/AWSAuth.razor.cs b/Examples/CustomPathing/RonSijm.Demo.Blazyload.CustomPathing.Host/Pages/AWSAuth.razor.cs index e08380c..e0991d5 100644 --- a/Examples/CustomPathing/RonSijm.Demo.Blazyload.CustomPathing.Host/Pages/AWSAuth.razor.cs +++ b/Examples/CustomPathing/RonSijm.Demo.Blazyload.CustomPathing.Host/Pages/AWSAuth.razor.cs @@ -27,7 +27,7 @@ protected async Task HandleSubmitAndLoad() if (Model != null) { AWSAuthHandler.SetCredentials(Model.BucketUrl, Model.AccessKey, Model.SecretKey); - await BlazyAssemblyLoader.LoadAssemblyAsync("RonSijm.Demo.Blazyload.WeatherLib3.dll"); + await BlazyAssemblyLoader.LoadAssemblyAsync("RonSijm.Demo.Blazyload.WeatherLib3.wasm"); ButtonColor = "btn-success"; } } diff --git a/Examples/CustomPathing/RonSijm.Demo.Blazyload.CustomPathing.Host/RonSijm.Demo.Blazyload.CustomPathing.Host.csproj b/Examples/CustomPathing/RonSijm.Demo.Blazyload.CustomPathing.Host/RonSijm.Demo.Blazyload.CustomPathing.Host.csproj index 42d6e6b..3ffec19 100644 --- a/Examples/CustomPathing/RonSijm.Demo.Blazyload.CustomPathing.Host/RonSijm.Demo.Blazyload.CustomPathing.Host.csproj +++ b/Examples/CustomPathing/RonSijm.Demo.Blazyload.CustomPathing.Host/RonSijm.Demo.Blazyload.CustomPathing.Host.csproj @@ -1,24 +1,24 @@  - net7.0 + net8.0 enable - - + + - - - - - + + + + + @@ -39,7 +39,12 @@ - + + + + + + diff --git a/Examples/Optional/RonSijm.Demo.Blazyload.WeatherLibOptionalNotNull/RonSijm.Demo.Blazyload.WeatherLibOptionalNotNull.csproj b/Examples/Optional/RonSijm.Demo.Blazyload.WeatherLibOptionalNotNull/RonSijm.Demo.Blazyload.WeatherLibOptionalNotNull.csproj index bdc7d5d..5ce26ad 100644 --- a/Examples/Optional/RonSijm.Demo.Blazyload.WeatherLibOptionalNotNull/RonSijm.Demo.Blazyload.WeatherLibOptionalNotNull.csproj +++ b/Examples/Optional/RonSijm.Demo.Blazyload.WeatherLibOptionalNotNull/RonSijm.Demo.Blazyload.WeatherLibOptionalNotNull.csproj @@ -1,16 +1,24 @@  - net7.0 + net8.0 enable - + + + + + + + + + diff --git a/Examples/Optional/RonSijm.Demo.Blazyload.WeatherLibOptionalNull/RonSijm.Demo.Blazyload.WeatherLibOptionalNull.csproj b/Examples/Optional/RonSijm.Demo.Blazyload.WeatherLibOptionalNull/RonSijm.Demo.Blazyload.WeatherLibOptionalNull.csproj index bdc7d5d..2d69a52 100644 --- a/Examples/Optional/RonSijm.Demo.Blazyload.WeatherLibOptionalNull/RonSijm.Demo.Blazyload.WeatherLibOptionalNull.csproj +++ b/Examples/Optional/RonSijm.Demo.Blazyload.WeatherLibOptionalNull/RonSijm.Demo.Blazyload.WeatherLibOptionalNull.csproj @@ -1,15 +1,19 @@  - net7.0 + net8.0 enable - + - + + + + + diff --git a/Examples/RonSijm.Demo.Blazyload.Host/App.razor b/Examples/RonSijm.Demo.Blazyload.Host/App.razor index 8afa3c9..7aec753 100644 --- a/Examples/RonSijm.Demo.Blazyload.Host/App.razor +++ b/Examples/RonSijm.Demo.Blazyload.Host/App.razor @@ -23,32 +23,32 @@ { if (args.Path == "fetchdata1") { - var assemblies = await BlazyAssemblyLoader.LoadAssemblyAsync("RonSijm.Demo.Blazyload.WeatherLib1.dll"); + var assemblies = await BlazyAssemblyLoader.LoadAssemblyAsync("RonSijm.Demo.Blazyload.WeatherLib1.wasm"); _lazyLoadedAssemblies.AddRange(assemblies); } else if (args.Path == "fetchdata2") { - var assemblies = await BlazyAssemblyLoader.LoadAssemblyAsync("RonSijm.Demo.Blazyload.WeatherLib2.dll"); + var assemblies = await BlazyAssemblyLoader.LoadAssemblyAsync("RonSijm.Demo.Blazyload.WeatherLib2.wasm"); _lazyLoadedAssemblies.AddRange(assemblies); } else if (args.Path == "fetchdata3") { - var assemblies = await BlazyAssemblyLoader.LoadAssemblyAsync("RonSijm.Demo.Blazyload.WeatherLib3.dll"); + var assemblies = await BlazyAssemblyLoader.LoadAssemblyAsync("RonSijm.Demo.Blazyload.WeatherLib3.wasm"); _lazyLoadedAssemblies.AddRange(assemblies); } else if (args.Path == "fetchdata4") { - var assemblies = await BlazyAssemblyLoader.LoadAssemblyAsync("RonSijm.Demo.Blazyload.WeatherLib4.Page.dll"); + var assemblies = await BlazyAssemblyLoader.LoadAssemblyAsync("RonSijm.Demo.Blazyload.WeatherLib4.Page.wasm"); _lazyLoadedAssemblies.AddRange(assemblies); } else if (args.Path == "fetchdataOptionalNull") { - var assemblies = await BlazyAssemblyLoader.LoadAssemblyAsync("RonSijm.Demo.Blazyload.WeatherLibOptionalNull.dll"); + var assemblies = await BlazyAssemblyLoader.LoadAssemblyAsync("RonSijm.Demo.Blazyload.WeatherLibOptionalNull.wasm"); _lazyLoadedAssemblies.AddRange(assemblies); } else if (args.Path == "fetchdataOptionalNotNull") { - var assemblies = await BlazyAssemblyLoader.LoadAssemblyAsync("RonSijm.Demo.Blazyload.WeatherLibOptionalNotNull.dll"); + var assemblies = await BlazyAssemblyLoader.LoadAssemblyAsync("RonSijm.Demo.Blazyload.WeatherLibOptionalNotNull.wasm"); _lazyLoadedAssemblies.AddRange(assemblies); } } diff --git a/Examples/RonSijm.Demo.Blazyload.Host/RonSijm.Demo.Blazyload.Host.csproj b/Examples/RonSijm.Demo.Blazyload.Host/RonSijm.Demo.Blazyload.Host.csproj index 7140b15..ee7525c 100644 --- a/Examples/RonSijm.Demo.Blazyload.Host/RonSijm.Demo.Blazyload.Host.csproj +++ b/Examples/RonSijm.Demo.Blazyload.Host/RonSijm.Demo.Blazyload.Host.csproj @@ -1,23 +1,23 @@  - net7.0 + net8.0 enable - - + + - - - - - - - + + + + + + + diff --git a/Examples/RonSijm.Demo.Blazyload.WeatherLib1/RonSijm.Demo.Blazyload.WeatherLib1.csproj b/Examples/RonSijm.Demo.Blazyload.WeatherLib1/RonSijm.Demo.Blazyload.WeatherLib1.csproj index 81c667a..e2ccb75 100644 --- a/Examples/RonSijm.Demo.Blazyload.WeatherLib1/RonSijm.Demo.Blazyload.WeatherLib1.csproj +++ b/Examples/RonSijm.Demo.Blazyload.WeatherLib1/RonSijm.Demo.Blazyload.WeatherLib1.csproj @@ -1,15 +1,20 @@  - net7.0 + net8.0 enable - + - + + + + + + diff --git a/Examples/RonSijm.Demo.Blazyload.WeatherLib2/RonSijm.Demo.Blazyload.WeatherLib2.csproj b/Examples/RonSijm.Demo.Blazyload.WeatherLib2/RonSijm.Demo.Blazyload.WeatherLib2.csproj index 2bef127..9b8633d 100644 --- a/Examples/RonSijm.Demo.Blazyload.WeatherLib2/RonSijm.Demo.Blazyload.WeatherLib2.csproj +++ b/Examples/RonSijm.Demo.Blazyload.WeatherLib2/RonSijm.Demo.Blazyload.WeatherLib2.csproj @@ -1,12 +1,12 @@  - net7.0 + net8.0 enable - + diff --git a/Examples/RonSijm.Demo.Blazyload.WeatherLib3/RonSijm.Demo.Blazyload.WeatherLib3.csproj b/Examples/RonSijm.Demo.Blazyload.WeatherLib3/RonSijm.Demo.Blazyload.WeatherLib3.csproj index c7b0929..e5d510b 100644 --- a/Examples/RonSijm.Demo.Blazyload.WeatherLib3/RonSijm.Demo.Blazyload.WeatherLib3.csproj +++ b/Examples/RonSijm.Demo.Blazyload.WeatherLib3/RonSijm.Demo.Blazyload.WeatherLib3.csproj @@ -1,16 +1,26 @@  - net7.0 + net8.0 enable - + - + + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index e28fbc1..723e1e3 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,8 @@ Here is a picture to better explain the purpose: lazy-loading -In this example you have the main project, `"Host"` - which has a router which lazy-loads the `Weatherlib.dll` project, when the `/fetchdata/` page is visited. -However, the FetchData requires a dependency `IWeatherResolver` that's also in the same `Weatherlib.dll` project. With default Blazor this will throw an exception, and it's not possible to lazy-load classes from dependencies +In this example you have the main project, `"Host"` - which has a router which lazy-loads the `Weatherlib.wasm` project, when the `/fetchdata/` page is visited. +However, the FetchData requires a dependency `IWeatherResolver` that's also in the same `Weatherlib.wasm` project. With default Blazor this will throw an exception, and it's not possible to lazy-load classes from dependencies This article by Peter Himschoot describes the same problem that this library is trying to solve: https://blogs.u2u.be/peter/post/blazor-lazy-loading-and-dependency-injection @@ -181,8 +181,8 @@ Here is a picture to demonstrate an example: lazy-cascaded -In this example you have the main project `"Host"` - has a router which lazy-loads the `Weatherlib.Page.dll` project, when the /fetchdata/ page is visited. -The fetchData page requires a `IWeatherResolver`, which in turn is in the `WeatherLib4.Component.dll` +In this example you have the main project `"Host"` - has a router which lazy-loads the `Weatherlib.Page.wasm` project, when the /fetchdata/ page is visited. +The fetchData page requires a `IWeatherResolver`, which in turn is in the `WeatherLib4.Component.wasm` With default Blazor this setup would not be possible. @@ -218,7 +218,7 @@ builder.ConfigureContainer(new BlazyServiceProviderFactory(x => { if (args.Path == "fetchdata1") { - var assemblies = await BlazyAssemblyLoader.LoadAssembliesAsync(new[] { "RonSijm.Demo.Blazyload.WeatherLib1.dll" }); + var assemblies = await BlazyAssemblyLoader.LoadAssembliesAsync(new[] { "RonSijm.Demo.Blazyload.WeatherLib1.wasm" }); _lazyLoadedAssemblies.AddRange(assemblies); } } @@ -260,7 +260,7 @@ Then you don't need the ` _lazyLoadedAssemblies.AddRange(assemblies);` line anym - [ ] Figure how to have something like an so that we can load components based on whether or not a dll is loaded - [ ] Possibly make a Roslyn Analyzer that compile time checks if your config is remotely correct - [ ] Add a LazyLoad background qeueue, because there's no point to wait until a user clicks something, and then start loading dlls. If the app is somewhat idle, we can load dlls in the background - - [ ] Option to load the .dll.gz version, or to HEAD call to see what exists, and load the .dll.gz version if available. Either though options or something. HEAD call might give more overhead than just yolo calling dlls + - [ ] Option to load the .wasm.gz version, or to HEAD call to see what exists, and load the .wasm.gz version if available. Either though options or something. HEAD call might give more overhead than just yolo calling dlls ## TODOS before V1.x+: @@ -280,4 +280,8 @@ Submit a PR with a bugfix + a unit-test that is red in the current version but g Start a discussion to ask if the feature fits and if it's "up for grabs". If so you can build the feature ## Contact and questions: -I've created a Discord, though now it's just me, lol.. https://discord.gg/cDC6VkUn2X - but you can ask stuff here \ No newline at end of file +I've created a Discord, though now it's just me, lol.. https://discord.gg/cDC6VkUn2X - but you can ask stuff here + +## Breaking changes in dotnet8 (By Blazor): +Instead of referencing your libraries as .dll, they now have a .wasm extension. +See: https://github.com/dotnet/runtime/issues/92965#issuecomment-1746340200 \ No newline at end of file diff --git a/Tests/RonSijm.Demo.Blazyload.Host.Tests/ClickAllMenuItemsTest.cs b/Tests/RonSijm.Demo.Blazyload.Host.Tests/ClickAllMenuItemsTest.cs index 66d85d3..f7d2dfc 100644 --- a/Tests/RonSijm.Demo.Blazyload.Host.Tests/ClickAllMenuItemsTest.cs +++ b/Tests/RonSijm.Demo.Blazyload.Host.Tests/ClickAllMenuItemsTest.cs @@ -1,11 +1,18 @@ using System.Linq; using System.Threading.Tasks; + +using Bunit; + using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; +using Microsoft.Extensions.DependencyInjection; + using RonSijm.Blazyload.Features.DIComponents; using RonSijm.Blazyload.Features.Options.Models; using RonSijm.Demo.Blazyload.Host.Client; +using Xunit; + namespace RonSijm.Demo.Blazyload.Host.Tests; public class ClickAllMenuItemsTest : TestContext @@ -21,7 +28,7 @@ public async Task ClickAllMenuItems() var options = new BlazyOptions(); Program.BlazyConfig(options); - var serviceProviderFactory = new BlazyServiceProviderFactory(options, Services); + var serviceProviderFactory = new BlazyServiceProviderFactory(options); var serviceBuilder = serviceProviderFactory.CreateBuilder(Services); var serviceProvider = serviceProviderFactory.CreateServiceProvider(serviceBuilder); diff --git a/Tests/RonSijm.Demo.Blazyload.Host.Tests/RonSijm.Demo.Blazyload.Host.Tests.csproj b/Tests/RonSijm.Demo.Blazyload.Host.Tests/RonSijm.Demo.Blazyload.Host.Tests.csproj index d525866..9bc6856 100644 --- a/Tests/RonSijm.Demo.Blazyload.Host.Tests/RonSijm.Demo.Blazyload.Host.Tests.csproj +++ b/Tests/RonSijm.Demo.Blazyload.Host.Tests/RonSijm.Demo.Blazyload.Host.Tests.csproj @@ -1,39 +1,27 @@  - net7.0 + net8.0 enable false - - - - + - - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - + + - - - - - \ No newline at end of file diff --git a/Tests/RonSijm.Demo.Blazyload.Host.Tests/_Imports.razor b/Tests/RonSijm.Demo.Blazyload.Host.Tests/_Imports.razor index fc11535..101ad5a 100644 --- a/Tests/RonSijm.Demo.Blazyload.Host.Tests/_Imports.razor +++ b/Tests/RonSijm.Demo.Blazyload.Host.Tests/_Imports.razor @@ -1,6 +1,4 @@ @using Microsoft.AspNetCore.Components.Web @using Microsoft.JSInterop @using Microsoft.Extensions.DependencyInjection -@using Appical.IC.Frontend.Tests.UI.Bunit -@using Appical.IC.Frontend.Tests.UI.Bunit.TestDoubles @using Xunit diff --git a/src/RonSijm.Blazyload.Library/Features/Mode/ModeWrapper.cs b/src/RonSijm.Blazyload.Library/Features/Mode/ModeWrapper.cs index 03eac97..6ea65ec 100644 --- a/src/RonSijm.Blazyload.Library/Features/Mode/ModeWrapper.cs +++ b/src/RonSijm.Blazyload.Library/Features/Mode/ModeWrapper.cs @@ -1,72 +1,71 @@ -namespace RonSijm.Blazyload.Library.Features.Mode +namespace RonSijm.Blazyload.Library.Features.Mode; + +public abstract class ModeWrapper where T : class { - public abstract class ModeWrapper where T : class + protected bool Equals(ModeWrapper other) { - protected bool Equals(ModeWrapper other) - { - return EqualityComparer.Default.Equals(Value, other.Value); - } + return EqualityComparer.Default.Equals(Value, other.Value); + } - public override bool Equals(object obj) + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) { - if (ReferenceEquals(null, obj)) - { - return false; - } - - if (ReferenceEquals(this, obj)) - { - return true; - } - - if (obj.GetType() != GetType()) - { - return false; - } - - return Equals((ModeWrapper)obj); + return false; } - public override int GetHashCode() + if (ReferenceEquals(this, obj)) { - // ReSharper disable once NonReadonlyMemberInGetHashCode - return EqualityComparer.Default.GetHashCode(Value); + return true; } - public T Value { get; private set; } - - // ReSharper disable once UnusedMember.Global - internal void SetValue(object value) + if (obj.GetType() != GetType()) { - Value = value as T; + return false; } - public static bool operator ==(ModeWrapper obj1, ModeWrapper obj2) - { - var firstNull = (object)obj1 == null || obj1.Value == null; - var secondNull = (object)obj2 == null || obj2.Value == null; + return Equals((ModeWrapper)obj); + } - if (firstNull && secondNull) - { - return true; - } + public override int GetHashCode() + { + // ReSharper disable once NonReadonlyMemberInGetHashCode + return EqualityComparer.Default.GetHashCode(Value); + } - if (firstNull || secondNull) - { - return false; - } + public T Value { get; private set; } - return obj1.Value.Equals(obj2.Value); - } + // ReSharper disable once UnusedMember.Global + internal void SetValue(object value) + { + Value = value as T; + } - public static bool operator !=(ModeWrapper obj1, ModeWrapper obj2) + public static bool operator ==(ModeWrapper obj1, ModeWrapper obj2) + { + var firstNull = (object)obj1 == null || obj1.Value == null; + var secondNull = (object)obj2 == null || obj2.Value == null; + + if (firstNull && secondNull) { - return !(obj1 == obj2); + return true; } - public static implicit operator T(ModeWrapper input) + if (firstNull || secondNull) { - return input.Value; + return false; } + + return obj1.Value.Equals(obj2.Value); + } + + public static bool operator !=(ModeWrapper obj1, ModeWrapper obj2) + { + return !(obj1 == obj2); + } + + public static implicit operator T(ModeWrapper input) + { + return input.Value; } } \ No newline at end of file diff --git a/src/RonSijm.Blazyload.Library/RonSijm.Blazyload.Library.csproj b/src/RonSijm.Blazyload.Library/RonSijm.Blazyload.Library.csproj index cb94d5e..e9b8d6a 100644 --- a/src/RonSijm.Blazyload.Library/RonSijm.Blazyload.Library.csproj +++ b/src/RonSijm.Blazyload.Library/RonSijm.Blazyload.Library.csproj @@ -1,14 +1,14 @@  + + + + + - net6.0;net7.0 - preview - 1.1.3 enable True RonSijm.Blazyload.Library - Ron Sijm - Ron Sijm The client components of RonSijm.Blazyload https://github.com/RonSijm/RonSijm.Blazyload Debug;Release @@ -23,12 +23,4 @@ - - - - - - - - diff --git a/src/RonSijm.Blazyload/Features/DIComponents/BlazyAssemblyLoader.cs b/src/RonSijm.Blazyload/Features/DIComponents/BlazyAssemblyLoader.cs index 95f4ef0..409aab3 100644 --- a/src/RonSijm.Blazyload/Features/DIComponents/BlazyAssemblyLoader.cs +++ b/src/RonSijm.Blazyload/Features/DIComponents/BlazyAssemblyLoader.cs @@ -71,7 +71,7 @@ private async Task> LoadAssembliesAsync(IEnumerable assem } var referenceAssemblies = assembly.GetReferencedAssemblies(); - var assemblyNames = referenceAssemblies.Select(referenceAssembly => $"{referenceAssembly.Name}.dll"); + var assemblyNames = referenceAssemblies.Select(referenceAssembly => $"{referenceAssembly.Name}.wasm"); // "Oh no! recursion! ಠ_ಠ" - Possibly implement trampoline pattern if this causes issues var cascadeResults = await LoadAssembliesAsync(assemblyNames, true); diff --git a/src/RonSijm.Blazyload/Features/Options/Models/BlazyOptions.cs b/src/RonSijm.Blazyload/Features/Options/Models/BlazyOptions.cs index 69b6ecf..8f42309 100644 --- a/src/RonSijm.Blazyload/Features/Options/Models/BlazyOptions.cs +++ b/src/RonSijm.Blazyload/Features/Options/Models/BlazyOptions.cs @@ -18,9 +18,9 @@ public BlazyAssemblyOptions GetOptions(string assemblyName) return null; } - if (assemblyName.EndsWith(".dll", StringComparison.Ordinal)) + if (assemblyName.EndsWith(".wasm", StringComparison.Ordinal)) { - assemblyName = assemblyName.Replace(".dll", string.Empty); + assemblyName = assemblyName.Replace(".wasm", string.Empty); } foreach (var mapping in _assemblyMapping) diff --git a/src/RonSijm.Blazyload/Properties/GlobalUsings.TypeAliases.cs b/src/RonSijm.Blazyload/Properties/GlobalUsings.TypeAliases.cs index b4cc38d..2d69f6a 100644 --- a/src/RonSijm.Blazyload/Properties/GlobalUsings.TypeAliases.cs +++ b/src/RonSijm.Blazyload/Properties/GlobalUsings.TypeAliases.cs @@ -1,2 +1,2 @@ // Type aliases in a different file, so that you can resharper ignore the file -global using SettingsForAssembly = (Features.Options.Models.BlazyOptions Blazy, Features.Options.Models.BlazyAssemblyOptions assembly); \ No newline at end of file +global using SettingsForAssembly = (RonSijm.Blazyload.Features.Options.Models.BlazyOptions Blazy, RonSijm.Blazyload.Features.Options.Models.BlazyAssemblyOptions assembly); \ No newline at end of file diff --git a/src/RonSijm.Blazyload/RonSijm.Blazyload.csproj b/src/RonSijm.Blazyload/RonSijm.Blazyload.csproj index 2d058fd..036979e 100644 --- a/src/RonSijm.Blazyload/RonSijm.Blazyload.csproj +++ b/src/RonSijm.Blazyload/RonSijm.Blazyload.csproj @@ -1,18 +1,15 @@  + + + + - net6.0;net7.0 preview - 1.1.3 - enable - True RonSijm.Blazyload - Ron Sijm - Ron Sijm A C# Blazor library to effortlessly implement Lazy Loading and Dependency Injection https://github.com/RonSijm/RonSijm.Blazyload Debug;Release - packaging\blazyload-package-logo.png packaging\README.md @@ -22,15 +19,11 @@ - - + + - - - - - +