I am currently doing a CRUD project for school and basically they want us to have this kind of structure (3 projects):
- Class Library
- Contains all the Data Access logic (Retrieving the data from the database with either Linq of standard ADO.Net)
- Web Service
- Having a reference to the Class Library and offering [WebMethod]s that access the methods from the Class Library
- ASP.Net Website
- Having a Service Reference to the Web Service and using the WebMethods to retrieve the data
Which basically means that we cannot access the Class Library directly from the Website:
Website
\
\
Web Service
\
\
Class Library
Now of course there are multiple solutions to choose from as to provide abstraction in the Web Service to seperate for example methods that retrieve the Articles and methods to retrieve the Categories (which are two different entiries and have two seperate classes in the Class Libary):
- I can either do one webservice which will have all the methods (GetAllArticles, GetAllCategories, GetArticleByID etc...) and the Website only makes a reference to this one web service. But ofcourse this will result in having All the methods in a single class (ie a single web service)
- Or I can create multiple web services (
Articles.asmx
,Categories.asmx
etc...) and reference all of them from the website and then call the one I need depending on what data I need to retrieve.
But I mean for me, the above solutions are not really ideal because if I have the first solution, I will have a ton of methods all in one class (no abstraction whatsoever) and in the second solution, I will have to reference about 10 different web services from the website (one for Articles, one for Categories etc...)
At school they told us to use the Web Service (or Web Services) to access the class library, and then retrieve the data from the class library using the Webmethods...but both solutions I mentioned earlier on seem a bit dodgy.
So people, can you please suggest to me a better way of how I might go about in implementing this structure?