Entity Framework error - "Type argument 'Namespace...EntityName' does not satisfy the 'Class' constraint for the type 'TEntity'."
I have the following two tables defined...
CREATE TABLE [LogLevel] (
[Id] int primary key
,[Name] nvarchar(50) not null
,[Enabled] bit not null default (0)
)
GO
CREATE TABLE [Log] (
[Id] bigint identity(1,1) primary key
,[LogLevel] int not null fo开发者_如何学运维reign key references [LogLevel]([Id])
,[On] datetimeoffset not null default (SYSDATETIMEOFFSET())
,[Summary] nvarchar(100)
,[Details] nvarchar(MAX)
)
After creating a fresh endity model, I add the two tables above. When I try to build I get the following errors...
Okay, hopefully someone else can post a better answer, but apparently the fit has something to do with the table [LogLevel]'s name or the table [Log]'s name... in either case, renaming them to [DiagnosticLog] and [DiagnosticLogLevel] resolved the issue at hand.
精彩评论