Table Annotations Invalid object name

Asked at 2016-12-13 16:53:55Z
  • 5 Subscribers
  • 114 Views
1

I have a ADMINCIDENTS class with, schema "ADM" and Table "Incidents":

[Table("ADM.INCIDENTS")]

public class ADMINCIDENTS
{
    [Key]
    public int INCNUM { get; set; }

}

When I query my database, the sql code generated is:

SELECT DISTINCT [inc].[INCNUM]
FROM [ADM.INCIDENTS] AS [inc]

Sql says that [ADM.INCIDENTS] is an invalid object. How do I annotate my table so that the sql query generated adds the schema in the front in brackets with the table in brackets after, like this:

SELECT DISTINCT [inc].[INCNUM]
FROM [ADM].[INCIDENTS] AS [inc]

1 answers in total

Answer this questsion