Hello and Thanks in advance for the help!
I'm working through the example in the "pro asp mvc framework" book (chapter 4) and have run into this error and i have no idea what it means. I tried searching on google by there doesn't seem to be anyone else who has run into it! I'm not sure if it's because i messed something up while translating the example from csharp to vb.net or if i messed up setting up the repository (I know it's not the same as the book, but we work with nhibernate not linq to sql so i'm building it with that in mind.)
The bolded line is where the error is showing up when i try to compile.
This is the ProductsController.vb file:
Imports domainmodel.interfaces
Imports DomainModel.Entities
Imports DomainModel.Repositories
Namespace Controllers
Public Class ProductsController
Inherits Controller
Private productsRepository As IProductsRepository
Public Sub New()
productsRepository = New fakeProductsRepository
End Sub
Public Function List() As ViewResult()
Return View(productsRepository.FindAll)
End Function
End Class
End Namespace
This is the repository
Imports DomainModel.Interfaces
Imports DomainModel.Entities
Namespace Repositories
Public Class FakeProductsRepository
Implements IProductsRepository
Private m_Products() As Product = {New Product With {.Name = "Football", .Price = 25}, New Product With {.Name = "SurfBoard", .Price = 75}, New Product With {.Name = "shoes", .Price = 10}}
Public Function GetById(ByVal id As Integer) As Product Implements IProductsRepository.GetById
Return m_Products(id)
End Function
Public Function FindAll() As IList(Of Product) Implements IProductsRepository.FindAll
Return m_Products
End Function
End Class
End Namespace
This is the Interface:
Imports DomainModel.Entities
Namespace Interfaces
Public Interface IProductsRepository
Function FindAll() As IList(Of product)
Function GetById(ByVal id As Integer) As Product
End Interface
End Namespace
and this is the product entity:
Namespace Entities
Public Class Product
Private m_ProductID As Integer
Private m_Name As String
Private m_Description As String
Private m_Price As Decimal
Private m_Category As String
Public Property ProductId() As Integer
Get
Return m_ProductID
End Get
Set(ByVal value As Integer)
m_ProductID = value
End Set
End Property
Public Property Name() As String
Get
Return m_Name
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
Public Property Description() As String
Get
Return m_Description
End Get
Set(ByVal value As String)
m_Description = value
End Set
End Property
Public Property Price() As Decimal
Get
Return m_Price
End Get
Set(ByVal value As Decimal)
m_Price = value
End Set
End Property
Public Property Category() As String
Get
Return m_Category
End Get
Set(ByVal value As String)
m_Category = value
End Set
End Property
End Class
End Namespace
I think that's all the important parts. Thanks for taking the time to try to help!