Home Resolve duplicate fields when inheriting IdentityUser
Reply: 0

Resolve duplicate fields when inheriting IdentityUser

AlamEstudent Published in 2017-11-14 14:18:13Z

Help! I am migrating an old ADO application to Entity and Identity Framework's. I have a USERS table, which my analyst does not allow me to change in anything. It has relationships with other context tables and this blessed ID column. To Use Identity I follow this steps:

1-I've changed the USER entity to inherit IdentityUser.

2-I configured the Identity context to use the context of my application.

3- And I overwritten OnModelCreating to rename AspNetUsers to USERS.

Everything almost works. But I came to a standstill:

If I remove the ID property of my USER class the view calls Action to create with POST etc, but the userManager.Create returns an error stating that the entity does not have the ID that is needed. And if I leave the ID property the view neither calls the Action. And receive a error "System.ArgumentException: An item with the same key has already been added."

I believe it happens because I have the ID and Legacy ID of IdentityUser. Can someone give me an idea? I need the ID column in my USERS table.

I try use a nickname, but not work...

protected override void OnModelCreating(DbModelBuilder modelBuilder)

            .Property(p => p.Id)

            .Property(p => p.Id)
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.298461 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO