Code Monkey home page Code Monkey logo

blazor-starter-kit's Introduction

Contributors Forks Stargazers Issues MIT License LinkedIn


Blazor Hero

BlazorHero - Clean Architecture Template

Open Sourced Solution Template For Blazor Web-Assembly 6.0 built with MudBlazor Components
Read the Documentation »

Report Bug · Request Feature . Request Documentation

About The Project ⚡

BlazorHero is a Clean Architecture Solution Template for Blazor Webassembly 6.0 built with MudBlazor Components.

Complete Overview - Youtube Video 🆕 📈

So, here is an in-depth video that takes you through the BlazorHero Project! Do Like & Subscribe to my Youtube channel! It would be great if you could leave behind your valuable feedback in the comments section of the Video. This helps me reach a much wider audience with time :)

Watch it here!

Blazor Hero - Clean Architecture Solution Template for Blazor WebAssembly

Tech Stack 💪

BlazorHero v2.2

  • UI Improvements
  • Docker Support
  • Better Permissions Management
  • Code Cleanups
  • RTL Support
  • Minor Bug Fixes
  • Better Project Structure

What to Expect in BlazorHero 3.0?

  • Modular Architecture
  • Cleaner Separation Of Code
  • Dedicated Documentation Website - Here
  • Tutorials to add new entities, controllers
  • UI Updates
  • Support for PostgreSQL / MySQL - Easy DB Switching
  • Theme Manager Integration to change UI Color Palletes / Fonts on the go.
  • You can suggest your requirements as well!

Down the Roadmap

  • Migration to .NET 6
  • Multi Tenancy
  • Better Localization - JSON

Getting Started 🦸

Important If you are already using Blazor Hero v1.x, make sure that you drop your existing database and re-update your database using the CLI as there are a couple of new migrations added that might clash with your existing schema. Also, install the latest version of BlazorHero.

The easiest way to get started with Blazor Hero is to install the NuGet package and run dotnet new BlazorHero.CleanArchitecture:

  1. Install the latest .NET 6 SDK
  2. Install the latest DOTNET & EF CLI Tools by using this command dotnet tool install --global dotnet-ef
  3. Install the latest version of Visual Studio IDE 2019 (v16.8 and above) 🚀
  4. Open up Command Prompt and run dotnet new --install BlazorHero.CleanArchitecture to install the project template
  5. Create a folder for your solution and cd into it (the template will use it as project name)
  6. Run dotnet new BlazorHero.CleanArchitecture to create a new Solution with all the Awesomeness 🕶️ of BlazorHero 🦸

What to do next? Read the entire guide on my blog.

Getting Started with Docker in Windows 🚀

  • Install Docker on Windows via https://docs.docker.com/docker-for-windows/install/
  • Open up Powershell on Windows and run the following
    • cd c:\
    • dotnet dev-certs https -ep $env:USERPROFILE\.aspnet\https\aspnetapp.pfx -p securePassword123
    • dotnet dev-certs https --trust
    • Note - Make sure that you use the same password that has been configured in the docker-compose.yml file. By default, securePassword123 is configured.
  • 5005 & 5006 are the ports setup to run blazorHero on Docker, so make sure that these ports are free. You could also change the ports in the docker-compose.yml and Server\Dockerfile files.
  • Now navigate back to the root of the BlazorHero Project on your local machine and run the following via terminal - docker-compose -f 'docker-compose.yml' up --build
  • This will start pulling MSSQL Server Image from Docker Hub if you don't already have this image. It's around 500+ Mbs of download.
  • Once that is done, dotnet SDKs and runtimes are downloaded, if not present already. That's almost 200+ more Mbs of download.
  • PS If you find any issues while Docker installs the nuget packages, it is most likely that your ssl certificates are not installed properly. Apart from that I also added the --disable-parallel in the Server\Dockerfileto ensure network issues don't pop-up. You can remove this option to speed up the build process.
  • That's almost everything. Once the containers are available, migrations are updated in the MSSQL DB, default data is seeded.
  • Browse to https://localhost:5005/ to use your version of BlazorHero !

Complete Documentation 🚀

Getting started with Blazor Hero – A Clean Architecture Template built for Blazor WebAssembly using MudBlazor Components. This project will make your Blazor Learning Process much easier than you anticipate. Blazor Hero is meant to be an Enterprise Level Boilerplate, which comes free of cost, completely open sourced.

The provided documentation / guide will get you started with BlazorHero in no time. It provides a complete walkthrough for the project with to-the-point guides and notes.

Read the Quick Start Guide

Features

All the completed and the upcoming features are mentioned in the Features.MD File

Contributing

Contributions are what make the open-source community such an amazing place to be, learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Here are the few contributions that I would highly appreciate ;)

  • Need someone to add in the API Documentation for Swagger.
  • Need someone to implement localization throughout every Razor Component of the solution under the WASM(Client) Project. You can take the Pages/Authentication/Login.razor as the point of reference. It is as simple as adding @inject Microsoft.Extensions.Localization.IStringLocalizer<Login> localizer to every page, changing the texts to @localizer["Text Here"] and finally adding resx files to the Resources Folder as per the folder structure.
  • Need few contributors to add in various language translations as per the implemented Location. I got time to only add a few translations for French as of now.
  • Need a UI contributor to look at the UX/UI of the entire project
  • Need someone to buildup a cool Material Logo for BlazorHero (BH):D Do contact me on LinkedIn (https://www.linkedin.com/in/iammukeshm/).
  • And finally, Stars from everyone! :D

License

Distributed under the MIT License.

Contact

Mukesh Murugan

Support ⭐

Has this Project helped you learn something New? or Helped you at work? Do Consider Supporting. Here are a few ways by which you can support.

  • Leave a star! ⭐
  • Recommend this awesome project to your colleagues. 🥇
  • Leave your feedback / comments regarding this project in the comments section on my blog Blazor Hero Blog
  • Do consider endorsing me on LinkedIn for ASP.NET Core - Connect via LinkedIn 🦸
  • Or, If you want to support this project on the long run, consider buying me a coffee! ☕

Buy Me A Coffee

blazor-starter-kit's People

Contributors

10geekjames avatar 274188a avatar alexlogvin avatar alexvengelen avatar anmsalman avatar artillio avatar carlittos avatar chhinsras avatar codewiththomas avatar corentin703 avatar dependabot[bot] avatar dsoronda avatar dwifuady avatar farshaddavoudi avatar fastechsas avatar hgdiaz avatar hoaint235 avatar iammukeshm avatar islam-alshiki avatar jeremiedevos avatar jnalley20 avatar jpandeinge avatar lucasapoena avatar nbiada avatar neozhu avatar pizzaconsole avatar prob3 avatar santiagocrd avatar timt-dotnetarchitect avatar unchase avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blazor-starter-kit's Issues

Real time updates

Can you provide real-time updates in your project?

When two different administrators are in the product catalogue, it would be nice when the view updates automatically in the moment, the other admin adds a new product. (I guess SignalR can handle this?)

Most SignalR examples only implement a chat functionality. Would be awesome, if you could implement this.

Aliens are taking over my project!!!

No matter what I do, the database name remains BlazorHero.CleanArchitecture. I even tried context.Database.Migrate() in Program.cs and the name is still BlazorHero.CleanArchitecture. Aliens are taking over the project!!

изображение

  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Hangfire": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AllowedHosts": "*",
  "AppConfiguration": {
    "Secret": "S0M3RAN0MS3CR3T!1!MAG1C!1!"
  },
  "ConnectionStrings": {
    "DefaultConnection": "Data Source=(localdb)\\mssqllocaldb;Initial Catalog=BrokenDatabase;Integrated Security=True;MultipleActiveResultSets=True"
  },
  "MailConfiguration": {
    "From": "[email protected]",
    "Host": "smtp.ethereal.email",
    "Port": 587,
    "UserName": "[email protected]",
    "Password": "vAKmWQB8CyPUBg8rBQ",
    "DisplayName": "Mukesh Murugan"
  },
  //For Serilog Configuration, refer https://codewithmukesh.com/blog/serilog-in-aspnet-core-3-1/
  "Serilog": {
    "MinimumLevel": {
      "Default": "Information",
      "Override": {
        "Microsoft": "Error",
        "Microsoft.Hosting.Lifetime": "Information",
        "System": "Information",
        "Hangfire": "Warning"
      }
    },
    "WriteTo": [
      {
        "Name": "Console",
        "Args": {
          "outputTemplate": "{Timestamp} [{Level}] {Message}{NewLine:1}"
        }
      },
      {
        "Name": "File",
        "Args": {
          "path": "Logs\\log.txt",
          "rollingInterval": "Day"
        }
      }
    ],
    "Enrich": [
      "FromLogContext",
      "WithMachineName",
      "WithProcessId",
      "WithThreadId"
    ],
    "Properties": {
      "Application": "BlazorHero.CleanArchitecture.Server"
    }
  }
}```

Authentication Error

Hi,
i've created the this template via nuget comand "dotnet new BlazorHero.CleanArchitecture"
I starting the server with .net console (not IIS). All builds fine but the console writes some exceptions:
I have not changed anything yet.
How can I fix these errors?
Thanks!

Sending HTTP request GET https://localhost:5001/api/identity/account/profile-picture/c6feb5e1-61e6-426a-9117-e3d253ef1dab crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: TypeError: Failed to fetch System.Net.Http.HttpRequestException: TypeError: Failed to fetch at System.Net.Http.BrowserHttpHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at Demo.Client.Infrastructure.Authentication.AuthenticationHeaderHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) in C:\code\private\Demo\Demo.Client.Infrastructure\Authentication\AuthenticationHeaderHandler.cs:line 30 at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at Toolbelt.Blazor.HttpClientInterceptorHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at Toolbelt.Blazor.HttpClientInterceptorHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, Boolean emitTelemetryStartStop, CancellationToken cancellationToken) at Demo.Client.Infrastructure.Managers.Identity.Account.AccountManager.GetProfilePictureAsync(String userId) in C:\code\private\Demo\Demo.Client.Infrastructure\Managers\Identity\Account\AccountManager.cs:line 33 at Demo.Client.Shared.Components.UserCard.LoadDataAsync() in C:\code\private\Demo\Demo\Client\Shared\Components\UserCard.razor.cs:line 36 at Demo.Client.Shared.Components.UserCard.OnInitializedAsync() in C:\code\private\Demo\Demo\Client\Shared\Components\UserCard.razor.cs:line 20 at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle) crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: TypeError: Failed to fetch System.Net.Http.HttpRequestException: TypeError: Failed to fetch at System.Net.Http.BrowserHttpHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at Demo.Client.Infrastructure.Authentication.AuthenticationHeaderHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) in C:\code\private\Demo\Demo.Client.Infrastructure\Authentication\AuthenticationHeaderHandler.cs:line 30 at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at Toolbelt.Blazor.HttpClientInterceptorHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at Toolbelt.Blazor.HttpClientInterceptorHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, Boolean emitTelemetryStartStop, CancellationToken cancellationToken) at Demo.Client.Infrastructure.Managers.Identity.Account.AccountManager.GetProfilePictureAsync(String userId) in C:\code\private\Demo\Demo.Client.Infrastructure\Managers\Identity\Account\AccountManager.cs:line 33 at Demo.Client.Shared.Components.UserCard.LoadDataAsync() in C:\code\private\Demo\Demo\Client\Shared\Components\UserCard.razor.cs:line 36 at Demo.Client.Shared.Components.UserCard.OnInitializedAsync() in C:\code\private\Demo\Demo\Client\Shared\Components\UserCard.razor.cs:line 20 at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle) Debugging hotkey: Shift+Alt+D (when application has focus) �[0m�[48;5;127m�[38;5;231mblazor�[0m�[1m Loaded 12.36 MB resources �[0mThis application was built with linking (tree shaking) disabled. Published applications will be significantly smaller.�[0m Loaded 12.36 MB resources from cache info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1] Authorization was successful. info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1] Authorization was successful. info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[2] Authorization failed. These requirements were not met: ClaimsAuthorizationRequirement:Claim.Type=Permission and Claim.Value is one of the following values: (Permissions.Roles.View) info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[2] Authorization failed. These requirements were not met: ClaimsAuthorizationRequirement:Claim.Type=Permission and Claim.Value is one of the following values: (Permissions.Users.View) info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[2] Authorization failed. These requirements were not met: ClaimsAuthorizationRequirement:Claim.Type=Permission and Claim.Value is one of the following values: (Permissions.Products.View) info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[2] Authorization failed. These requirements were not met: ClaimsAuthorizationRequirement:Claim.Type=Permission and Claim.Value is one of the following values: (Permissions.Brands.View) info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1] Authorization was successful. info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1] Authorization was successful. info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1] Authorization was successful. info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1] Authorization was successful. info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1] Authorization was successful. info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1] Authorization was successful.

Users - Delete, Edit

Just adding this here so we don't forget :-)

User Functionality missing:
Edit - At the moment Editing a User only allows the changing of the Active flag.
Delete - Delete is not implemented yet.

Password in json?

In file CleanArchitecture/BlazorHero.CleanArchitecture/Server/appsettings.json
did you store valid password to ethereal.email ? :P

JWTBearerEvent bug

Describe the bug
when i change expiration date to something like 20min
next api call will result in exception in
BlazorHero.CleanArchitecture.Server.Extensions.ServiceCollectionExtensions
OnChallenge = context =>
{
.......
context.Response.StatusCode = 401;
.......
}

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'identityService.cs'
  2. set expires: to 20min (can also do 5 so u dont have to wait that long), when creating new JwtSecurityToken
  3. run solution, delete old token and login, wait for token to expire and try to use app
  4. See error - System.InvalidOperationException: 'StatusCode cannot be set because the response has already started.'

Expected behavior
either logout user and require new login or refresh token

Screenshots
If applicable, add screenshots to help explain your problem.
image
image

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome
  • Version 89.0.4389.90

Additional context
none

Upload Image to user craches app

Describe the bug
The project/solution Crashes When i try to upload a image to the profile

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Accounts'
  2. Click on 'Upload Image'
  3. See error

Expected behavior
The image is uploaded if we restart the solution (RUN) but crashes on the process

Desktop (please complete the following information):

  • OS: W10
  • Browser Chrome
  • Version latest

The error occured after uploading account image

Describe the bug
The error occured after uploading account image.

To Reproduce
Steps to reproduce the behavior:

  1. Authorize
  2. Click on Account menu item
  3. Click on UPLOAD IMAGE button
  4. Choose the image file
  5. See the error User Not Found

Expected behavior
There is no error.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 10 Pro 1909
  • Browser: Yandex Browser 21.2.4.165 (64-bit)

Big Bug!

Hi, I'm just kidding.

I just want to say thank you for the amazing efforts.

Good luck!

Documentation

I was considering using Blazorboilerplate. But, due to inadequate documentation for newbies, the project quickly becomes quite complex. We then have to spend a lot to time figuring things out.
I am hoping that the documentation in BLAZORHERO keeps pace with the project and we can follow it, step by step.
For example, I need to use Sendgrid in my project. I am used to using it in different way and would be grateful for steps on how to configure SENDGRID in BLAZORHERO. I don't even know which project to add the Sendgrid NUGET package into, how sad is that? :) :)
Many thanks
Luke

Failed executing DbCommand (Audit Trails)

Describe the bug
The error occured when I try to get Audit Trails.

04/06/2021 20:37:57 +03:00 [Error] Failed executing DbCommand ("202"ms) [Parameters=["@__p_1='?' (DbType = Int32), @__userId_0='?' (Size = 4000)"], CommandType='Text', CommandTimeout='30']"\r\n""SELECT TOP(@__p_1) [a].[Id], [a].[AffectedColumns], [a].[DateTime], [a].[NewValues], [a].[OldValues], [a].[PrimaryKey], [a].[TableName], [a].[Type], [a].[UserId]\r\nFROM [AuditTrails] AS [a]\r\nWHERE [a].[UserId] = @__userId_0\r\nORDER BY [a].[Id] DESC"
04/06/2021 20:37:57 +03:00 [Error] An exception occurred while iterating over the results of a query for context type '"BlazorHero.CleanArchitecture.Infrastructure.Contexts.BlazorHeroContext"'."\r\n""Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'AuditTrails'.\r\n   at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__169_0(Task`1 result)\r\n   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()\r\n   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n--- End of stack trace from previous location ---\r\n   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)\r\n   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)\r\n   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken)\r\n   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)\r\n   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()\r\nClientConnectionId:e12a8b91-51d5-4146-9cdb-7d4db9810df2\r\nError Number:208,State:1,Class:16"

To Reproduce
Steps to reproduce the behavior:

  1. Authorize
  2. Click on Audit Trails menu item
  3. See the error

Expected behavior
There are no errors.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 10 Pro 1909
  • Browser: Yandex Browser 21.2.4.165 (64-bit)

Error Loading Localization Language on Startup

Describe the bug
After compiling the project! it appears to miss the localsize file / or resource

To Reproduce
Steps to reproduce the behavior:
Just load the project it will appears on start up the project

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows
  • Browser Chrome

How we can protect Endpoint using role permissions?

The following endpoint is unprotected since [Authorize] attribute is not used.
How can we protect below endpoint using role permissions rather than roles?

 BlazorHero.CleanArchitecture.Server.Controllers.v1.Catalog
{
    public class ProductsController : BaseApiController<ProductsController>
    {
        [HttpGet]
        public async Task<IActionResult> GetAll.......
        .
        .
    }
}

How can I protect this endpoint by adding the [Authorize (Policy = "Products.View")] attribute to Jwt.
How can I verify role permissions after I have protected them.

You have always used permissions on the UI side in this project and other projects, but you never used permissions on the Api side.

It will be very nice if you use an example on the api side in this project.

UI Hangs adding/registering a new user as Admin

Describe the bug
UI Hangs when Registering a new User when logged on as admin

To Reproduce
Steps to reproduce the behavior:

  1. Login using default admin account
  2. Create a new User
  3. Fill out dialog
  4. Click Register (leaving checkboxes unchecked but makes no difference)

Expected behavior
User created and shown in grid

Desktop (please complete the following information):

  • OS: PC Win 10
  • Browser: Chrome

Screenshots

image

**REQUEST DATA
image

Additional context
InterceptBeforeHttpAsync is called and returns without exception or need to refresh token but the response seems to have a status_code of BadRequest, This status is not handled and so UI hangs.

The problem of the Response.BadRequest is the inner problem

image

Assertion at /__w/1/s/src/mono/mono/metadata/assembly.c:4648, condition `<disabled>' not met

Hi,
first of all thanks for such a great setup to work with dotnetcore and blazor.

Issue :
While running the application locally everything worked normally but when I published and deployed the Server project on IIS it got stuck on 1st page where MudBlazor logo is appearing.

error at console
* Assertion at /__w/1/s/src/mono/mono/metadata/assembly.c:4648, condition '<disabled>' not met

Snap :
image
image

It would be helpful if you can help me on this to resolve.

[Question] Server Side Permission Policy Provider

Hi Mukesh,

I just added permission based policy to the server side.
But whatever I do I get unauthorized even with the admin role.

I added the PermissionAuthorizationHandler and the PermissionPolicyProvider to tthe server Api project but I don't see where you use them. I assume it should be in the startup class.

Thanks for your help.

Testing

Are there any plans to add unit Test project

Template Repository

Just a suggestion that you enable this repo to be a GitHub Template Repository under Settings.

image

MudTable(ServerData) Sorting feature is not working

Hi, thanks for your amazing work.

I have carefully added sortLabel feature into the existing code using the below link.
https://mudblazor.com/components/table

I can populate my data from my API and the searching feature working fine but when I implement the sorting feature using the below code snippet sorting not happening. (seems code not returning after OrderByDirection() method execution.

 if (!string.IsNullOrWhiteSpace(state.SortLabel))
                {
                    switch (state.SortLabel)
                    {
                        case "date_field":
                            data = (List<GetAllPagedTicketsResponse>)data.OrderByDirection(state.SortDirection, o => o.ComplaintDateTime?.ToString("yyyy-MM-dd"));
                            break;
                        case "area_field":
                            data = (List<GetAllPagedTicketsResponse>)data.OrderByDirection(state.SortDirection, o => o.Area);
                            break;
                        case "subarea_field":
                            data = (List<GetAllPagedTicketsResponse>)data.OrderByDirection(state.SortDirection, o => o.SubArea);
                            break;
                        case "location_field":
                            data = (List<GetAllPagedTicketsResponse>)data.OrderByDirection(state.SortDirection, o => o.Location);
                            break;
                        case "priority_field":
                            data = (List<GetAllPagedTicketsResponse>)data.OrderByDirection(state.SortDirection, o => o.Priority);
                            break;
                    }
                }

please advise what I am doing here wrong.

thank you

Multi user ?

Hi Mukesh!
Amazingly insane project dude! The speed of development makes me feel decidedly ordinary :)

Just one question: I see when making entries to the DB, its multi tenant? What I mean, is that if I as admin add new category, it does not show for the normal user? I read that this template may have the ability to switch between single user/DB and multi? If so, is it implemented or configurable at this point?

Many thanks for the great work!
Luke Vincent

After cloning and building the project

Describe the bug
I went to the repo and clone it in Visual Studio 2019, and after building i found the following error;

Severity Code Description Project File Line Suppression State
Error NETSDK1004 Assets file 'C:\Repos\Training\BlazorHero - Clean Architecture Template\BlazorHero.CleanArchitecture\Server\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. BlazorHero.CleanArchitecture.Server C:\Program Files\dotnet\sdk\5.0.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 241

To Reproduce
Steps to reproduce the behavior:

  1. Go to repo
  2. Clone the repo on Visual Studio 2019
  3. See error

Expected behavior
The solution build without issues

Screenshots
build issue

Desktop (please complete the following information):

  • OS: Windows 10
  • Visual Studio 2019 Community Edition
  • Version 16.9.2

Additional context
I tried to do a dotnet restore in the project and found the following error:

dotnet restore
Determining projects to restore...
C:\Program Files\dotnet\sdk\5.0.201\NuGet.targets(131,5): error : Found invalid data while decoding. [C:\Repos\Training\BlazorHero - Clean Architecture Template\BlazorHero.CleanArchitecture\Server\BlazorHero.CleanArchitecture.Server.csproj]

Using Generic Repository

  • Generic repository; imiagine we have 100 tables then we are going to implement the repository to each respectively. We should use generic repo and provide additional repo only if needed
  • Specification: how about if we want to filter data with condition or include , group by .

Some features for your consideration

  • PDF Viewer (Printing/Download option)
  • HTML Printing
  • Notification
  • Embed Fonts
  • Role Claims (Permission)
  • JWT Refresh Token and Revoke Token
  • HttpInterceptor

Question: Dependency Injection?

This is purely a question - I cannot for the life of me see where/how _userManager or _snackBar for example get injected in the partial class for say RegisterUserModal.razor.cs

Is it the WebAssemblyHostBuilderExtensions.cs?

Please let me know so I can sleep.... :-)

image

Language support for Core Application

You can see in the example there is some hardcoded message text to the interface, how can I translate it? Or maybe that message should be a keyword and the front end must be the responsable to translate it?

image

Let me know what you want to do and I help you with this

MySQL Implementation Code

I don´t know where to share code so i'm doing here.
add MySql.EntityFrameworkCore nuget package to Infrastructure project and Web/Server project

Code changes to use MySQL

Source/Infrasctructure/Contexts/BlazorHeroContext.cs:

       protected override void OnModelCreating(ModelBuilder builder)
        {
            foreach (var property in builder.Model.GetEntityTypes()
            .SelectMany(t => t.GetProperties())
            .Where(p => p.ClrType == typeof(decimal) || p.ClrType == typeof(decimal?)))
            {
                property.SetColumnType("decimal(18,2)");
            }
            base.OnModelCreating(builder);
            builder.Entity<ChatHistory>(entity =>
            {
                entity.ToTable("ChatHistory");

                entity.HasOne(d => d.FromUser)
                    .WithMany(p => p.ChatHistoryFromUsers)
                    .HasForeignKey(d => d.FromUserId)
                    .OnDelete(DeleteBehavior.ClientSetNull);

                entity.HasOne(d => d.ToUser)
                    .WithMany(p => p.ChatHistoryToUsers)
                    .HasForeignKey(d => d.ToUserId)
                    .OnDelete(DeleteBehavior.ClientSetNull);
            });

            builder.Entity<BlazorHeroUser>(entity =>
            {
                entity.ToTable(name: "Users");
            });

            builder.Entity<IdentityRole>(entity =>
            {
                entity.ToTable(name: "Roles");
            });
            builder.Entity<IdentityUserRole<string>>(entity =>
            {
                entity.ToTable("UserRoles");
            });

            builder.Entity<IdentityUserClaim<string>>(entity =>
            {
                entity.ToTable("UserClaims");
            });

            builder.Entity<IdentityUserLogin<string>>(entity =>
            {
                entity.ToTable("UserLogins");
            });

            builder.Entity<IdentityRoleClaim<string>>(entity =>
            {
                entity.ToTable("RoleClaims");
            });

            builder.Entity<IdentityUserToken<string>>(entity =>
            {
                entity.ToTable("UserTokens");
            });

            builder.Entity<IdentityUser>(entity => entity.Property(m => m.Id).HasMaxLength(85));
            builder.Entity<IdentityUser>(entity => entity.Property(m => m.NormalizedEmail).HasMaxLength(85));
            builder.Entity<IdentityUser>(entity => entity.Property(m => m.NormalizedUserName).HasMaxLength(85));

            builder.Entity<IdentityRole>(entity => entity.Property(m => m.Id).HasMaxLength(85));
            builder.Entity<IdentityRole>(entity => entity.Property(m => m.NormalizedName).HasMaxLength(85));

            builder.Entity<IdentityUserLogin<string>>(entity => entity.Property(m => m.LoginProvider).HasMaxLength(85));
            builder.Entity<IdentityUserLogin<string>>(entity => entity.Property(m => m.ProviderKey).HasMaxLength(85));
            builder.Entity<IdentityUserLogin<string>>(entity => entity.Property(m => m.UserId).HasMaxLength(85));
            builder.Entity<IdentityUserRole<string>>(entity => entity.Property(m => m.UserId).HasMaxLength(85));

            builder.Entity<IdentityUserRole<string>>(entity => entity.Property(m => m.RoleId).HasMaxLength(85));

            builder.Entity<IdentityUserToken<string>>(entity => entity.Property(m => m.UserId).HasMaxLength(85));
            builder.Entity<IdentityUserToken<string>>(entity => entity.Property(m => m.LoginProvider).HasMaxLength(85));
            builder.Entity<IdentityUserToken<string>>(entity => entity.Property(m => m.Name).HasMaxLength(85));

            builder.Entity<IdentityUserClaim<string>>(entity => entity.Property(m => m.Id).HasMaxLength(85));
            builder.Entity<IdentityUserClaim<string>>(entity => entity.Property(m => m.UserId).HasMaxLength(85));

            builder.Entity<IdentityRoleClaim<string>>(entity => entity.Property(m => m.Id).HasMaxLength(85));
            builder.Entity<IdentityRoleClaim<string>>(entity => entity.Property(m => m.RoleId).HasMaxLength(85));
        }

Server/Extensions/ServiceCollectionExtensions.cs

        public static IServiceCollection AddDatabase(
            this IServiceCollection services,
            IConfiguration configuration)
            => services
                .AddDbContext<BlazorHeroContext>(options => options
                    .UseMySQL(configuration.GetConnectionString("DefaultConnection"))
                  //.UseSqlServer(configuration.GetConnectionString("DefaultConnection"))
                  )
            .AddTransient<IDatabaseSeeder, DatabaseSeeder>();

Wish is helpful !!

Does this use wasm-like silverlight... or signal R-

This is great template.
I want to know for complex makemytrip like projects will this work??
I have seen confusing info in other articles on wasm-like silverlight-does not work fast first time and also not on all browsers... or signal R- creates issues in scaling etc.
So if this is just new version of silverlight style can we use this in large web app?

i got this on first load-

Loaded 12.36 MB resourcesThis application was built with linking (tree shaking) disabled. Published applications will be significantly smaller.
Now if thousands of users start hitting app, initially for all thousands of user will it be slow... this is just not good for large app where people turn away if site does not load immediately. if this is 1 mb or less may be its good for large app. may be this tech is not good at all for makemytrip type of app, only good for small internal apps.

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Permission Policy Registering Issue

When we try to add permission beside view create edit delete.
For example, ViewDashboard claim, in the blazor client, the current code won't accumulate.

builder .Services .AddAuthorizationCore(options => { foreach (var permissionModule in PermissionModules.GetAllPermissionsModules()) { RegisterPermissionClaimPolicyByModule(options, permissionModule); } })

I tried the registering code inside server side extension. But it won't work.

Registration of new users

Beautiful template, but currently there is no means to register a new user? I would imagine this would be a "must have" in any application.

Thanks
Luke

Handling long-running requests with HangFire Fire-and-forget job then notify client job done via Signalr

Is your feature request related to a problem? Please describe.
In able to handling long-running requests with background services or out of process with an Azure Function, HangFire, worker service. Completing work out-of-process is especially beneficial for CPU-intensive tasks. Then use real-time communication options, such as SignalR, to communicate with clients asynchronously about progress.

Describe the solution you'd like
Use Case: Generate big report or process some complex workflows after submit request.

Bugs Found on version 1.0.0

  • Issue: Register User Form => Username length error is not alerted
    Where: Register User Form
  • Issue: Upload Picture => User Not Found Alert Error (sometime)
    Where: top right menu -> account (if we go to left menu, we can upload image profile
  • Missing profile photo for top right side
    image
  • When Upload profile picture for user on /account => always reload
  • When Click Save Change to update profile on /account => user is logged out
  • Forgot Password page not found
    image

Show avatar immediately after sending chat message

Describe the bug
The sender's avatar does not showed after sending chat message.

To Reproduce
Steps to reproduce the behavior:

  1. Authorize
  2. Click on Chat
  3. Choose a message receiver
  4. Send a message
  5. See the error

Expected behavior
The sender's avatar should be showed immediately after sending chat message.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 10 Pro 1909
  • Browser: Yandex Browser 21.2.4.165 (64-bit)

Result public bool Failed => !Succeeded; Why?

I am just curious why this is property exists in Result... public bool Failed => !Succeeded; Just seems to be duplicate of public bool Succeeded { get; set; } especially considering the fact that it is not used at all...

image

UI Component Choice

First, I would thank you for this template, which will be the default for my upcoming projects, but I know that I will take so much effort to replace MudBlazor with Tailwind css,

I think by using native components will make it easier to choose what css framweork you want to use, Tailwind, bootstrap, bulma,....

Multi-Tenancy

Multi-Tenancy is a widely used architecture to create SaaS applications where the hardware and software resources are shared by the customers (tenants).
It will be great if this feature is added.

Feature Preview Video on a more open platform?

Is your feature request related to a problem? Please describe.
Some people dont use facebook, and wont be able to access the video without an account

Describe the solution you'd like
Put it on a more inclusive platform like Vimeo or YouTube

Allowing users to register themselves?

It would be awesome if users could register themselves. Currently it appears that this template is for in-house use only, relying on an admin to add new users. This is highly impractical.

Thanks

Settings (both server and client

Is your feature request related to a problem? Please describe.
The one thing missing that we need is a system to store setting both application and user.

Describe the solution you'd like
Settings would need to be available on the server and the client for the UI (local storage?) If you are not planning this would you be able to suggest how this would best be done in Blazor?

Describe alternatives you've considered
Have you seen the system implemented in ASP Boilerplate?

Clicking on Hangfire menu item yields error

I was clicking around in the application, just random clicks and entering a few products etc.
When clicking on the HANGFIRE menu item, I got an error - please see attached screenshot. Unfortunately it seems to be random. I have been trying to create the steps necessary to reproduce but have not succeeded.

image

Thanks, Luke.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.