Quantcast
Channel: Customized Commerce 13 and earlier versions
Viewing all articles
Browse latest Browse all 9642

How to customise Identity user model in CMS 12?

$
0
0

We're looking to extend the user model (ApplicationUser) with an extra field. Following the CMS docs here (https://world.optimizely.com/documentation/developer-guides/CMS/security/episerver-aspnetidentity/), we have this setup:

public class CustomUser : ApplicationUser { public string CustomData { get; set; } }
// In Startup.cs:
services.AddCmsAspNetIdentity<CustomUser>();

With this, however, during application start, we encounter the error "SqlException, invalid column name 'CustomData'". Upon investigation, this is because in the database, the table dbo.AspNetUsers does not have the column CustomData created.

Going through the internet researching this, it seems like there is consensus that the documentation failed to detail the migration step: updating the database to reflect this new change:

With this in mind, when we go into the database and manually add the column to the AspNetUsers table, the error goes away as expected. But Optimizely obviously does not recommend interfering with the database schema, and our implementation will eventually be hosted on DXP.

We have opened a support ticket (#893747), and Optimizely is currently processing it, but we wanted to try and see if others on the forums have solved this issue before, and what's the best practice recommendation to solving this issue.


Viewing all articles
Browse latest Browse all 9642

Trending Articles