Automapper:无法转换类型为'System.Data.Entity.Infrastructure.DbQuery`1 [DataObjects.BookEntity]'的对象以键入'DataObjects.BookEntity

时间:2014-03-02 18:18:27

标签: vb.net entity-framework automapper

请参阅以下代码:

Public Function GetBook(ByVal ISBN As Integer) As Book Implements IBookDAO.GetBook
        Using context = New LibraryDBEntities()
            'Dim bookDetails = context.BookEntities.Where(Function(b) b.ISBN = ISBN)
            Dim bookDetails = context.BookEntities.Where(Function(b) b.ISBN = ISBN)

            Dim details = Mapper.Map(Of BookEntity, Book)(bookDetails)
            Return details
        End Using
    End Function

我得到的错误是:“{”无法将类型为'System.Data.Entity.Infrastructure.DbQuery`1 [DataObjects.BookEntity]'的对象强制转换为'DataObjects.BookEntity'。“}”我是什么做错了?

0 个答案:

没有答案