Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

247 Comments

      1. Hello Mukess
        very nice work , thanks ,
        we still waiting for RTL layout to support arabic culture also.
        thanks .

      2. Hi Mukesh,
        Hope you are good,
        I am using this architeture before 1 year really its very nice work but need to implement third party authentication like microsoft azure so could you please give the suggesion for this actually I am trying to add this feature but unable to add this yet.
        please assist.

        Thanks

  1. Hi Mukesh
    I am wanting to use Blazorhero in a SAAS application. Users need to be able to register ON THEIR OWN, not through the administrator.
    Should there not be a menu item at top right allowing this as is common in .net core apps ?
    I would be grateful if you would shed some light on this?
    Many thanks
    Luke

  2. Hi!
    I am trying to follow your steps but update-database command does not work and shows this error:
    PM> update-database
    Build started…
    Build succeeded.
    The specified deps.json [C:\Users\saqib.khan.SDD\source\repos\BlazorHero.CleanArchitecture1\BlazorHero.CleanArchitecture1\BlazorHero.CleanArchitecture1\Client\bin\Debug\net5.0\BlazorHero.CleanArchitecture1.Client.deps.json] does not exist

    Please help.

      1. Saqib Khan ha
        I’ll answer you. If you generate your project using the command line everything is fine, if instead you use the VisualStudio wizard obviously some references are lost and the migrations no longer work correctly

    1. Saqib Khan ha
      I’ll answer you. If you generate your project using the command line everything is fine, if instead you use the VisualStudio wizard obviously some references are lost and the migrations no longer work correctly

    2. Just set server application as startup not client then update-database on infrastructure project
      I hope that help

  3. You put a lot of work into this, nice job; very high quality. I know this is brand new off the presses and you’re still finishing things up, but maybe someday a GraphQL version of this would be great, maybe with Hot Chocolate. If your thinking of your next project that is and needed an idea. In the meantime, I’ll check this out. Thanks again.

  4. Hi Mukesh,

    I would like to ask to project structure. Im not sure if i understand it correctly.Client project is dependent on Web project and its not designed to run it separetly like Blazor webassembly or Blazor server?

    Or if you can write few words about this section i would be very happy.

    Thank you very much.

    1. Hi Radim, This is a very usual WebAssembly implementation with ASP.NET Core Hosting Model. The project dependencies are what you get normally out of the box with Blazor WASM. You will have to set the Server as the startup project to fire up the entire application.

      Regards.

  5. Awesome piece of knowledge, specially for someone new to dotnet – like me.
    For any others who want to run this code on mac, You have to change few things.

    – install docker + mssql in it ( standard docker installer for mac )
    than from terminal:
    docker run -e ‘ACCEPT_EULA=Y’ -e ‘MSSQL_SA_PASSWORD=YourSTRONG!Passw0rd’ -p 1401:1433 -d microsoft/mssql-server-linux:2017-latest
    – generate new sln like in this article and change like follow:
    in files appsettings.Development.json appsettings.json change db configure string into: “Data Source=192.168.0.110,1401;Initial Catalog=WarehouseDb;Persist Security Info=True;User ID=SA;Password=YourSTRONG!Passw0rd;Pooling=False”
    – restore solution nuget packages, set run to Warehouse.server
    – go to terminal into: /WarehouseManager.Insfrastructure & launch:
    dotnet tool install -g dotnet-ef
    dotnet-ef database update -s ../WarehouseManager/Server

    than you can successfuly run this project

    for testing and education purpose you may consider changing mssql into sqlite – much simpler to work with ‘core’ dotnet in mac / linux / mobile
    there is a lot of useful packages you use – according to your other excellent article (onion..) writing separate article how to embed every used tool maybe good idea ; yes – i know this is a lot of work
    once again – great article, every small project should have scalable architecture from the begining

    1. Hi Luke , Thanks for the feedback. Do you have any suggestions or feedback regarding the project.

      Thanks for the instructions regarding Mac as well. Will post this to the blog shortly.

      Regards

      1. Hi
        I am trying to switch to SQLite. Is it possible. Also, I am forced to use Core 5 as the template does not support 6. Any workaround this?
        Thank you in advance.

          1. Hi Mukesh
            I now tried the fullstackhero and after 3 hours i am totally lost. Is there any possibility of creating a video like with this app. I really can see the benifit but can’t even get the api working
            Regards
            Willie

          2. Reply to below post:
            I changed to SQLite. In the docs it does not explain but in the code it does support. Got a problem on the Hangfire. Tried SQlite but gave an error. Then i switched Hangfire back to Sql but still got errors.
            Personally i would like to disable Hangfire but could not see where to disable that.
            Its alao the first time I ran a dot net app outside if the Visual Studio environment. Also don’t know how i would debug the api.
            With help of the youtube video i manage to create a fullblown app with nearly no experience. Then core 6 cane out and i was hoping to create the same app on core 6.

          3. Ok, started over and used the defaults set to MSSQL. All worked. The switched the database to SQLite. That worked to. Then I changed hangfire. If I run it i get this error
            11:07:10 FTL] Unhandled exception
            System.ArgumentException: Could not find connection string with name ‘Data Source=fullStackHeroDb.db’ in application config file
            at Hangfire.SQLite.SQLiteStorage.GetConnectionString(String nameOrConnectionString)
            at Hangfire.SQLite.SQLiteStorage..ctor(String nameOrConnectionString, SQLiteStorageOptions options)
            at Hangfire.SQLite.SQLiteStorageExtensions.UseSQLiteStorage(IGlobalConfiguration configuration, String nameOrConnectionString, SQLiteStorageOptions options)
            at FSH.WebApi.Infrastructure.BackgroundJobs.Startup.UseDatabase(IGlobalConfiguration hangfireConfig, String dbProvider, String connectionString, IConfigura

            Not sure how to fix this.

          4. Have you changed the StorageProider in hangfire.json config as well? If that’s done, maybe try to give an absolute path for the DB and check, maybe like C:\mydb.db or something?

          5. Yes, updated Hangfire.json. Tried that too. Even tried setting it to C:\Test\fullStackHeroDb.db.
            The only way I could get around this was to start with MSSQL and then it would create the SQL Database and then switch the app to SqLite and leave Hangfire.json to sql.
            At least for now I can work with it.

          6. Hi Mukesh
            Ok, got the API working perfectly and now moved on to the Blazor WebAssembly. There are no documents on how one would go to add an item in the category section. It also works totally different from BlazorHero.
            Any suggestions or when there will be some documentation as to how to proceed?

  6. Hello!

    Thanks for the excellent work! Could you maybe explain a bit more about all the different projects you use ini the solution and the reasoning behind it?

    Thanks!

    1. Hi Mike, Thanks for the feedback. As far as the Project structuring is concerned, I am using an Onion/Hexagonal Architecture with Separation Of Concerns. This is the architectural design I use in most of the production applications as well. As mentioned in the Important Links section of this article, please go through this guide to understand the reasons behind each and every projects – https://codewithmukesh.com/blog/onion-architecture-in-aspnet-core/

      Regards

      1. Hello!
        Thanks, I did read through this article but the BlazorHero template seems to be an extension of this approach with additional bits. Could you maybe explain the separation of concern for the different projects in summary? e.g. Infrastructure vs InfrastructureShared vs Shared and also which project should reference them?
        Thanks for your help!

  7. This looks really great. I’ll have a play with it in the next week or so and give some feedback.

    Thanks heaps!
    Sandy

  8. Hi Mukesh,
    congratulations, great job, a perfect starting point for admin type projects, but I would ask you for a system to generate the Blazor Client project with PWA support (like –pwa option)

    Thanks!

  9. Hi Mukesh,
    Really, it is great article. However, I am unable to populate all the tables in the database, it is showing only 10 tables related to users. You did not mentioned how to add migration just added update-database.
    Can you please advise.

    1. Hi, Thanks!
      Since all the required migrations are already added to the application, I have not mentioned them. However, it’s the same method as you would do for any other application.
      Here is what I would recommend, if you want to re-add the migrations.
      1. Delete the migrations folder from the BlazorHero.CleanArchitecture.Infrastructure project.
      2. run `drop-database` command to cleanup the existing database.
      3. run `add-migration initial` command
      4. and finally, `update-database`. This should create almost 11 new tables on to the database.

      Every time you add a custom entity in code, add it to the ApplicationDbContext and re-run steps 3-4.

      Regards

      1. Hi Mukesh,

        Good work. Thanks for saving lot time and digging debugging in inplementation of SignalR, MailService, Roles ,permissions and ect..
        which are prerequisite now for any we apps.

        I Need some help in adding new Modals to the project which will add some meaning to my project.
        . If possible could you please provide the sample code or instructions to add new entities to the project.

        I am really exited and looking forward for the next version of blazor hero 3.0.
        Regards,

  10. Hi there, one suggestion is to use in routes.Endpoints instead of passing parameter by parameter(currently with page size and page number) , pass the object itself.
    IT´s better if we would like to filter with more properties and we do the filter query in server side instead of client side.
    Possible suggestion for Products -> GetAll:
    –ProductsEndpoint
    public static string GetAllPaged(GetAllPagedProductsRequest request)
    {
    var url = $”api/v1/products?{GetQueryString(request)}”;

    return url;
    }

    public static string GetQueryString(object obj)
    {
    var properties = from p in obj.GetType().GetProperties()
    where p.GetValue(obj, null) != null
    select p.Name + “=” + HttpUtility.UrlEncode(p.GetValue(obj, null).ToString());

    return String.Join(“&”, properties.ToArray());
    }
    The “GetQueryString” would be a extension .
    Products Controller:
    public async Task GetAll([FromQuery] GetAllPagedProductsRequest request)
    {
    var products = await _mediator.Send(new GetAllProductsQuery(request.PageNumber, request.PageSize, request.SearchString));
    return Ok(products);
    }
    Just a seggestion.Thanks, Excelent Work

  11. Hi Mukesh,
    I’m really impressed with your projects,
    Just I want to mention that after refreshing the page the hubconnection take time to connect and affect the UI, normally it runs in the background but when and if I hit refresh again an exception is raised on MainLayout.razor.cs in the line 45 => await hubConnection.StartAsync(); and it reloads normally again
    I’m using BalzorHero V2.0, is there any thing I should do to fix it or it is by design?
    Thank you and keep up the good work

      1. Hello, when I publish V2 on smarteraspnet I get a HTTP Error 500.30.
        I had no problem with V1

        From dotnet new BlazorHero.CleanArchitecture -n without modification
        Migration is well done: tables are created.
        log20210424.txt si created but empty

          1. Failed to load resource: the server responded with a status of 500 (Internal Server Error) /favicon.ico:1
            Failed to load resource: the server responded with a status of 500 (Internal Server Error) xxxxx-001-site1.itempurl.com/:1

          2. I had a problem with my ConnectionString not modified in appsettings.json when publishing. After resolution of this problem, the log file gives me the reason :
            System.IO.DirectoryNotFoundException: h:\root\home\xxxxx-001\www\site1\Files\

            The directory is well included
            But this directory does not exists when creating the solution from your template. The directory is only created when when add a profile picture.

        1. I’m also getting this error. The error under Debug is to be

          An exception of type ‘Microsoft.Data.SqlClient.SqlException’ occurred in System.Private.CoreLib.dll but was not handled in user code
          Invalid object name ‘Identity.Roles’.

          I’m not sure why it’s having issues with this, as I have run update-database the the tables all exist..

          1. Also, the roles are not getting seeded, so the error must be happening when it’s trying to seed this table.

          2. I would suggest to drop the entire database. Delete all the migrations files under the Infrastructure project. Regenerate the migrations using the add-migrations command and try to run the update-database command. It should work fine.

  12. hi Mukesh,
    I am trying to learn mudblazor.
    I am looking for front end of this project.
    I want to look at razor file / components .
    in which folder i can find these files.
    thanks

    1. Even deploying on another dev’s subscription, fresh, same result. Any clues why I’m getting the “500.30 In-Process Startup Failure” error? I can run locally connecting to Azure db, but can’t run the same app on Azure.

      According to MS
      Common failure conditions:

      – The app is misconfigured due to targeting a version of the ASP.NET Core shared framework that isn’t present. Check which versions of the ASP.NET Core shared framework are installed on the target machine.
      – Using Azure Key Vault, lack of permissions to the Key Vault. Check the access policies in the targeted Key Vault to ensure that the correct permissions are granted.

  13. Hi Mukesh,

    It’s awesome projects, very cool.
    I have problem with mail service when register new user, the mail not send to the inbox, do you have sample code for implementation IMailService?

    1. Hi, the email feature is tested and is working as expected. Currently, we are using Ethereal mailbox for test purposes. The characteristics of the Ethereal is quite different. It doesn’t deliver the mail to the mailId of the registered user, but to the mailbox of the ethereal account itself. You can find the ethereal test credentials in the appsettings of the server project. Do let me know if this helped.

      Thanks

  14. Thanks for this.
    We have a Telerik subscription. I’m wondering if it would be easier to learn/use MudBlazor or just re-engineer this for Telerik. What do you think?

    1. You are welcome.
      It depends on your preference. MudBlazor is not a very tough library to learn. Also, the MudBlazor team is quite active in the development.
      Although, since the dependency to MudBlazor is just at the Client Project, you could easily switch to Telerik by Creating a similar project and moving over the controls as required.

      If you are already comfortable with Telerik, re-doing the client project would be easier. If you want to explore Mudblazor, then it’s up to you 😀

      Regards

  15. Hi. Awesome project!

    I think prerendering support will be great for UX. It will make it snappier.

    Thanks!

    1. (I tried it myself, and it entails creating server-side versions of service dependencies like IDocumentManager, IProductManager, etc. These server-side versions will directly call mediator, like what controller does, instead of going through HTTP.)

  16. Hi Mukesh

    I would like to know how to implement blazor hero in a micro services architecture, that is, everything to the backend is in services and blazor hero would only be the frontend, what should I have to know ?, please help.

      1. Dear Mukesh,
        I replaced the SVG file but the previous logo still appears on animated LOADING SCREEN???

      2. Hello Mukesh,

        can you tell me, if there is a way to disable the laoding screen when opening the web application?

        Or can you tell me, how i can find out, why it takes over 10 seconds in loading screen, when i start the application for the first time?

        Thanks!

        1. The browser downloads the dlls on the first startup, which is around 30Mb.This load time will be improved in the future versions of blazor as well as blazorHero.

  17. Hello and good day,
    First Thanks for your excellent work Mukesh. it’s a great work and I’m going to use it in my currently starting project. but i have a small problem. in my domain layer(Sandbox.Domain.Entities as you see), i need to have a relation to the ApplicationUser model that exists in application layer(Sandbox.Application.Models.Identity). but the problem is the domain should not have any dependency to the libraries. for example i need to have something like this:

    namespace Sandbox.Domain.Entities
    {
    public class Car : AuditableEntity
    {
    public virtual ApplicationUser Owner { get; set; }
    public string Title { get; set; }
    }
    }
    The error says “the type or namespace name ‘ApplicationUser’ could not be found”

    1. Hi, in this case, you can have 2 approaches.
      1. Make use of ICurrentUserService interface that can return you the UserId from Server Project. You can use this id further to query additional details that you may require, by ofcourse creating or extending the existing User Service.
      2. Yes, ideally you should not have direct access to the IdentityUser Entity. One way is create a new Model similar to IdentityUser in the application / domain Layer and map the original entity to this newly created entity.

      Personally, Approach 1 would be my choice.
      Thanks

      1. Hi, Mukesh
        Thank you very much you are doing a great Job.
        please am having a challenge creating a page like brand.razor in the Client side, the challenge is while am trying to add a page it only bring .cshtml but not .razor or may be am missing something , please help thanks.

      2. I prefer approach 1 too. but without adding navigation properties in domain models, how do you achieve this? in my example, i need a relation between Car and ApplicationUser. The ‘Car’ is in ‘Domain’ layer and ‘ApplicationUser’ is in ‘Application’ layer.

      3. However, without a navigation property set, if I return with Entity Framework a list of Cars, I cannot get the owner first and last names in the same query. I have to call the service N times to get each user in order to populate the car entity with the owner. Is there a… third approach?

  18. Thanks for the great project. I especially like the user/role/permissions management built in to the project.

    I’m trying to add a custom method to one repository so that I can get the object by name instead of by Id. In my ICountryRepository I added Task GetByNameAsync( string name ) and in the CountryRepository I added the implementation. I then added a GetByName query and response and modified my controller. However, I get an error in my GetByName query on the line await _unitOfWork.Repository().GetByNameAsync(query.Name). The error is ‘IRepositoryAsync’ does not contain a definition for ‘GetByNameAsync’. I’m sure I’m doing something wrong. How do I correctly add the custom method to the repository and have it accessible by the UnitOfWork?

  19. Hello mukesh
    thanks for your great concepts
    when I execute ‘update-database’, it is successfully done but don’t create database , do you know about this issue?

      1. Mehrdad / Mukesh,

        I figured out the database problem. It isn’t finding the db specified in the appsettings.json file so it creates a new database somewhere else. I’m not that skilled in SQL Server so I can’t coment ass to what is wrong. I can tell you I discovered the missing databases via Visual Studio, SQL Server Object Explorer

        Mukesh, really nice job on this, very powerful.

        Craig

  20. Hi Mukesh,

    Excellent Work! I Thank you!

    I just checked on my mobile and some pages seems to not be too much responsive.
    i.e.:
    – buttons to create / edit / delete
    – Audit Trails grid

    is that something that you plan to fix in a future release?

  21. It is very good work. It helps me to learn Blazor and Clean architecture. It works for all browsers except Internet exploer. In IE it shows SCRIPT1002: SCRIPT1002: Syntax error. How can I solve the problem?
    Thank you

  22. I see you implemented a generic repository pattern with unit of work, but it’s not clear to me how to implement if I need get data from a repository like the following example TheRepository.Where(c=>c.CreatedBy==’Francesc’), is it possible ?

    Thank you!

    1. Jut to be clear I mean in the query handlers. I need to show grid data just for the user who created the data.

      Thank you!

  23. Hi again Mukesh. would you please help me how i can read a list of model that has a navigation propery? in class GetAllConnectionsQueryHandler , the handle method is like this:
    var connectionList = await _unitOfWork.Repository().GetAllAsync();
    var mappedConnections = _mapper.Map<List>(connectionList);

    Connection class has a property name ‘Host’. for example:
    public class Connection : AuditableEntity
    {
    public int Port { get; set; }
    public int HostId { get; set; }
    public Host Host { get; set; }
    }
    but when is try to read connection list, although the HostId has value but the Host property is empty. how can i force the query to load the entire Host properties?

  24. Thanks Mukesh for this awesome work. I am still exploring it but it is a great starting point.
    A suggestion: I see that the action popup on the products and brands goes behind the table window. Not sure if I explain myself. It would not be an issue when the table has more than 3 items already.

  25. Hello Mr.
    All Thanks.
    If you can add a RTL Language like Arabic I will definitely add the translation for it in all razor pages

  26. i came across with this error: An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: Could not parse the JSON file.

  27. Hi Mukesh

    Thanks for great effort!

    Looking at the data retrieval side of things you appear to grab content in page size blocks from the webservice and then sort that page back on the client rather than sorting on the server and then paging back the data. Is there a reason for this? There is also a dependency of EF core at the client?

    What would be a great addition is to handle Guid PK types rather than just int. Different clients use different types but I must admit to always using GUID’s for many years now. I have swapped out the int for Guid, changed some of the default checking and it works OK but a bit of a kludge.

    Keep up the good work.
    cheers
    Tim

  28. Hi Mukesh,
    Thank you for the template. Nice work.
    I think it would be good to have a tutorial/write up upon how to create further entities and how you have wired up the components. This is kind of a big solution now, so a documentation would be better.

    Thanks and Regards.
    Manvendra

    1. may be old, but I had the same issue and the fix was adding the options c,p,s
      dotnet ef database update -c BlazorHeroContext -p .\WarehouseManager.Infrastructure\WarehouseManager.Infrastructure.csproj -s .\WarehouseManager\Server\WarehouseManager.Server.csproj

    2. may be old, but I had the same issue and the fix was adding the options c,p,s

      dotnet ef database update -c BlazorHeroContext -p .\WarehouseManager.Infrastructure\WarehouseManager.Infrastructure.csproj -s .\WarehouseManager\Server\WarehouseManager.Server.csproj

  29. Hi Mukesh & fellow readers,

    This project is awesome and such a huge help for a starter like me. Can anyone please advise if there an easy way to connect to a postgresql database rather than SqlServer?

    I’ve downloaded nuget packages:
    Npgsql
    Npgsql.EntityFrameworkCore.PostgreSQL
    Npgsql.EntityFrameworkCore.PostgreSQL.Design

    I’ve played around with the connection strings and put a bit of time into researching postgresql/entityframework. I attempted changing .UseSqlServerStorage in the startup to .UseNpgSql… (found on another thread)

    No matter what I try, when I run:
    PM> update-database
    I can’t seem to load the database. I can’t remember the exact fault/log item and I’ve cleaned the solution. When I load the defaults, it works fine.

    If I want to connect to a postrgesql database, will i need to change anything other than the 2x connection strings in the appsettings.json and appsettings.Development.json?

    I’m not sure if I had the nuget packages installed to the right folders of the solution. My next attempt will be to ensure they are in the same locations as the nuget packages:
    Microsoft.EntityFrameworkCore
    Microsoft.EntityFrameworkCore.Design
    Microsoft.EntityFrameworkCore.SqlServer

    Is anyone on this thread able to point me in the right direction please?

    Appreciate all your efforts Mukesh

    Thanks

      1. Hi Mukesh,

        Once again thanks for all your efforts I am learning so much making my way through your blog.

        With regards to BlazorHero I’ve been playing around trying to get Postgresql working some more and am still getting stuck.

        Do you think I should be trying to get Postgresql working before running the update-database command or migrating to it after?

        Have you had any progress with supporting Postgresql?

        Do you know if there is there a simple way to switch to Postgresql with any the projects in your blog?

        How many coffee’s would it take to expedite this feature in BlazorHero 😉

        Thanks

        Ben.

        1. Hi Ben, Please check Gert’s comment on this article. He was able to set up PostgreSQL without an issue. I am currently working on fluentpos. Once that is done, I will be back to blazorhero.

          Regards.

          1. Hi Mukesh & Gert,

            Thank you both for your help. I got it working, this is awesome!

            Apologies, I totally missed the comment from Gert. It was 2:00am and had gone cross eyed from looking at the screen for too long.

            Looking forward to seeing what you come up with next.

            Cheers.

    1. Hello everyone,
      Thank you Mukesh for the awesome template it saves a lot of time from doing everything from scratch
      I thought I would share to help others… I have just set it up using Postgres and it is working without a problem.

      1. You would need two additional nuget packages Hangfire.PostgreSql and Npgsql.EntityFrameworkCore.PostgreSQL.

      2. In startup.cs change x.UseSqlServerStorage => x.UsePostgreSqlStorage.

      3. In ServiceCollectionExtensions change it to .UseNpgsql by the AddDatabase method.

      Lastly dont forget to delete the migrations because it was generated for SQL. Once deleted add-migration and then update-database and you should be good to go.

      Have a good one.

  30. Hi,

    great job. Sorry if that’s a stupid question, blazor noob here, but can I also use this for blazor server apps?

    1. This is intended to run as a Blazor WASM App. However, I am also finding ways to make it switchable to Server Mode. Probably somewhere down the road 🙂
      Regards

      1. Thanks for your excellent post, when I do what it says for mysql it gives me errors in the migration, could you review it?

  31. Hi Mukesh,
    What’s the difference between Infrastructure.Shared and Shared folders?
    How can I know put my shared class in a proper shared folder?
    Thank you

  32. Hi, what is the correct way to check that a User is in a Role (e.g. from a Razor page)?
    I can see it’s done here in RoleService but I can’t seem to inject this into my page.
    await _userManager.IsInRoleAsync(user, existingRole.Name)

    Thanks.

  33. Hey, love this, but in SwaggerBasicAuthMiddleware context.User.Identity.IsAuthenticated is always null even when logged in… Any ideas? Thanks

    1. I need the same. I tried to do something similar to “Brand” but I can’t finish, I got to the migrations but I have an error

  34. Mukesh,

    This, and basically everything else in your site are fantastic and I appreciate you putting everything down in a very easy to understand format like this. Enjoy the coffee!

    That being said, I am looking to extend the system and replace the products / brands models with an architecture that has “company”, “sub company”, and various supporting data types under each sub-company. In browsing the code I am seeing a LOT of different places where these brands and products are configured, so I was wondering if you had a guide for adding new data types that I can use to help me.

    Thanks again!

    Don

    1. Hi, Thanks.

      Detailed documentation for adding new entities will be coming along with BlazorHero 3.0. But otherwise, the implementation is pretty straightforward to understand. You could just debug the code and understand the current flow as well.

      Regards.

  35. This looks interesting, thanks for sharing the code. Can it work with other DBs apart from MS SQL? I would like to use sql lite for a lightweight project.

    1. Thanks! yes, it definitely will. The project supports all the DB Providers that are already supported by EntityFramework Core. By default, it works with MSSQL. But you can easily switch to SQLite –
      1. Installing the EFCore.SQLite package to Infrastructure project
      2. NAvigate to BlazorHero.CleanArchitecture.Server.Extensions.ServiceCollectionExtensions and change Line 178 as required for SQLite.
      3. Remove and re-add migrations

      However, with 3.0, I am planning to add support for other dbs as well by default. SQLite, PostgreSQL, etc.

      Regards

  36. Hi, does anybody knows the connection strings for PostgreSQL? I tried many different strings but keep getting this error.
    [Error]
    Keyword not supported: data source (Parameter ‘keyword’)

    [My connection string]
    “Host=localhost;Port=5432;Database=HeroesDB;User=postgres;Password=123”

    Someone, please help me. Thank you

    1. Hi,
      This is the string that i use for fluentpos project
      “postgres”: “Host=localhost;Database=fluentpos;Username=postgres;Password=root;Include Error Detail=true”
      Hope this helps

      Regards

  37. Hey Mukesh,

    I’ve been using this for awhile, it’s awesome. I was wondering if you have plans to add Fluxor or a similar state management library?

    If so which one would you add?

    Thanks

  38. Hi Mukesh, I had created another page exactly same as Brand, but when I open the page, the table not showing and I got error. Do I need to create another IResult.cs and Result.cs?

      1. Hi Mukesh,

        Thanks for a great project.

        I am having a similar issue to the one above. I have a duplicate the brand entity (which is called round). I have duplicated all of the necessary files (responses, queries, endpoints, permissions etc) and made the required name changes but when I make a call to the RoundsController I get the default index page returned instead of the data. Do I need to register the new controller or endpoints somewhere?

        1. Hello Brian,

          I run in the same issue and found a solution.

          As example for your RoundsController.

          1. Be sure, that you duplicted all files correct.
          2. I used the TotalCommander and searched the project folder for all files “*Round*.cs” and “*Brand*.cs”. Compare the files count.
          3. Search all files for “*Round*.cs” and in these files for “brand”. So I found some locations where I missed to changed from brand to round.
          4. Don’t forget to add the new namespace in the _imports.razor file. It is the only file without ending *.cs to modify.
          5. Start the project and use Swagger to test your new RoundsController. If you call GetAll() the breakpoint in RoundsController .GetAll() should be reached.
          6. If this works, the problem can be in case sensitive api call. I don’t know why, but the route for the RoundsEndpoints didn’t work with lower case. Lower case for BrandsController is working instead. So change in RoundsEndpoints.cs the route for GetAll from “api/v1/rounds” to “api/v1/Rounds”.

          Greetz,

          Frank

  39. Very Nice job, we tried to use it though and it seems tha the update-database does not create the database and tables at all. We tried also with the database created but still no luck

    1. same issue when using sqlexpress in the appsetting file. update-database says Done with no errors but no db is created.

  40. Hi !
    I’m create new folder and add modal. When i build project client then error
    Login.razor.g.cs(11, 18): [CS0234] The type or namespace name ‘Collections’ does not exist in the namespace ‘itphonui.Client.Pages.System’ (are you missing an assembly reference?)
    How to fix it.
    Thanks

  41. Hi, Mukesh. Can I know why there are 2 connection strings in this Blazor Hero template? One at appsettings, another one is appsettings.development

  42. Hi Mukesh. great work. no doubt about it. but i do have few questions if you don’t mind.
    1 – you have another OSS protect. the Microservices based architecture. why didn’t integrate both together ? it would have made more sense.
    2 – what’s the point in having the same features in both sides server and client ? moreover, why neither of them uses the API ???
    3 – the login on the client does not work …. it is attempting to make a call locally instead of the server api ….

    thanks for answering.

  43. Dear Mukesh
    very thanks for Good Application that share with us
    i have a question,
    why when i want to debug project , faced with Error.
    could you please tell me one solution for debugging

    regards Majid

  44. Hi Dear Mukesh,

    At first i want to thanks for your great jobs ,
    and my question is when blazor hero 3.0 will be released with modular monolithic architecture . we are waiting for this issue and this will make us grateful and happy.
    Best Regards

  45. Hi Mukesh,
    Thanks for creating a wonderful project. Let me take this one for the next project and I will update you on my experience.

  46. Hello Mukesh, Kudos. Thanks, your work is amazing and saved me a lot of time. I am curious about this code inside your AuthenticationManager:
    >> ((BlazorHeroStateProvider)_authenticationStateProvider).MarkUserAsLoggedOut();
    Why do you cast it like this instead of using an instance of BlazorHeroStateProvider or you could work with an Interface. I tried doing it the other way but I could only get it to work by explicitly casting just like you did. So is there any explanation why do we need to implement it this way?

  47. Hi, Mukesh I am trying to Get data by Id, am I doing correctly with these lines of code? GetByIdAsync from the DocumentManager.

    var request = new GetPersonByIdQuery { Id = id };
    var response = await PersonManager.GetByIdAsync(request);
    if (response.Succeeded)
    {
    Response = response.Data;
    }

  48. Hi Mukesh,

    Its really a good work. Thanks for saving my time.
    Need one help. i need to call a stored procedure. can you please provide the sample code for that.
    Also, when can we expect the next version of blazor hero 3.0 ?

  49. Hi Mukesh,

    Good work!!.
    Thanks for saving lot time and digging debugging in implementation of SignalR, MailService, Roles ,permissions and ect.. which are prerequisite now for any web apps.

    I Need some help in adding new Modals to the project which will add some meaning to my project.
    If possible could you please provide the sample code or instructions to add new entities to the project.
    I am really exited and looking forward for the next version of blazor hero 3.0.

    Regards,

      1. Yeah, it is. But its empty. Only Topics. I think that there should be some more documentation but Mukesh is focused more on other project right now and looks like no one want to contribute to expand guide 😀

  50. Hello Mukesh,
    Very excellent template and I have already published one app based on (v2.2) and I’m working on the second.
    Minor problems I have faced,
    As the template replace the default events for the jwt authentication, you will face a problem if you need to use lifetime validation for the token, since both access and refresh tokens are used, without the life time validation, the process to invalidate the current token for the user became harder than just clearing the refresh token in the server,
    Also, for public access, the used events prevent any access without authorization.
    I couldn’t reach the requested endpoint attributes from the event to work with them, so I fallen back to the default.
    The second was with rtl support being related to the language, I have made a work around which works fine by adding property to the language code class
    Again, this is meant as a constructive feed back and thank you very much for this template, it saved me a lot of working hours.

  51. hi Mukesh… thanks for this great template..
    i want to ask, how to implement Identity Server 4 on WASM .net core hosting??

  52. Dear Mukesh,
    It’s awesome.
    Thank you sir.
    There is no problem but
    I have question like Radim’s question.
    How does routing work in this project?
    When we request “https://localhost:5001/dashboard” url, how does server route my request to dashboard page in Client project?

    1. Hi, Routing works like any other Blazor project.

      Each page’s razor file has this code on top -> `@page “/dashboard”`
      The above code is from Dashboard.razor. Whenever you navigate to /dashboard, the associated razor page is invoked by default.

      Regards

      1. Yes, that’s right.
        but the base address is “https://localhost:5001” that is for “Server” project not “Client” project.
        Actually as you mentioned in this “Make sure that you set the YourNamespace.Server project as the startup project.”, we start “Server” project on “https://localhost:5001” address but routes like “/dashboard” belong to “Client” project.
        How does this work?

  53. hey Mukesh

    this really is cool work ..

    I am trying to change the template so a created app uses drawers for editing rather than dialog, any pointers as to how to accomplish

  54. Hi Mukesh.

    This is aboslutely awesome. Just curious if you have a guide on launching this on IIS? I keep running into HTTP Error 500.30 – ASP.NET Core app failed to start when I publish it on my test server IIS. I have installed the hosting bundle and run times for dot net core 5.0. Any help would be much appreciated.

  55. Can we have Windows Authentication support for this project?
    Login page to add one button, Windows User auto login.

  56. Hello, very nice clean code!

    One question: how can we implement a proper filter, that filters multiple columns ?
    You currently have that searchString that searches for that value in EVERY column/property.
    But: what if i want to implement a filter like :
    string nameFilter
    string addressFilter
    DateTime dateFilter
    And then, build the query based on these multiples with some logic like :
    p => p.name.Contains(nameFIlter)
    then
    p => p.address.Contains(adressFilter)
    Etc.

    ?

  57. Hi Mukesh,

    This is a fantastic project, but I was wondering if we could create a Blazor server fork of it or if someone could provide some guidance on converting from WASM to server? It would be great to have both templates, but if there’s a relatively easy way to convert that’d be good to know too.

  58. Congratulations on your brilliant work. My only problem is that I cannot upload larger documents. What is the best way to upload documents larger than 10MB? The API currently aborts the process after approx. 5MB.

  59. I need help. Can someone explain how to combine what was built here and adding Linq or query language queries?
    Using the current _unitOfWork stuff and then add something like this:
    var data = await _unitOfWork.Repository().Entities
    .Join(Person,
    Employee => e.Id,
    Person => p.Id,
    (e, p) => new {
    Id = e.Id,
    FirstName = p.firstName,
    LastName = p.lastName,
    City = p.City
    }
    )
    .Join(EmployeeSchedule,
    Employee => e.Id,
    EmployeeSchedule => es.DateAvailable,
    (e, es) => new {
    DateAvailable = es.DateAvailable,
    Available = es.Available
    }
    )

    Help? This isn’t my universe.

    Thanks

    Craig
    (Also adding a discussion page to the github pages like MudBlazor has, maybe?)

  60. Hi Mukesh,

    How easy is it to use Syncfusion components (like their DataGrid component) in the client razor pages instead of using EditForm?
    I can get their components running easily in a blank EF Server application, but find it difficult to integrate it in a Clean Architecture application, which is what I want to use for my projects.

    Andries

    1. Currently, blazorHero has a dependency on MudBlazor. It was designed that way. Probably with the future releases, will find a way to decouple the UI components. I will mostly include this in the Blazor variant of fullstackhero.

  61. HeIlo mukesh,
    I followed all the steps detailed on the post as well as on the YouTube video and I have the latest .Net 5 and visual studio(version 16.11) installed and I have checked if. Net 5 is installed correctly, it has and I also made WarehouseManger.server as my start up project. But after completing every step correctly when i run it shows an error that says “culturenotfoundexception: culture is not supported. (parameter ‘name’) km_kh is an invalid culture identifier. system.globalization.cultureinfo..ctor(string name, bool useuseroverride) culturenotfoundexception: culture is not supported. (parameter ‘name’) km_kh is an invalid culture identifier.” I found out this kind of errors usually are associated with the language and region of your machine. Am running windows 8.1 on my laptop does that might be the case?

    1. I think you may need to remove the km_kh language from your version of BlazorHero. Guess your system has hard time understanding the culture keyword. Do let me know if that helps. Regards

  62. Hello Mukesh,

    I just wanted to ask that the project only runs when i run it on kestral server and not on iis on my development machine. Can there be any problem when i deploy it on server iis? or what if i deploy it on Azure? is there any chance i face deployment problem? and lastly, why is there problem in dev environment using iis in the first place can u explain that? Thanks in advance 🙂

    1. Hi this project is already deployed on to Azure by many developers. You may have to change launchSettings and modify the IIS Profile to make it work. You can easily find it online.

      1. Hi Mukesh,
        Can’t find anything related in online to change launch settings which works deployment in IIS , If you any online reference please provide us, Thanks

  63. Hi,

    Thank you for this amazing project!

    Some other users asked already and I couldn’t find any answer: I would like to understand better if this project is a Blazor Server Side project, because, from what I learned so far, the Server is using the Client and in the browser I don’t see that the server .js is used.

    I’m aiming for Server Side website that will run also in browsers not compatible with web-assembly. Is that possible with this project? The Visual Studio Blazor Server Side template allows that and I’m thinking… would be difficult to port this to a full Server Side app?

    Thank you!

  64. Hello Mukess, very nice work , thanks a lot fot that.
    but I have one question about IdentityUser, I need to use it in the Domain project
    How I can do that whitout broken the structure of the project ?
    (I new in Asp.net)

  65. Hi Mukash,
    Again this is very awesome project. if am not mistaken the audit trails only tracks the activity of the current logged in user, but I wanted to make it track all the users especially those with basic role in order to implement a better supervisions on the system users to avoid any unnecessary changes.

    Thanks

  66. Hi Mukesh,
    First of all thanks for your work, is awesome!
    I have a issue that I cannot drive it. Please help me:

    I need, for example, list all product for a brand. For that, I include Ienumerable attribute products on brand entity:
    public virtual ICollection Products { get; set; }
    Add too in responses.
    But in razor I receive the Icollection attribute Products empty, null
    I cannot see where to fill it with all products for that brand.

    I hope u can share some knowledge with me

  67. I’m getting a build error that I can’t seem to fix. Any help would be appreciated. Thank you.

    Error AL1065 File name ‘obj\Debug\net5.0\acu_web_solution.Application.Resources.Features.ExtendedAttributes.Commands.AddEdit.AddEditExtendedAttributeCommandLocalization.en.resources’
    is too long or invalid

    1. I tried deleting the debug folders, clean & rebuild.

      Also checked my registry key and it’s already set to 1.
      Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled (Type: REG_DWORD) must exist and be set to 1.

      1. I’ve isolated the issue to this: Having my project on my local disc but inside of a OneDrive Sync’d folder is what’s causing the issue.

  68. Hi Mukesh,

    I am facing below issue after hosted in iis server.
    Failed to find a valid digest in the ‘integrity’ attribute for resource ‘http://abc.xyz.com/_framework/AutoMapper.dll’ with computed SHA-256 integrity ‘2UwMB6TJWR7IL29DunLOHliu/B/WXftGTXcC0mXvVqg=’. The resource has been blocked.
    abc.xyz.com/:1 Unknown error occurred while trying to verify integrity.

    Please reply

    1. Hi:

      I faced the same issue. I solved it by deleting all the OBJ and BIN directories under the solution. Rebuild and republish.

      Hope it helps.

      MST

      1. Actually, it looks like there’s an issue with HTTPS. When I’ve removed https expose and tried running it on HTTP I am getting the DLLs loaded directly into the browser. Not sure how to fix it yet

  69. First Thanks for your excellent work Mukesh.

    I am looking forward to the possibility of logging in using Google or Facebook, how can I do that?

  70. Hi Mukesh,
    Thanks for template.

    Actually the blazor client app is broken. Right now always die when you change between languages.

  71. Hi Mukesh,

    I upgraded the project into .NET 6.0, it worked with no errors.
    Also i tried to play around with .NET MAUI and i succefully added components and required services into .NET MAUI Blazor.
    but i struggle with the http client connection between .NET MAUI Blazor and Blazor wasm.

    i have this error : IPv4 address 0.0.0.0 and IPv6 address ::0 are unspecified addresses that cannot be used as a target address. (Parameter ‘hostName’) (0.0.0.0:443) (something related with hubconnection)

    Thank you for the templates, as a beginner it really helped me to understand Blazor and clean architecture better and hopes you make some post about .NET MAUI Blazor too in the future.

    Regards !

    1. hi , I did try to move it to .net 6 at the beginning, and update all nugets to latest version, however I do have the following errors on the Web/Client/Client project which do not reload any more. The rest is ok.
      The message is ;
      C:\Structure\Learning\Blazor\BlazoreHero2-2\IoT-DashboardBH\src\Client\Client.csproj : error : The element beneath element is unrecognized. C:\Structure\Learning\Blazor\BlazoreHero2-2\IoT-DashboardBH\src\Client\Client.csproj

      net6.0
      true
      IoT_DashboardBH.Client
      IoT_DashboardBH.Client

  72. Hey Mukesh, do you have an approach on securing the jwt? At the moment you could just copy the token from dev tools and trigger the api. There are several best practices but i don’t know witch fits the best for this use-case. I would be happy to implement.

  73. Hi:

    How I change the authentication method to Azure Active Directory integration (register the app under AAD and have all users as the tenant Users)

    Best regards,

    MST.

    1. Hi Msouga,
      Hope you are good,
      have you got any solution for integration of azure active directory ? , actually I am also trying to add this feature so could you please help me. if you got any solution.

      Thanks

  74. Hi Mukesh,
    I’m starting with web development and your framework, documentation and video really helped me immensely to kick start my development journey. Really impressive and inspiring.
    Great effort
    Thanks
    I have one little query….seek your expert help.

    I have this below requirement to handle an optional/nullable foreign key in a table and could not get my head around to get this working for the last couple of days…

    I have defined the model with
    public int? foreign_key_field {get; set;} entry,

    I’m having issues in implementing the Create/Update Blazor code for the same with the <MudAutoComplete component.

    Get error with the Bind and SearchFunction and parameters

    Request your expert help, can you share a sample code snippet to implement the same.
    Rgds,
    Manju

  75. Hi Mukesh

    Thanks for your excellent work.

    In the Readme file, you mention this, regarding Blazor Hero 3:

    “Tutorials to add new entities, controllers”

    Will this be included anytime soon?

  76. Hi Mukesh, i start using this for my learning purpose and it look so awesome. I just wonder do you plan to add 3rd Party or external authentication to the app such as Facebook, Google or even Enterprise provider such as PingId or Okta. I think i can help contribute on the code for this as well as translation to Vietnamese as well, just don’t know where to start … !

  77. Hello Mukesh,
    I have been learning using the project, but i got one problem when the number of permissions increase for the admin user the system just freezes and doesn’t load the dashboard at all. When i delete some of the permissions from the database and make the endpoints authorization allowanonymus it works fine. Mind you if you can help me?

    Thanks in Advance!!!

    1. I believe the problem might be in the size of the JWT Token. If you insanely increase the number of permissions to a particular role, the JWT token might become too large for the browser to process.

      1. Thank you for your fast replay, I got you, is there anyway for the permissions not to be seeded for the admin role immediately? Because every time i add a new permission it will be added to the admin role instantly. May be if there is anyway like, to add permissions selectively for the admin role?

  78. IIS 10 Publish Error in
    await hubConnection.StartAsync();
    the Error is
    Failed to load resource:/signalRHub/negotiate?negotiateVersion=1:1
    the server responded with a status of 405 (Method Not Allowed)

    Please Help

  79. Hello Mukesh,

    this is awesome, really amazing work. One question: Is there any turorial or short guidance about how to properly add new features/models to blazor hero in order to leverage all the implemented functionalities?

    Kind regards, Gert

  80. I love the project <3 but I need a step by step on how to implement a CRUD. If you could add this I would really appreciate it.

  81. Hi Mukesh,
    Hope you are doing well,
    I am trying to integrate Microsoft Azure login feature but I am unable to add this feture yet,
    I am redirecting on microsoft page for login/logout user but unable to fetch the user claims that’s why I am unable to authenticate the user on application level by azure login and also I have raised the issue on github so I need your assisment so please suggest me and do the needful.

    Thanks

  82. when you adding new Tenant you need to specify the connection string?
    It should create the db for each tenant automaticlly

  83. Hi Mukesh,
    First of all. congrats!, really nice job.
    I’ve been getting this error,:
    [ERR] Connection ID “17870283327311714827”, Request ID “80001a13-0001-f800-b63f-84710c7967bb”: An unhandled exception was thrown by the application.
    System.InvalidOperationException: The response headers cannot be modified because the response has already started.
    when a user get into the app. after like 3 days, the token doesnt work and it log out your session, you must login again, and that is when this error come out
    At first i thought it coulb be because signalR, i commented everything with signalR but still getting the error, can you help me??

  84. Hi Mukesh,

    first of all congrats, really nice job.
    I’ve been getting this error:
    [ERR] Connection ID “17005592194561611971”, Request ID “800018c7-0000-ec00-b63f-84710c7967bb”: An unhandled exception was thrown by the application.
    System.InvalidOperationException: The response headers cannot be modified because the response has already started.

    at first i thought was because signalR, then i commented every line about signalR, but still getting the error. can you point me in the right direction??

  85. Hi
    i dug a bit in the code and there is smth i do not understand
    If I update a brand from a SQL update command outside the app it is never refresh in the app.
    If I click reload nothing happen, If i refresh with F5 neither.
    I need to restart the app to see the modifications !

    I assume this is by design, i noticed that when saving a row that has not been modified, nothing happen on the SQL side. (which is nice)

    Am I doing smth wrong ? Is there a way to change this ?

    1. It was easy to fix !
      In the getallentityquery there is
      var entitylist = await _cache.GetOrAddAsync(ApplicationConstants.Cache.GetAllEntitiessCacheKey, getAllEntitys);

      I dunno how the cache is really working for now but replacing this by
      var entitylist = await _unitOfWork.Repository().GetAllAsync()

      I replace my entity by entity but is works for brand too

  86. Hi Mukesh,
    The output looks good. However the folder structure is too confusing. Its folders within folders and folders. Can you please explain like any other tutorials in your website.

    It would be nice if you explain every components in the blazor hero.

  87. hi mukesh
    I’ve been looking for how to add a new table with its entity but I can’t find anything
    Could you help me or tell me how I could add a new table like the one for users but for cars?
    or if there is a command to be able to add that new entity and create a table with the data that I want
    I wait your answer thank you.

    1. Hi you can filter on Brand in visual studio (or product) and copy/paste/adapt to add a new entity
      It is teddious but it helps understanding how this works

  88. Hi Mukesh
    I’ve been looking for how to add a new table with its entity but I can’t find anything
    Could you help me or tell me how I could add a new table like the one for users but for cars?
    or if there is a command to be able to add that new entity and create a table with the data that I want
    I wait your answer thank you

  89. Hi everyone, i want to get data from an available MQTT broker and show it on dashboard. Have anyone done it before? How can i do that? Thank a lot.

  90. Hi Mukesh,

    This is excellent explanation about code.

    I have executed Update Database command it get executed successfully. User also created in app but I am unable to find Database in SQMS. Can you please help in this regards.

    Regards,
    Kishor

  91. I am getting error in console when I am update the MudBlazor to 6.2.2, but it works fine one earlier version like 5.0.16.

  92. how can i host Server project in another domain and host client in in another domain, i want use iis

  93. using reflection for calling repo. Do you think it will not affect performance and cause some unexpected runtime errors?