I'm trying out ASP.NET Core on my Mac. I have not done much with .NET for about 6-8 years (web forms) having been working with PHP and Java EE.
Most of the projects I work on are web services/APIs for mobile applications, so I thought I'd start building a small API to help get to grips with .NET and building API's.
I've got the point where I want to integrate user authentication. I've setup a database/database context, and I've added the necessary declarations to Startup.cs;
i.e.
public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); // Database services.AddDbContext<DatabaseContext>(options => options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"])); // Identity services.AddIdentity<ApplicationUser, IdentityRole>().AddEntityFrameworkStores<DatabaseContext>().AddDefaultTokenProviders(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); // Authentication Middleware //app.UseMiddleware<ClientAuthenticationMiddleware>(); // User Authentication Middleware //app.UseMiddleware<UserAuthenticationMiddleware>(); app.UseMvc(); app.UseIdentity(); }
I've created an ApplicationUser class with extends IdentityUser.
The next step for me is to create the necessary database tables, but can't find a definitive structure I can build or a way to do it.
I created the structure of my application using the 'yo aspnet' command and choosing the 'API/Webservice option', which by default doesn't include identity.
I'm a little confused as to how I go about creating the database structure.