New WASM app with IdentityServer - how do I stop the migration from taking place? RRS feed

  • Question

  • User379720387 posted

    A new WASM core hosted app with Identity comes with a trigger that creates the database once the first registration takes place.

    I already have my own database (from previous attempts), and would like to skip the above step.

    What approach should I take and how?

    Delete the migration (tell me what to delete) and scaffold? Or, let the migration take place and then scaffold?

    Data folder in the Server project has: Migrations folder (which has CreateIdentitySchema a ModelSnapshot) and ApplicationDbContext.cs

    The latter looks like this

    using AMwAuth.Server.Models;
    using IdentityServer4.EntityFramework.Options;
    using Microsoft.AspNetCore.ApiAuthorization.IdentityServer;
    using Microsoft.EntityFrameworkCore;
    using Microsoft.Extensions.Options;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    namespace AMwAuth.Server.Data
        public class ApplicationDbContext : ApiAuthorizationDbContext<ApplicationUser>
            public ApplicationDbContext(
                DbContextOptions options,
                IOptions<OperationalStoreOptions> operationalStoreOptions) : base(options, operationalStoreOptions)

    Friday, May 14, 2021 8:01 PM


  • User475983607 posted

    Delete the migration files created by the template in Data\Migrations.


    You need to scaffold the DB f you want to use an existing DB.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 14, 2021 8:11 PM