postgresqlentity-framework-core

The entity type 'XmlSchemaCompilationSettings' requires a primary key to be defined. If you intended to use a keyless entity type


I'm trying to do add-migration connecting to Postgres using EFcore but failing with below error.

The entity type 'XmlSchemaCompilationSettings' requires a primary key to be defined. If you intended to use a keyless entity type, call 'HasNoKey' in 'OnModelCreating'. For more information on keyless entity types, see https://go.microsoft.com/fwlink/?linkid=2141943.


Solution

  • i found the issue

    One of the classes had a XMLDocument variable, when I changed it to string it started working.

    public XmlDocument? InputFile {get; set;}

    changed to public string? InputFile {get; set;}