Giter VIP home page Giter VIP logo

Comments (5)

pranavpatil19 avatar pranavpatil19 commented on September 12, 2024

Please help ???

from northwindtraders.

NghiaNguyen170192 avatar NghiaNguyen170192 commented on September 12, 2024

@CodeRapp3r, please follow this link below. This will help you replacing InMemory and using IdentityServer4 with Entity Framework
link

from northwindtraders.

pranavpatil19 avatar pranavpatil19 commented on September 12, 2024

thank you it resolve 5 th point

But really dot understand where i install Identityserver4.Entityframework package in Northwind.Persistence or Northwid.identityServer project

from northwindtraders.

NghiaNguyen170192 avatar NghiaNguyen170192 commented on September 12, 2024

@CodeRapp3r In order to implement IdentityServer4 and Entity Framework, I suggest you to start with the basic not to implement the code for NorthWindTrader. The basic IdentityServer implementation has 2 parts, IdentityUser and IdentityRole. You inherit the IdentityUser for your YourCustomUser. Create new project using VisualStudio/VSCode/ your terminal. Create YourCustomUser class and implement:
public class YourCustomUser : IdentityUser { public YourCustomUser() : base() { } public YourCustomUser(string userName) : base(userName) { } public YourCustomUserProperty YourCustomUserProperty { get; set; } }

Then, in your YourDbContext, you need to use IdentityDbContext instead of DbContext.
public class YourDbContext : IdentityDbContext<YourCustomUser> { public YourDbContext(DbContextOptions<YourDbContext> options) : base(options) { } public DbSet<YourCustomUser> YourCustomUsers { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); //Custom model builder here } }

Once you do this, this will use AspNetUser includes with your custom properties
Then in your StartUp.cs
Add this code below to your ConfigureServices
services.AddDbContext<YourDbContext>(options => options.UseSqlServer( Configuration.GetConnectionString("DefaultConnection"))); services.AddIdentity<YourCustomUser, IdentityRole>() .AddRoles<IdentityRole>() .AddDefaultUI() .AddRoleManager<RoleManager<IdentityRole>>() .AddDefaultTokenProviders() .AddEntityFrameworkStores<YourDbContext>();
Then in your Configure method, use
app.UseAuthentication();

from northwindtraders.

pranavpatil19 avatar pranavpatil19 commented on September 12, 2024

Thank You

from northwindtraders.

Related Issues (20)

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.