VS 2010 Entity Repository Error

Posted by Steve on Stack Overflow See other posts from Stack Overflow or by Steve
Published on 2010-06-12T01:10:42Z Indexed on 2010/06/12 3:12 UTC
Read the original article Hit count: 197

Filed under:
|
|
|

In my project I have it set up so that all the tables in the DB has the property "id" and then I have the entity objects inherit from the EntityBase class using a repository pattern. I then set the inheritance modifier for "id" property in the dbml file o/r designer to "overrides"

Public MustInherit Class EntityBase
    MustOverride Property id() As Integer
End Class

Public MustInherit Class RepositoryBase(Of T As EntityBase)
    Protected _Db As New DataClasses1DataContext

    Public Function GetById(ByVal Id As Integer) As T
        Return (From a In _Db.GetTable(Of T)() Where a.id = Id).SingleOrDefault
    End Function
End Class

Partial Public Class Entity1
    Inherits EntityBase

End Class

Public Class TestRepository
    Inherits RepositoryBase(Of Entity1)
End Class

the line

Return (From a In _Db.GetTable(Of T)() Where a.id = Id).SingleOrDefault

however produces the error "Class member EntityBase.id is unmapped" when i use VS 2010 using the 4.0 framework but I never received that error with the old one. Any help would be greatly appreciated. Thanks in advance.

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about error