Skip to content

Commit

Permalink
Upgraded nuget packages to align with .NET 8 & re;oving dependency on…
Browse files Browse the repository at this point in the history
… blazor-state
  • Loading branch information
mouadcherkaoui committed Mar 31, 2024
1 parent 874a321 commit 683c03a
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 79 deletions.
14 changes: 7 additions & 7 deletions src/BackendApi/BackendApi.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MediatR" Version="12.2.0" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="11.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.2" />
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.2">
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.3" />
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="3.1.2" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="8.0.3" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.3.0" />
<PackageReference Include="NLayersApp.CQRS" Version="0.1.0-CI-20200318-234225" />
<PackageReference Include="NLayersApp.Persistence" Version="0.1.0-CI-20191112-222624" />
Expand Down
6 changes: 3 additions & 3 deletions src/BxBlazor/BxBlazor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<Company>ChkPartner</Company>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.17" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.5" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.3" PrivateAssets="all" />
</ItemGroup>
</Project>
1 change: 0 additions & 1 deletion src/BxBlazor/Components/Grid/BxCol.razor
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<div class="@(cssClass)">
@ChildContent
</div>
<div class="bx--"></div>
@code {
[Parameter]
public string lg { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/BxBlazor8/BxBlazor8.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.5" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.3" PrivateAssets="all" />
</ItemGroup>

</Project>
24 changes: 1 addition & 23 deletions src/SampleProject/Client/App.razor
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@


@using BlazorState.Services
@using BlazorState.Pipeline.ReduxDevTools
@using BlazorState.Features.JavaScriptInterop
@using BlazorState.Features.Routing

<Router AppAssembly="@typeof(Program).Assembly">
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
Expand All @@ -17,19 +10,4 @@
</Router>

@code {
[Inject] private JsonRequestHandler JsonRequestHandler { get; set; }
#if ReduxDevToolsEnabled
[Inject] private ReduxDevToolsInterop ReduxDevToolsInterop { get; set; }
#endif
// Injected so it is created by the container. Even though the IDE says it is not used, it is.
[Inject] private RouteManager RouteManager { get; set; }


protected override async Task OnAfterRenderAsync(bool firstRender)
{
#if ReduxDevToolsEnabled
await ReduxDevToolsInterop.InitAsync();
#endif
await JsonRequestHandler.InitAsync();
}
}
3 changes: 2 additions & 1 deletion src/SampleProject/Client/Pages/DataTable.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@page "/components/bx-datatable"
@using blazorwasm.Shared

@inject HttpClient Http
@inject IJSRuntime js
<main id="main-content" class="bx--content">
Expand All @@ -26,7 +27,7 @@

protected override async Task OnInitializedAsync()
{
forecasts = await Http.GetJsonAsync<WeatherForecast[]>("WeatherForecast")
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("WeatherForecast")
.ContinueWith<WeatherForecast[]>(t => t.IsFaulted ? get_forcasts() : null);
}

Expand Down
2 changes: 1 addition & 1 deletion src/SampleProject/Client/Pages/FetchData.razor
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

protected override async Task OnInitializedAsync()
{
forecasts = await Http.GetJsonAsync<WeatherForecast[]>("WeatherForecast").ContinueWith<WeatherForecast[]>(t => t.IsFaulted ? get_forcasts() : null);
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("WeatherForecast").ContinueWith<WeatherForecast[]>(t => t.IsFaulted ? get_forcasts() : null);
}
private readonly string[] Summaries = new[]
{
Expand Down
2 changes: 1 addition & 1 deletion src/SampleProject/Client/Pages/UIShell.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<BxContent>
<BxGrid>
<BxRow>
<BxCol offset="lg-1">
<BxCol md="8" offset="md-1">
<h1>Heading</h1>
@for (var i = 0; i <= 10; i++)
{
Expand Down
11 changes: 5 additions & 6 deletions src/SampleProject/Client/Program.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
using System.Threading.Tasks;
using BxBlazor.Services;
using Microsoft.Extensions.DependencyInjection;
using MediatR;
using BlazorState;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using System.Net.Http;
using System;
namespace blazorwasm.Client
{
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);

builder.Services.AddMediatR(typeof(App).Assembly);
builder.Services.AddBlazorState(o =>
builder.Services.AddScoped(http => new HttpClient
{
o.UseReduxDevToolsBehavior = true;
BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
});

builder.RootComponents.Add<App>("app");

await builder.Build().RunAsync();
Expand Down
3 changes: 0 additions & 3 deletions src/SampleProject/Client/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

@using System.Linq
@using System.IO
@using BlazorState
@using BlazorState.Services
@using MediatR

@inject IJSRuntime jsRuntime
@inject HttpClient http
Expand Down
51 changes: 23 additions & 28 deletions src/SampleProject/Client/Shared/ShellLayout.razor
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
@inherits BlazorStateComponent
@using BlazorState
@using MediatR

@inject IJSRuntime jsRuntime
@inject IJSRuntime jsRuntime
@inject HttpClient http

<BxUIShell prefix="bx"
Expand All @@ -15,7 +11,7 @@
NavMenuIdSuffix="primary"
SideNavFixed="false">
<BxGrid>
<BxCol offset="2">
<BxCol>
@ChildContent
</BxCol>
</BxGrid>
Expand Down Expand Up @@ -44,16 +40,15 @@
// we create an announymous object that will hold the deserialized json to do so
// we will use an extension method through which we will act on the result
(new
{
Sections = Sections,
SwitcherLinks = SwitcherLinks,
HeaderNavLinks = HeaderNavLinks,
HeaderActions = HeaderActions
})
// next step is to deserialize the json to the type of the announymous object
.pipeTo(anonymousObject =>
Newtonsoft.Json.JsonConvert.DeserializeAnonymousType(Globals.UIShellStructure, anonymousObject))
Newtonsoft.Json.JsonConvert.DeserializeAnonymousType(Globals.UIShellStructure, new
{
Sections = Sections,
SwitcherLinks = SwitcherLinks,
HeaderNavLinks = HeaderNavLinks,
HeaderActions = HeaderActions
})
// the we pipe the result to extract the shell structure as IEnumerables
.pipeTo(result =>
{
Expand All @@ -76,20 +71,20 @@
await base.OnAfterRenderAsync(firstRender);
}

protected new T GetState<T>()
{
Type stateType = typeof(T);
Subscriptions.Add(stateType, this);
// protected new T GetState<T>()
// {
// Type stateType = typeof(T);
// Subscriptions.Add(stateType, this);
return base.GetState<T>();
//return Store.GetState<T>();
}
// return base.GetState<T>();
// //return Store.GetState<T>();
// }
new IMediator Mediator { get => base.Mediator; set => base.Mediator = value; }
new IStore Store { get => base.Store; set => base.Store = value; }
// new IMediator Mediator { get => base.Mediator; set => base.Mediator = value; }
// new IStore Store { get => base.Store; set => base.Store = value; }
new void ReRender()
{
base.ReRender();
}
// new void ReRender()
// {
// base.ReRender();
// }
}
1 change: 1 addition & 0 deletions src/SampleProject/Client/_Imports.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@using System.Net.Http
@using System.Net.Http.Json;
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
Expand Down
8 changes: 4 additions & 4 deletions src/SampleProject/Client/blazorwasm.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Blazor-State" Version="3.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.17" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.17" />
<PackageReference Include="Microsoft.Extensions.Http" Version="3.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.3" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Net.Http.Json" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\BxBlazor\BxBlazor.csproj" />
Expand Down

0 comments on commit 683c03a

Please sign in to comment.