How do I create an external DAL to my MVC project ?
There is a one thing I really do not get. Suppose I have a model in my MVC project. Model's name is a Person {int id, string name}.
Now in my DAL I have a method:
public Person Select(int id) - which loads data from db and returns the Person object.
This works fine if the DAL is a part of the MVC project. However when I create a class library for my external DAL (so I can use it in another application without referencing whole MVC project) it will not know the Person model because all models are hidden inside MVC project.
I can't reference MVC project from DAL because MVC project needs to reference DAL to use it. I'm not interested in Entity Framework I want my own solution (not sure if EF even solves this).
Is there a secret way to do it ? Or is my approach (of passing whole model) wrong and my Select method should return some sort of array or list with attributes ? I believe this is table data gateway concept (not sure), when just attributes are passed not whole objects.