It is very difficult for me to figure out how to specify a good search query for my problem: separating the interaction of gui and database in visual studio 2008 using Linq to sql.
According to my teacher in the C # im class, this is not correct if you allow the GUI to be dependent on a particular way of getting data.
As my project is currently set up, we have a mssql database where everything is stored. The solution is divided into 4 separate projects. UserGUI, AdminGUI, Logic and Db.
Now, using linq to populate lists and things like that, I use something like:
From the window form in the UserGUI project:
To the Logic project:
public IQueryable getActiveReservationsQry() { return dbOperations.getActiveReservationsQry(this.currentMemberId); }
To the database project:
public IQueryable getActiveReservationsQry(int memberId) { var qry = from active in db.ActiveReservations where active.memberId == memberId orderby active.reservationId select active; return qry; }
This makes sense to me, since I can send elements from lists completely to the database project and there it is easy to update / insert things into the mssql database. The problem is that it would be rather difficult to combine from the mssql database to tell the access version.
What should I read to understand how to do it right? Is creating my own classes the same values as for Visual Studio for me when I create a dbml file? Should I then fill in, for example, a List in a logical project, which I turn into a GUI? For me, these are stitches, like "double work", but maybe this is the right way?
Be sure that we don’t read anything about design patterns or business logic, which seem to be a pretty big topic, and they look forward to further study outside the course.
I also thought that IQueryable inherits from IEnumerable and maybe that was the way to go, but I was not able to find any information that would make sense to me how to do this.
The GUI also knows about data sources, which, in my opinion, are bad, but cannot figure out how to get rid of.
Please understand that I tried to understand this with my teacher for half an hour today at the only tutoring available for this project, and then spent most of the day searching for similar answers on google, SO and classmates without any result.