Git Product home page Git Product logo

rapidblazor's Introduction

Rapid Blazor Template for .NET

Build+Deploy Nuget Nuget Discord Twitter Follow

This is a solution template for creating a Blazor WebAssembly application hosted on ASP.NET Core 7 and following the principles of Clean Architecture.

Please consider this a preview, I am still actively working on this template. If you spot a problem or would like to suggest an improvement, please let me know by creating an issue.

If you find this project useful, please give it a star. Thanks! โญ

Getting Started

The solution template requires the latest version of .NET 7 SDK.

Install the project template:

dotnet new install JasonTaylorDev.RapidBlazor

Create a new app:

dotnet new rapid-blazor-sln --output RapidBlazor21

Launch the app:

cd RapidBlazor21\src\WebUI\Server
dotnet run

Database

Configuration

The template is currently configured to use SQL Server Express LocalDB for development and Azure SQL once deployed. I understand this will be difficult for some developers, and will look other options in the near future.

Migrations

The template uses Entity Framework Core and migrations can be run using the EF Core CLI Tools. Install the tools using the following command:

dotnet tool install --global dotnet-ef

Once installed, create a new migration with the following commands:

cd src\Infrastructure
dotnet ef migrations add "Initial" --startup-project ..\WebUI\Server

Review the Entity Framework Core tools reference - .NET Core CLI | Microsoft Docs to learn more.

Deploy

The project can easily be deployed to Azure using the included GitHub Actions workflows and Bicep templates. Review the Deployment instructions to learn how.

Resources

The following resources are highly recommended:

Support

If you are having problems, please let me know by creating an issue.

License

This project is licensed with the MIT license.

rapidblazor's People

Contributors

erinnmclaughlin avatar jasontaylordev 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

rapidblazor's Issues

Errors on starting

When I installed the update template and install a new program - set default project to Server - I got the following errors when trying to run the program:

Severity Code Description Project File Line Suppression State
Error MSB3073 The command "dotnet "C:\Users\RS.nuget\packages\nswag.msbuild\13.18.0\build../tools/Net60/dotnet-nswag.dll" run /variables:Configuration=Debug" exited with code -1. Server C:\repos\hto23_2022_12_14\10\hto23\src\WebUI\Server\Server.csproj 51

Severity Code Description Project File Line Suppression State
Error Number 5170,State:4,Class:16 Server C:\repos\hto23_2022_12_14\10\hto23\src\WebUI\Server\EXEC 1

I tried reinstalling Nuget packages but got the same error

UI does not update when toggling "done" after editing a todo item

Hi! First off, thank you for making this -- I've been looking for this kind of example project for a while! This will be a really helpful reference.

Wanted to report a small bug: after focusing on a todo item, the strikethrough formatting doesn't update when toggling between "done" and "not-done" states. I think the simplest fix would be to set the SelectedItem to null after saving:

main...erinnmclaughlin:CleanArchitectureBlazor:main

I could make a PR if you'd like?

Vertical Slice Arch Template?

First of all thank you for this template, Jason! ๐Ÿ˜Š

I feel that Clean Arch makes the whole project unnecessarily complex while Vertical Slice Architecture makes the development experience so much easier and cleaner. Fewer folders to look at instead of bunch of layers.

Any chance that you'll create templates using Vertical Slice Arch for Blazor/ MAUI etc.?

Thanks!

Azure AD auth instead of IdentityServer

This is not issue. But suggestion.
Rapid Blazor has option to use Azure Keyvault which is really good.
Could you share template to use Azure AD Auth(Role/policy based) instead of Identity server. Don't like to save user info in the table.

ShouldRequireUniqueTitle test method on MediatR 12.1.1

Hi

I use RapidBlazor template version on Net 7.0. everything is working on MediatR 10.0.1, but on MediatR 12.1.1, I have an issue on the test method "ShouldRequireUniqueTitle" with this message:
Expected a <Solution-Name.Application.Common.Exceptions.ValidationException> to be thrown, but no exception was thrown.
I tried to solve it, but I couldn't.
I hope somebody can help me.

Thank you in advanced

Build Error on clean Install

Hello - I followed the instructions on a clean install and build and got this error:

On Linux 23.04

/home/xxx/Dev/Sandbox/RapidBlazor21/src/WebUI/Server/Server.csproj(51,9): error MSB3073: The command "dotnet "/home/xxx/.nuget/packages/nswag.msbuild/13.18.0/build/../tools/Net60/dotnet-nswag.dll" run /variables:Configuration=Debug" exited with code 150.

Dependency Inversion

Thank you for your ongoing efforts with clean architecture and this template especially. I hope you can take a moment to clarify.

You have clearly explained that Dependencies should flow towards the core with the only caveat being references in startup.cs to enable dependency injection from another layer.

Therefore, IIdentityService is defined in Application, but the implementation is defined in Infrastructure. This allows dependency injection of this implementation without a dependency going outward to Infrastructure. I think this is a correct understanding.

However, WebUI defines the ViewModels/DTOs that the Application and infrastructure layers use. This results in dependencies on WebUI (Shared) in Application and Infrastructure.

For example, https://github.com/jasontaylordev/RapidBlazor/blob/main/src/Infrastructure/Identity/IdentityService.cs

using RapidBlazor.WebUI.Shared.AccessControl;
using RapidBlazor.WebUI.Shared.Authorization;
using RapidBlazor.WebUI.Shared.Common;

This seems to violate dependency inversion as Application and Infrastructure must now depend on WebUI.Shared. The above case uses UserDto.

It seems that an object that is used in all layers should be in core. Then the consumers of the core would be responsible for mapping domain defined objects to their preferred format (ViewModel/DTO). Otherwise, the outer layer projects force the Core and Infrastructure to use objects defined elsewhere resulting in outward flowing dependency. This violates dependency inversion principle and makes Infrastructure and Application layers unusable without the WebUI reference.

I apologize if I have completely missed something obvious, but I really would like to fully understand this architecture,

Thanks in advance for clarifying this.

Following Changes to Template

Apologies if this is the wrong place to ask this sort of question. I am using your template to create a new app which I expect not to finish until the new year. I would like to update my app as your update your template - e.g. moving from .NET 6 to 7. Is there a way that I can automatically get the updates you are making e.g. by cloning your repository - or should I just follow your repository and make the same same changes to my app that I see you making to the repository for your template?

Blazored.FluentValidation

First of all thank you for this template, Jason! This saves me a lot!

I was wondering why client validation is not involved in this template? In the TodoLists.razor component there is an EditForm to create a new ToDo list based on the TodoListDto class. I noticed that the client validation is not triggered / not used because the TodoListDto has no validator configured. I do see but that doesn't do anything because there is no DI configuration in program.cs for this. Only the server side validation "CreateTodoListRequestValidator" is triggered. It this on purpose? What is the best practice in combination with clean architecture? Should I add client validation on the ToListDto class or should I use the CreateTodoListRequest class as model for the EditForm?

Thanks!
Tim

Issue while running the project without database

Hi,
I am facing an issue while running the project for the first time after i delete the existing database. The code throws an exception in the following method in "SqlClientDiagnosticSourceListener" class :

private static void ConfigureExceptionTelemetry(DependencyTelemetry telemetry, Exception exception, PropertyFetcher numberFetcher)
{
telemetry.Success = false;
telemetry.Properties["Exception"] = exception.ToInvariantString();
try
{
telemetry.ResultCode = ((int)numberFetcher.Fetch(exception)).ToString(CultureInfo.InvariantCulture);
}
catch (Exception)
{
}
}

If i continue here then the database gets created. Next time when i run the code, i didn't get the error until i delete the database again.

Will be grateful for any help in this.

Thanks
image

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.