Sep 16, 2013 at 1:52 PM
Edited Sep 16, 2013 at 1:56 PM
Hope you are doing fine. I am really inspired of your work. I wonder no one raised a basic question that i am going to put up here. May be i am missing something. Here is my Query:
Model Layer uses/extends classes/interfaces defined in Infrastructure, Similarly classes/interfaces in Infrastructure also use namespaces/classes/interface defined in Model Layer Project which is causing Circular Dependency so i cannot use Model in Infrastructure
Layer. How can i use "using SmartCA.Model.Projects" in Infrastructure Layer Project while i have already defined Dependency of Model Layer on Infrastructure Layer ? such that MS-VS does not show Circular Dependency constraint.
As classes/interfaces in Model Layer (like Business-Entity Classes and IEntityRepository) use/extend the Classes defined in Infrastructure Layer ( like abstract base class "EntityBase" and IRepository<T>). Therefore, i have added dependencies/references
in Model Layer Project for Infrastructure Layer, so as to make Model Layer as dependent on Infrastructure Layer. (So now i can use namespaces and relevant classes/interfaces defined in Infrastructure Layer)
However, Infrastructure Layer seems to use Model Layer namespaces as on page 82 of the book we see the line marked as bold below:
//EntityFactory concrete class
internal class MarketSegmentFactory : IEntityFactory<MarketSegment>
Similarly, (on page 77 of the book) while creating concrete Respository class, we see the code as below:
public class ProjectRepository : SqlCeRepositoryBase<Project> , IProjectRepository
where Business Entity Object "Project" and interface "IProjectRepository" both reside in Model Layer and using the namespace of model layer will require to add reference/dependency in Infrastructure Layer Project to Model Layer Project causing
a Circular Dependency which Visual Studio (OR, probably .NET Framework) does not allow.
Can you please explain how can i make this code working ?
Note: I have put up the same question there on StackOverFlow, so you can answer my query even there as per your comfort.
Looking forward to your response,