C
C#2y ago
Alerin

Microsoft.Data.SqlClient.SqlException (0x80131904) Invalid object name 'Stand.Identity.Role'.

What's wrong here? I do not understand what's going on...
public class Context : DbContext
{
public DbSet<Models.Role> Role => Set<Models.Role>();
public DbSet<Models.RolePolicy> RolePolicy => Set<Models.RolePolicy>();
public DbSet<Models.Roles> Roles => Set<Models.Roles>();
}
public class Context : DbContext
{
public DbSet<Models.Role> Role => Set<Models.Role>();
public DbSet<Models.RolePolicy> RolePolicy => Set<Models.RolePolicy>();
public DbSet<Models.Roles> Roles => Set<Models.Roles>();
}
public class Roles
{
public int Id { get; set; }
public User User { get; set; } = null!;
public Guid UserId { get; set; }
public Role Role { get; set; } = null!;
public int RoleId { get; set; }
}
public class Roles
{
public int Id { get; set; }
public User User { get; set; } = null!;
public Guid UserId { get; set; }
public Role Role { get; set; } = null!;
public int RoleId { get; set; }
}
public class Role
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public ICollection<RolePolicy> Permission { get; set; } = new List<RolePolicy>();
}
public class Role
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public ICollection<RolePolicy> Permission { get; set; } = new List<RolePolicy>();
}
public class RolePolicy
{
public int Id { get; set; }
public Role Role { get; set; } = null!;
public int RoleId { get; set; }
public string Policy { get; set; } = string.Empty;
}
public class RolePolicy
{
public int Id { get; set; }
public Role Role { get; set; } = null!;
public int RoleId { get; set; }
public string Policy { get; set; } = string.Empty;
}
Error: https://pastebin.com/PJhZDHyh
Pastebin
fail: Microsoft.EntityFrameworkCore.Database.Command[20102] Fa...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
4 Replies
Alerin
Alerin2y ago
refresh
IcyPhoenix
IcyPhoenix2y ago
does the table exist in the db? i would try to reapply migrations just incase
Alerin
Alerin2y ago
the base is empty, I think "Role" is a name collision. I have to change.