GithubHelp home page GithubHelp logo

enkodellc / blazorboilerplate Goto Github PK

View Code? Open in Web Editor NEW
1.9K 81.0 369.0 10.59 MB

Blazor Boilerplate / Starter Template with MudBlazor

License: MIT License

HTML 20.07% C# 77.03% CSS 0.71% JavaScript 0.52% Dockerfile 0.12% Batchfile 0.27% PowerShell 0.01% Shell 0.38% Smarty 0.21% HCL 0.63% Smalltalk 0.04%
blazor boilerplate starter-template starter-kit material-design authentication identiyserver4 webassembly authorization blazor-boilerplate

blazorboilerplate's Introduction

Blazor Boilerplate

*Note The current master branch is now fixed and working with net7.0

Blazor is a web framework designed to run in the browser on a WebAssembly-based .NET runtime. Blazor Boilerplate aka Blazor Starter Template is a SPA admin template that is able to run both WebAssembly (Core-Hosted) and Server-Side Blazor with a .NET Core 6.0 Server. Default mode for BB is Server Side. To switch to Webassembly log in as Admin and go to settings. Read more here

Repository Notes

  • Yes, I did not update this repository for a couple of years. During this time I was the CTO of a mid-size software company. We used BB as the base of our application. It was fairly successful. It was a SAAS app with about 1,200 daily users.
  • Read the news below to stay up to date on the repo. We will try to keep the latest major changes on a different branch and have the more stable / tested version on the master branch.
  • There are several people who use this as a base for a production app. If you do so please donate. Gio and Enkode have thousands of hours of coding and support into BB. Show your support by contributing or donating.
  • The main roadblock after the project is running is learning Breeze for Entity Framework. We have some examples and will put out a few more. IAmTimeCorey has a great video for new users of EF.

Build Status Live Demo GitHub Stars GitHub Issues MIT Donate Gitter

Goals

  • This repository is community driven. It is not and never will be controlled by a corporation. It's success is dependent on people using it, reviewing it, offering suggestions and most importantly contributing. Please join the gitter discussion
  • To create a boilerplate with Blazor / Razor components that includes the most common functionality to start a real world application quickly.
  • Avoid many external components & libraries which can make it difficult to maintain, update, track down code, learn code and issues.
  • Minimal Javascript. Currently only using js for MudBlazor / Material Design. We may use components with JS in them but so far no Javascript has been written specifically for anything in the repository.

Live demo

Prerequisites

Don't know what Blazor is? Read here

Complete all Blazor dependencies.

  • The latest .Net 7.0 SDK
  • Install the Visual Studio 2022 + with the ASP.NET and web development workload selected.
  • Entity Framework Core on the command-line tools: dotnet tool install --global dotnet-ef

How to run

  1. Install the Visual Studio 2022 (v17.0.1 at minimum)
  2. Clone or download.
  3. Review / Update appsettings.json - DefaultConnection.
  4. Open the solution in Visual Studio and press F5.
  5. To view the API using Swagger UI, Run the solution and go to: http://localhost:53414/swagger/index.html. Live example: https://blazorboilerplate.com/swagger/index.html

Publish on IIS - What works for me on my Windows Server 2016 & SQL Server 2014 (Enkodellc)

  1. Publish BlazorBoilerplate.Server project to your IIS website folder.

  2. Install your SSL. Make sure your SSL is in the WebHosting Certificate Store, and in Linux My Certificate Store.

    • A free certificate from Let's Encrypt will work.
    • For steps 2 & 3 the utility win-acme installs the certificate on your server, performs renewal and configure your IIS Website Bindings to have https binding with the SSL certificate set and Port 443 for default.
  3. Configure your IIS Website Bindings to have https binding with the SSL certificate set and Port 443 for default. Enable WebSockets for SignalR.

  4. Configure / create appsettings.production.config. Set Connection String. If you are using Sql Server then make sure your connection string contains MultipleActiveResultSets=true, Set Thumbprint / SSL. Thumbprint example: 143fbd7bc36e78b1bcf9a53c13336eaebe33353a

  5. Login with either the user [user | user123] or admin [admin | admin123] default accounts.

Thanks To

Contributing

Please star, watch and fork! We'd greatly appreciate any contribution you make. I am very open to updates and features, though most feature requests will be depending on how much community support exists.

Disclaimer / About the Author

I (Enkodellc) started this repository as I was frustrated with the examples out there that people were charging money for and were in my opinion incomplete or closed source. I paid for 4-5 of these solutions with an Angular front-end / .Net Core back-end and none of them were what I was looking for. This is my attempt to create something that developers can start a Blazor project with several great features to build from. I have a lot of experience with ASP.Net webforms an new to .NET Core and Blazor. This code is not meant to be perfect or follow every best practice. It though is my ambition to learn and get feedback on what best practices can be implemented. I will be migrating a Webforms app to Blazor so this is my opportunity to learn, share, grow, and get feedback on what hopefully will be a great Blazor Starter Kit.

I have taken small solutions from other repositories and will do my best to recognize those contributions. I am very open to ideas and suggestions. I am not a great developer, but I try. So please take this into consideration when using this repository. If you wish to hire me for consulting or as a contractor please reach out via email or https://gitter.im/enkodellc. I have taken well over 1,000 hours to create, maintain, and answer questions. Please donate to support my efforts.

Completed

  • Basic Login / User Creation
  • Admin Theme using Material Design / MudBlazor - 12/1/2021 Switched from MatBlazor
  • Swagger UI API visualizer - View the live API
  • Log Files using Serilog
  • Choose between SQL Lite File or MS SQL Database or Postgres
  • Email Confirmation of Registered Users
  • Forgot Password Functionality
  • ISoftDelete Interface for Models - Allows for "trash / restore" of data IsDeleted property
  • IAuditable Interface for Models - Allows for CreatedOn, CreatedBy, ModifiedOn, ModifiedBy properties
  • Api Audit Trail / Middleware to log Api Requests and Responses
  • Api Response Class to maintain consistent Api Requests and Responses
  • Todo List CRUD Example with N-Tier Layers Not just some fluff that most others do
  • Seed Database & Database Migrations
  • Forum chat and notification system - Thanks ajgoldenwings
  • Drag and Drop Examples - Chris Sainty Blazor Blog
  • Docker Container Support
  • Dual Mode (CSB / SSB) - Client Side / Webassembly & Sever Side. Thanks MarkStega
  • Error Log to Database with Serilog & SQL. Thanks np-at

License

This project is licensed under the terms of the MIT license.

Problem Solving Tips

  • If you get compile errors after updating your EF Models, delete the obj and bin folders from your project and then rebuild.
  • If you are having issues with authentication or any other strange behavior try using Incognito mode / different browser.
  • Make sure you have all pre-requisites installed.
  • Keep It Simple Stupid: If you are running into issues with SQL / connection string. First CHECK both appsettings.json (appsettings.production.json for production) and (appsettings.development.json for development).
  • If still failing get on Gitter BlazorBoilerplate for Blazor Boilerplate or Gitter aspnet/Blazor.
  • Debugging is very limited on WebAssembly / Client-side Blazor. Use Debug_SSB for debugging the UI. Just be aware of browser caching issues when switching modes. The server side of the project can easily be debugged, just not there yet on the client-side code.
  • If you are getting compiler errors try and close VS delete your .vs directory in the solution folder. If that doesn't work delete the solution and redownload the repo.

Postgres Support

*Note this might be out of date.. Delete Existing Migrations in the BlazorBoilerplate.Server/Migrations Folder and then create your own migrations:
-dotnet ef --startup-project ..\BlazorBoilerplate.Server migrations add InitialApplicationDbMigration --context ApplicationDbContext -o Migrations\ApplicationDb

Docker Support

  • Prerequisite: Install Docker Desktop
  • Include / Reload docker-compose project in solution.
  • Do Docker stuff - I don't have much experience with Docker.
  • In the command line go to the Utils folder and run "docker-compose build". Once complete run "docker-compose up"
  • The following will happen in the browser with ASPNETCORE_ENVIRONMENT=Development:
  • Connecting via localhost in chrome or firefox: You will get a console error: "Cannot assign requested address (localhost:port)" - because the js client is trying to connect to your local machine rather than the docker container. Login will not work.
  • Connecting over external ip address/dns: Login will work, but you will get a console error in the following scenarios:
  • In chrome over http: Cannot read property 'register' of undefined. Login works. After login: There is no additional error.
  • In chrome over https: 1) An SSL certificate error occurred when fetching the script; 2) DOMException: Failed to register a ServiceWorker for scope ('https://x.x.x.x:port/') with script ('https://x.x.x.x:port/service-worker.js'); Login works. After login: There is no additional error.
  • In firefox over http: 1) navigator.serviceWorker is undefined. Login works. After login: WebSocket is not in the OPEN state
  • In firefox over https: 1) No errors. Login works. After login: WebSocket is not in the OPEN state.
  • In ASPNETCORE_ENVIRONMENT=Production: http will redirect to https. If you are using a self signed/invalid ssl certificate the following will occur:
  • In chrome or firefox over https: Same as above except login will fail. After login attempt: There was an unhandled exception on the current circuit, so this circuit will be terminated.
  • Note: In Production, if the httpClientHandler server certificate validation returns false (caused by a self signed/invalid ssl certificate) then the login will fail. In Development, overriding the certificate validation via ServerCertificateCustomValidationCallback = () => { return true; } prevents the ssl cert validation from failing which causes the login to succeed.

Azure Support

  • Azure Hosting Wiki
  • *Note that Azure isn't as up to date with their SDK as Blazor Boilerplate so you might have to use an older version

News

7.0.17 Net Core 7

  • Moved the version to coincide with .Net.
  • Removed IS4 since Duende took control and their license was not inline with our production uses and we really didn't need it.

4.0.0 Net Core 6

  • MudBlazor 6
  • EF 5 - Waiting on Breeze Updates
  • Nuget Package Updates

3.1.0 MudBlazor

  • Virtual Table
  • MudBlazor 5
  • .net Core 6, VS 2019, Linux Friendly

3.0.0 Net Core 5

2.0.0 Development is now Master (Major Project Refactor - Thanks GioviQ) (Documentation)

1.0.0 - Master branch

  • Nuget Package updates Blazor 3.2 - Production!

0.8.2 - Master branch

  • Nuget Package updates

0.8.1 Stable - Master branch

  • Blazor WebAssembly 3.2.0 Preview 5
  • Nuget Package updates

0.8.0 (Major Project Refactor - Thanks DanielBunting)

  • Refactor Project Architecture. Thanks DanielBunting
  • Add Initial Tests. Thanks DanielBunting
  • Project Code Review. Thanks GioviQ
  • Revised AuthorizationPolicyProvider. Thanks mobinseven
  • Server-side Multi-Tenant V.1 (Not working / No UI) - Thanks mobinseven
  • SQL Server Error Logging with Serilog Thanks np-at
  • Added Ultramapper for Dto restore / clone. Thanks GioviQ

0.7.0 (Breaking Changes)

  • .NET Core 3.2 Preview 1- Microsoft & Other Nuget package updates - Program.cs refactored for CSB
  • MatBlazor 2.1.2
  • Server-Side Blazor Auth Cookie Issue #138 - Thanks marcotana
  • Exit from Login dialog #139 - Thanks Oleg26Dev
  • Focus on Login Form Entry - Thanks responsive-edge
  • Azure Hosting Wiki and Project update - Thanks soomon
  • Known Issue with new project structure - Breaks CSB Debugging (shift + alt + d) - Expect fix in .Net Core 3.2 preview 2. Use SSB for debugging.

0.6.1 (No Major Breaking Changes)

  • .NET Core 3.1.1 - Microsoft Nuget package updates - security patches no code changes
  • Known Issue with new project structure - Breaks CSB Debugging (shift + alt + d) - Expect fix in .Net Core 3.2 preview 2. Use SSB for debugging.

0.6.0 (Major Breaking Changes)

  • Dual Mode CSB & SSB View Wiki. Thanks MarkStega
    • There are changes to solution structure for Dual Mode. Switching modes can be tricky with the browser cache so if you see something strange use incognito mode or a different browser. Best solution is to pick your version and stick with it, then expect to clear cache when switching. Read the Wiki!
    • Known Issue with new project structure - Breaks CSB (shift + alt + d) Debugging - Expect fix in .Net Core 3.2 preview 2 . Use SSB for debugging.

0.5.0

  • MatBlazor 2.0 Breaking Changes
  • .NET Core 3.1.0 / v3.1.0-preview4 Blazor Nuget package updates
  • Admin Roles / Permissions Management. Thanks vd3d
  • Fix Login EditForm / Double submit of Login. Thanks MarkStega
  • UserProfile Fixes. Thanks mobinseven
  • Chrome Cookie updates. Thanks oneparameter

0.4.0

  • Docker Support. Thanks npraskins & acid12
  • Fixed IAuditable / ShadowProperties for CreatedOn, CreatedBy, ModifiedOn, ModifiedBy. Thanks acid12
  • Known Issues:
    • Drag and Drop example does not work in FF. Known FF issue.

0.3.2

  • Identity Server 4 - Authentication with ASP.Net Identity Authorization with Policies
  • v3.1.0-preview3 / Nuget Package updates
  • Authorize / Policy Examples on Users Page
  • Known Issues:
    • IAuditable Shadow Properties not getting UserId
    • Drag and Drop example does not work in FF. Known FF issue.

0.3.0 - IS4 (Breaking Changes from 0.2.3)

  • Identity Server 4 First Release - Delete your DB! Thanks to ganmuru
  • User Profile Store Last Page Visited / Return on Login
  • .NET Core 3.0.100 / Blazor 3.0.0-preview9.19457.4 update
  • Known Issues:
    • IAuditable Shadow Properties not getting UserId

0.2.3 - .Net Core Authentication / Authorization (Stable Version)

  • .NET Core 3.0.100 / Blazor 3.0.0-preview9.19457.4 update
  • Known Issues:
    • IAuditable Shadow Properties not getting UserId

0.2.2

  • Drag and Drop Examples
  • .NET Core 3.0.0-rc1.19457.4 update
  • Known Issues:
    • IAuditable Shadow Properties not getting UserId

0.2.1

  • Update to .NET Core 3.0 Preview 9
  • User Management Screen (CRUD) & User Password Reset - Thanks npraskins
  • Confirmation Delete Dialog Stylize & Implementation
  • Known Issues:
    • IAuditable Shadow Properties not getting UserId

0.2.0

  • CRUD Todo List example
  • Restructure Project Refactor BlazorBoilerplate.Shared for N-Tier Design
  • Automapper for Client (dto) / Server Models
  • Removed old Migrations. Recommend to delete your database to start new.
  • Implement ShadowProperties for Auditable, SoftDelete Interfaces for Models (In Progress)
  • DB Seed Data
  • Forum chat and notification system - Thanks ajgoldenwings
  • Known Issues:
    • IAuditable Shadow Properties not getting UserId

0.1.9

  • Update to SDK 3.0.0-preview8-28405-07
  • Added IpAddress and UserId to Middleware ApiLogging
  • Review / Fix VS code Warnings and Information notice. Clean up code.
  • UserProfile - Beta
  • MatBlazor 1.6.0

0.1.8

  • Middleware to log Api Requests and Responses for auditing and debugging. Thanks salslab
  • Middleware for consistent API Responses and Exception Handling. Thanks proudmonkey
  • Email Pop3 / IMAP retrieval. Thanks npraskins
  • Responsive Navigation / Closed / Full / Minified / Minified & Hover effect
  • Added MatNavMenu PR for MatBlazor - Ver 1.5
  • Updated demo site for new MatNavMenu and rest of 0.1.8 code

0.1.7

  • User Profile Management
  • Refactor Email Settings and API
  • MatBlazor 1.3.0
  • Migrate to .NET Core 3.0

0.1.6

  • Email confirmation on Registration
    • Configure Email Configuration in server appsettings.json
    • Set "RequireConfirmedEmail" to true in appsettings.json
  • Forgot Password
    • Configure Email Configuration in server appsettings.json
  • Updated Email Templates for Forgot Password

0.1.5

  • Added Azure DevOps Pipeline for build status
  • Added Update Email Templates
  • Implemented New User Registration Email Template
  • Implement AuthorizeView for Theme
  • Breakout Theme Components

0.1.4

  • Add Mailkit for Email - Future work to add Email Templates
  • Started API Auth CascadingAuthenticationState / Polices / Claims
  • Added SQL Server as a DB option

0.1.3

  • Update to MatBlazor 1.2.1 - Not yet released so using local copy
  • Update Theme / Drawer minify & close
  • Fixed Known Issue - UserProfile not loading after login. Thanks nstohler
  • Secure Pages.
  • Anonymous Home Page.

0.1.2

  • Update to SDK 3.0.100-preview6-012264 - Breaking Changes
  • Update to MatBlazor 1.2
  • Update Theme
  • Known Issue - UserProfile not loading after login
  • Registration Form added Form Validation
  • Todo Table Fetch from API Example

0.1.1

  • Updated Theme / Responsive
  • Added Serilog Log Files

0.1.0

  • Initial release

blazorboilerplate's People

Contributors

12step avatar ahmetsekmen avatar ajgoldenwings avatar alishalbaf avatar biegehydra avatar budweiserbark avatar danielbunting avatar dependabot-preview[bot] avatar dependabot[bot] avatar enkodellc avatar gioviq avatar hrrysnplusplus avatar jakubmaguza avatar jeffsilvacoastal avatar juststeve avatar kingmercian avatar maddadder avatar markstega avatar mend-bolt-for-github[bot] avatar mobinseven avatar mtargonski avatar nasserkhalifa avatar np-at avatar npadrutt avatar proudmonkey avatar responsive-edge avatar rogerthoang avatar sepppenner avatar soomon avatar vd3d 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

blazorboilerplate's Issues

Should we convert to Server Side Blazor?

Looking for opinions on switching Blazor Boilerplate to Server Side Blazor. I know it will be easier to debug and will be more stable. My end goal is still Client Side Blazor for my future deployments. So if you have an opinion please voice it in a comment. If we move to SSB it will happen with a 0.4.0 version.

Drag and drop not working in Firefox version 69.0.3 (64 bit) on Windows 10

https://blazorboilerplate.com/drag_and_drop

Error: System.ArgumentException: There is no tracked object with id '2'. Perhaps the DotNetObjectReference instance was already disposed.
Parameter name: dotNetObjectId
at Microsoft.JSInterop.JSRuntime.GetObjectReference (System.Int64 dotNetObjectId) <0x2e25a88 + 0x0003c> in <4e424253df194e1299a1044d93a79164>:0
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.BeginInvokeDotNet (Microsoft.JSInterop.JSRuntime jsRuntime, Microsoft.JSInterop.Infrastructure.DotNetInvocationInfo invocationInfo, System.String argsJson) <0x2c55d50 + 0x00096> in <4e424253df194e1299a1044d93a79164>:0 blazor.webassembly.js:1:7164

named pipes provider / created in shadow state

I have a fully functional dev environment with connection to SQL Server Express, TCP/IP enabled an open port, allowed remote access etc, i.e. all the checks done to prevent error 40, yet:

The server was not found or was not accessible / Named pipes provider, error 40
and
'0.3.2.0perty '{property}' on entity type '{entityType}' was created in shadow state because there are no eligible CLR members with a matc'

databaseInitializer. SeedAsync().Wait() is where it fails.

I have both created the db (blazor_boilerplate) as well as left it up to the application, same result.

Question: Modified version of the boilerplate shows the loading screen only

I have the following problem and maybe you see a quick solution (or had this issue before):

I'm using the boilerplate in a modified way in my project. (I used the version from preview8 and updated the project to preview9 on my own). However, since the update, I only see the loading screen and the project itself isn't shown. The swagger page works correctly when you navigate to it with the browser.

I know, it's quite difficult to tell where this comes from as I can't provide you the exact code, but maybe you already had a similar issue, @enkodellc?

CascadingAuthenticationState/Policies/Claims

Hi

I tried to add CascadingAuthenticationState into blazorboilerplate, using the following sources:

Since I've run into some problems merging it back into a fork of your current project, I've created a copy here for now:

https://github.com/nstohler/blazorboilerplateCopy

I also played around with policies/claims.

It's not very clean so far, but compiling and working.

Maybe something to integrate into the project at some point...

Login on Enter is broken (blocked by ASP bug)

You'll need to add @bind-value:event="oninput" in order for the data binding to update to the MatTextField password element since onchange isn't triggered until focus is lost, however due to an upstream issue, this will cause a crash on Blazor 3.0, and is triaged in 3.1

More details can be found here:
https://github.com/aspnet/Blazor/issues/236
dotnet/aspnetcore#13192
dotnet/aspnetcore#13181

A dirty workaround would be to call a JS interop in the meantime

Flyout / Submenu Menu

In the main navigation create a submenu with option of flyout menu when minimized. Feature for MatBlazor

Site Doesn't load on iOS devices

Sorry if this is not the correct place for this but I tested your site on various devices and everything works except iOS devices. I've tested it on iPhone iPad and both hang on the loading screen. Is this a known issue?

OnEnter / Form Submission Feature.

Login on Enter from MatTextBox or Keypress for fire an event.

Possible solution is to use a form. Maybe create a MatBlazor Form component for submission?

Reset Password Failed

Hi, first of all thank you for the great boilerplate!!!

I successfully managed to (tried with the latest version - 01.8) :

  • Create new user, got email verification email and login.
    -Tested forgot password, got email.
    but unfortunately when i tried to reset the password, receiving "Failed to Reset Password" logs does not have anything either.

Docker refactor

Updates to changes introduced in #51 (add docker support)

  1. Clean up dockerfile (add flags --no-restore, --no-build)
  2. Make docker-compose.yml clean, replace docker db related variables with overriden connection string
  3. Remove docker-compose.override.ym as of today it provides no value, and docker-compose project / running app in docker container auto creates that files that overrides content and enables remote debugging
  4. Clean up Startup.cs to remove dependancy to docker-related environment, ap code should not know about environment it runs under (standalone or docker container)

"Switch from Entity Framework Core to Dapper" ?!

In your road map it is written that: "Switch from Entity Framework Core to Dapper. So far EF is not my cup of Tea. I think dapper will be stronger and faster"

Entity Framework Core does not slow down the database in any way. The speed is limited not by Entity Framework Core, but by the relational DBMS itself. Dapper will be just as slow, but will consume a little less CPU time for mapping and tracking objects. To accelerate, you do not need to downgrade to dapper. To speed up, you need to add a second level cache to the perfect Entity Framework Core!

Login function doesn't work

If you try to login using user 'user' with password 'user123', it gives an error saying you are not authorised

Loading Blazor Boilerplate... slow loading

Hi,

I have a strange side effects, the "Loading Blazor Boilerplate..." page take a lot of time before continuing...

I mainly got this the first time I tried your Demo URL : https://blazorboilerplate.com/

PS: In JavaScript we have "webpack" to manage the bundle, to avoid very long loading at once, not sure it is related.

APIResponseRequestLogginMiddleware produces invalid JSON response

  • I've added my own dto class into the shared project. One of the field is a decimal.
  • I added a service and a controller to the server project for reading all records/a single record.

Basically all I did was copy the logic from the ToDo example.

I'm using SQL Server.

But the produced JSON is then somehow not valid. It looks like there's some duplicate data at the end...

Here's an example:

{"Version":"0.1.9","StatusCode":200,"Message":"Retrieved SI-Einträge","Result":{"moniker":"xxx","sicherheitsIndikatorMoniker":"xx-7","facilityMoniker":"xxx","bewertungMoniker":"normalitaet","userMoniker":"xxx","wertText":"111","wert":16789.123456789122,"bemerkung":"","year":"2018","month":"1","monthsValid":"1","timestamp":"2019-01-01T00:00:00","rowVersion":""}}on":""}}

If I remove the decimal data type (or change it to int), the response is fine.

Edit:

Here's the code that produces the problematic JSON;

public async Task<APIResponse> Get(string moniker)
{
	var siEintrag = await _db.SicherheitsIndikatorEintraege.FirstOrDefaultAsync(t => t.Moniker == moniker);

	if (siEintrag != null)
	{
		var mapped = _autoMapper.Map<SicherheitsIndikatorEintragDto>(siEintrag);
		return new APIResponse(200, "Retrieved SI-Eintrag", mapped);
	}
	else
	{
		return new APIResponse(400, "Failed to Retrieve SI-Eintrag");
	}
}

The following code works (the response gets automatically wrapped in a APIResponse by the middleware):

public async Task<SicherheitsIndikatorEintrag> GetTest(string moniker)
{
	var siEintrag = await _db.SicherheitsIndikatorEintraege.FirstOrDefaultAsync(t => t.Moniker == moniker);
	return siEintrag;
}

Have you had any success in publishing this to azure?

I've been trying out this project and learning blazor as I go, but I've been unable to publish the project to azure, getting just the error message "HTTP Error 500.0 - ANCM In-Process Handler Load Failure" (which I understand is because .net core 3 is not yet supported on azure, but there are extensions and it should work "self-contained"). Have you had any success and do you have any tips to get it working?

Sliding Nav Shelf animation a little glitchy

The animation that plays when the side-bar navigation slides in and out or transitions is sometimes a little bit glitchy. I think the text elements jump to the left before sliding and fading out to the right, and there are text-wrapping issues as the drawer width animates.

Also, when in auto-hide mode, the expand/collapse arrow shifts down after the drawer slides out:

image

Where it normally looks like this:
image

Matblazor Error

Hi, maybe this is an MatBlazor error.. but when i run the Blazor boilerplate i'm getting this error:

image

contributing : postgres support

Hi,

I have just start to work on your boilerplate, I wish to contribute.

I have add the postgres support, it is a simple and basic contribution.

If you are interested I wish to work on the roles/permissions now, if you agree ?

Thanks

EF Shadow Properties Not pulling in UserId

I think I used this Blog as an example: https://trailheadtechnology.com/entity-framework-core-2-1-automate-all-that-boring-boiler-plate/

Goal: Use Interface IAuditable on Model's to generate / populate. CreatedOn, CreatedBy, ModifiedOn, ModifiedBy properties / fields for that Model.

In the ChangeTrackerExtensions class you will find the SetShadowProperties method which is called in the EF ApplicationDbContext. This fires fine but the userSession is not null.

Testing procedure: Set a breakpoint in either SaveChanges of ApplicationDbContext or SetShadowProperties . Insert or Edit a Todo item and you should hit your breakpoint and see _userSession is empty.

There are some notes / comments in ChangeTrackerExtensions

SQLServer / Sqlite config mixup

In 907aabd, startup.cs, I had to change

if (Convert.ToBoolean(Configuration["Authentication:UseSqlServer"] ?? "false"))

to

if (Convert.ToBoolean(Configuration["BlazorBoilerplate:UseSqlLite"] ?? "false"))

Then I was able to dotnet ef database update and create and use the SQLServer db.

Navigation links don't auto-activate based on current URL

Not sure if this is a blazorboilerplate issue or a matblazor issue, but I noticed that the navigation items in the drawer menu don't automatically become "active" when the URL changes, or on initial load/reload. They only change to the active state when you click on them. This means the active state of nav links are out of sync initially, and also if you navigate away from a link outside the drawer.

Would be nice if they worked like the built-in NavLink component and do URL path matching for active/inactive state.

IS4 Branch: Serialized claims cannot be put into a Dictionary

You cannot serialize ExposedClaims as a Dictionary, as claim types are not unique. A drop-in fix for this is to swap List<KeyValuePair<string,string>> for Dictionary<string,string> for ExposedClaims in UserInfoDto/UserSession, and change the lambda in AccountController to:
ExposedClaims = User.Claims.Select(claim => new KeyValuePair<string,string>(claim.Type,claim.Value)).ToList()

Edit:
Since newtonsoft.json can't serialize this type properly (causes a self-referencing loop), this will need to be reworked slightly.

Middleware for Handling Requests

Review all API calls and create a consistent pattern for handling errors that bubble up to Toasts properly. This will create a better user experience as well as developer debugging.

user name not displayed after login

Problem

When I logged in, the index page only displayed "Hello !!!" (missing username). When I refreshed the page, I got the correct result: "Hello tester !!!"

How to fix it

in AuthorizeApi.cs:

public async Task<UserInfo> Login(LoginParameters loginParameters)
{
    var result = await _httpClient.PostJsonAsync<UserInfo>("api/Authorize/Login", loginParameters);
    return result;
}

login broken

step to reproduce:

  1. use local sql server
  2. run migrations scripts
  3. start app
  4. inspect AspNetUsers Table for user named user - all good.
    click login
    enter user & user123 for username & pw

problem - put a break point in the accountcontroller line 326 for builduserinfo
the line

var user = await _userManager.GetUserAsync(User);

user is null

Blazor problem with publish in iis.

It works correctly when running from the exe. but when it comes to the iis, it tends to present the problem with the error, so all pages are waiting to authorize and the answers are loading ..

error

Email's Sent History / Audit Log

Create a table with Migration for Email's sent by the application. This is a simple CRUD example to show adding table migrations for a simple feature so an admin for email audits.

Possible fields [Datetime, From, To, Bcc, CC, Subject, EmailTemplate Name]

@npraskins agreed to take on this project.

I am unable to get this to work with MS SQL

I get error "provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server" I am sure the connection string is correct, I use the same connection string in other projects.

Login page flashing

why login page shows up again for a moment after logging in? Any ideas on preventing this?

Controller Endpoint Protection

So far you can login, but all controller are open for anonymous request. Some have the Authorize Attribute on it but are overwritte by the AllowAnonymous from the controller itself. So I can always request for example all users via PostMan.
As soon as I take out the one from the controller so that the the one from the endpoint comes into effect I always get an 401 Unautherized back.

I'm not sure if that is a bug or something that was not fully implemented :)

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.