I have looked and havent seen anything on this, most information relates to directly extending Identity tables.
I have extended Application User like so:
public class ApplicationUser : IdentityUser<long>
{
//[Key()]
//public long Id { get; set; }
[Required()]
[MaxLength(100)]
public string Password { get; set; }
[Required()]
[MaxLength(100)]
override public string UserName { get; set; }
[Required()]
[MaxLength(50)]
public string FirstName { get; set; }
[Required()]
[MaxLength(50)]
public string LastName { get; set; }
public virtual Organization Organization { get; set; }
}
public class ApplicationRole : IdentityRole<long>
{
}
along with other neccesary changes to ApplicationDbContext (to change the primary key to long). Other than that, its fairly standard Identity stuff. I add migrations, update; the usual tables are created plus Organization table because it's a navigation property. Organization itself has no navigation properties. Keep in mind, for the most part I was handed these classes as part of a project and am trying to work within the confines of what I've been given. Now, I have several classes that I need to add, one as an example:
public class Event
{
[Key()]
public long Id { get; set; }
[Required()]
[MaxLength(200)]
public string Name { get; set; }
[Index]
public virtual Organization Organization { get; set; }
}
There are a handful of other something inter related classes. So in a standard code first core 2 app with no existing db, I would create the context class that derives from DbContext, whereas in Identity ApplicationDbContext (the default name) derives from IdentityDbContext.
So before I start breaking things, are there any concerns or special considerations before I do something like this?
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
public DbSet<Event> Events{ get; set; }
public DbSet<OtherClass> OtherClasses{ get; set; }
}
Note: I did find this post which seems to do what I am talking about but it is for MVC 5