_From @XcoderTeam on March 31, 2016 13:44_
Unable to perform migrations Identity 3.0
``` C#
//Custom Class
public class ApplicationUser: IdentityUser<int>
{
public ICollection<ApplicationUserRole> UserRoles { get; set; }
}
public class ApplicationRole : IdentityRole<int>
{
public ApplicationRole() : base() { }
public ApplicationRole(string name, string description) : base(name)
{
this.Description = description;
}
public string Description { get; set; }
}
public class ApplicationUserRole : IdentityUserRole<int>
{
public ApplicationUserRole() : base()
{
}
public IdentityRole Role { get; set; }
}
public class ApplicationUserClaim : IdentityUserClaim<int>
{
public ApplicationUserClaim() : base()
{
}
}
public class ApplicationRoleClaim : IdentityRoleClaim<int>
{
public ApplicationRoleClaim() : base()
{
}
}`
``` C#
builder.Entity<ApplicationRole>(u =>
{
u.ToTable("Role");
u.Property(r => r.Id).HasColumnName("RoleId");
});
builder.Entity<ApplicationUser>(u => {
u.ToTable("User");
});
builder.Entity<ApplicationUserRole>(u => {
u.ToTable("UserRole");
});
builder.Entity<ApplicationRoleClaim>().ToTable("RoleClaim");
builder.Entity<ApplicationUserClaim>().ToTable("UserClaim");`
Performing dnx ef migrations add v0.0.1 it encounter this error message.
System.InvalidOperationException: The entity type 'Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole
equires a key to be defined.
_Copied from original issue: aspnet/EntityFramework#4942_
@XcoderTeam Can you include the startup for your app?
This one can closed it work now
What was the fix for this issue?
Thank you
Great, you resolved it!
Just...booomf...and it was all fixed!
Shame that people like me get here only to find out that you couldn't be bothered to write your resolution.
Thanks.
@bengi83 from what I can see I believe this issue was closed because we asked for additional information and after several days we did not get a response.
If you think you are experiencing the same issue, please post your repro code (startup.cs was requested but a complete repro project would be even better).
Also consider just creating a new issue and providing the full repro information.
Most helpful comment
What was the fix for this issue?
Thank you