I get this error
System.InvalidOperationException: The entity set 'EmployeeDto' is based on type '[namespace].EmployeeDto' that has no keys defined.
I know that I can solve this just by putting the [Key] attribute on the ID property for that class, but I have several classes to edit, since we are migrating a huge enterprise project from .NET Framework 4.7 to .NET 6.
The thing is this: I already have defined the key for all the entities in this way:
public class EmployeeMapDto : IEntityTypeConfiguration<EmployeeDto>
{
public EmployeeMapDto()
{
}
public void Configure(EntityTypeBuilder<EmployeeDto> builder)
{
builder.HasKey(x => new { x.ID });
builder.ToTable("Employee", "dbo");
}
}
And I'd like to use the same configuration for both Entity Framework and ODataBuilder. Is it possible?