I create a class library add a linq to SQL class and drag some tables.
Create another class library add a ref to the above project and create a brief function to GetCustomers (dim query = from c in customers select c return c.toList)
I then add a Vb .Net web app and add a ref to the second class library created and call the GetCustomers method.
I got an error message telling me to add a reference to class which contains the linq to SQL data model which doesn’t seem right.
How could I separate these layers correctly? I would appreciate and articles or any code in Vb .Net.
Thanks
Since the data classes are defined in the Linq to SQL class library, the web app needs a reference to it in order to know what those classes are.
To truly separate the layers, you would need to use the Linq to SQL classes to create separate transfer objects in the second class library.
A tool like automapper can be really helpful there.