Assuming an architecture as such.
MODEL > BLL > DLL
Trying to implement lazy loading in my MODEL I have run into a circular dependency between my MODEL and BLL..
Basically imagine a property in my model that I want to implement as follows
Public Readonly Property ProjectCategory As ProjectCategory
Get
If Me._ProjectCategory Is Nothing Then
Me._ProjectCategory = ProjectCategoryBLL.GetProjectCategoryByID(Me._ProjectCategoryID)
End If
Return Me._ProjectCategory
End Get
End Property
I have my MODEL, BLL and DLL in separate projects and because of the fact that my BLL references my model I can not reference my BLL from my model as this would create a circular dependency.
What is the typical solution to this problem?
It looks like you have got things horribly mixed up, most likely due to a mixed up understanding of tiers and patterns.
Why does your BLL reference your model? It should have no need to. In a classical n-tier application, the model and the BLL are one and the same thing. If you then go and implement a pattern for your UI (like MVVM), then the model may still be the BLL, or it may be a separate bit of code that calls the BLL (and the BLL has no direct knowledge of the model). In MVC, the model handles the data, so once again it talks to the BLL (or may even be integrated and part of the BLL).
My suggestion is for the model to reference the BLL, but not the other way round. Or you could integrate the model into the BLL, depending on the complexity of what you are building.