Roto
Roto

Reputation: 605

Entity Framework Core Domain Models Names Not Identical to Table Names

I have an existing database so this is not code first using EF data migrations. I have a table called Qualification. I really want to name my domain model of this table QualificationDM. However, when I test it with swagger doing a [HttpGet] and using navigation properties to a lookup table.

I see the query is using:

select * from QualificationDM ....

instead of

select * from Qualification

How to I decorate the QualificationDM class so that EF knows the table name is Qualification and not QualificationDM?

Upvotes: -1

Views: 26

Answers (1)

Roto
Roto

Reputation: 605

Found my own answer...

[Table("Qualification")]
public class QualificationDM
{      
   public string? MyProp{ get; set; }
}

Upvotes: 2

Related Questions