Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Example of a Blazor Server App that reuses most of the libraries from the related Blazor WebAssembly App example.

License

NotificationsYou must be signed in to change notification settings

JeremyLikness/BlazorServerEFCoreExample

Repository files navigation

Application screenshot

Example of a Blazor Server project that uses Entity Framework Core for data access.

The project relies on a set of core, shared libraries that were created for aBlazor WebAssembly project.It is linked as a submodule to this project.Read about how that was built here (note: series is valid up to commite6ac27b):

For the latest version, read about the latest round of refactoring here:

The server-focused blog post is available here:

Features

  • Azure AD Authentication
  • Extended identity features to audit user creation, modification, email confirmation, and deletion
  • Entity Framework Core
  • Entity Framework Core logging
  • Shadow properties: the database tracks row version, the user who created the entity and timestamp, and the user who last modified the entity and timestamp, without having to define these properties on the C# domain class
  • Automatic audit that tracks changes with a before/after snapshot and is generated at the data context level
  • Optimistic concurrency with delta resolution (when the database changes, the UI shows the changes so the user can overwrite or abort)
  • Entity validation on the client and server using data annotations
  • A grid that features paging, sorting, and filtering with debounce (i.e. typing three characters will result in just one database round trip)
  • Dynamic filtering and sorting with serverside evaluation
  • 99% of the UI is contained in a Razor class library that is usable from both Blazor WebAssembly and Blazor Server applications
  • Example of the repository pattern: the client and server use the same interface with a different implementation

Quick start

Prerequisites

  • .NET Core SDK (3.1.300 or later)
  • Visual Studio Code,OR
  • Visual Studio 2019 16.6 or later

Code and Connection Strings

  1. Optionally fork the repository.

  2. Clone the repository (or your fork):

    git clone https://github.com/jeremylikness/BlazorServerEFCoreExample.git

  3. Navigate to the newly created directory

  4. Navigate to the emptyBlazorWasmEFCoreExample sub-directory. This is where the original repo will be cloned. Assuming you cloned with the defaults, your path will be./BlazorServerEFCoreExample/BlazorWasmEFCoreExample.

  5. Typegit submodule init to initialize the dependency on the original repo.

  6. Typegit submodule update to clone the files.

  7. If you don't havelocaldb installed, updateappsettings.json andappsettings.Development.json in theContactsApp.Server project to point to a valid database instance.

  8. Theblazorcontactsdb is used for the application database and must matchContactContext.BlazorContactsDb in theContactsApp.DataAccess project (the default value isblazorcontactsdb).

  9. Update theAzureAD section to point to your Azure AD domain, instance, tenant, and client.

Visual Studio

  1. Open the solution file.
  2. Ensure theContactsServerApp project is set as the start up project.
  3. You are ready to launch the application.

See note at the end of the next section.

Visual Studio Code

  1. Navigate to theContactsServerApp folder.

  2. Type

    dotnet run

    to start the server. Navigate to the port specified.

Note: the demo app is designed to create and populate the contacts database the first time you open the web page. This may result in a delay of up to several minutes on first load. This is normal and is just used to make setup easier. Subsequent runs should load faster.

Migrations for Contacts Database

See theoriginal repo for information on setting up migrations.


Submit any feedback, questions, suggestions, or issueshere.

Regards,

Jeremy Likness

@JeremyLikness

About

Example of a Blazor Server App that reuses most of the libraries from the related Blazor WebAssembly App example.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp