0

I understand that the linq to sql classes I included in my project are the data access layer. I also understand that I need to have any code that connects to, retrieves records, creates records or updates a table separate from my business logic. so lets say for example i have this code written in vb:

private function getUserID (byval strUserName as string) as guid
dim db as new myDataContext
dim idUser as guid = (From u in db.users _
                      Where u.username.equals(strUserName) _
                      Select u.id).SingleOrDefault
end function

This function is in my code behind file for the moment which is wrong, I understand this. My question is, should I create a new class that inherits from the linq class 'User' and implement the data access methods and functions there, or is it best to include this code in the data base (stored procedures I think)?

  • See the following answer http://stackoverflow.com/a/28992/2159510 Hope it helps – Manoj Sethi Sep 17 '16 at 16:15
  • Thank you. I haven't read it yet but based on you taking time to share it and how detailed it looked I am confident that I will find my answer. I assure you that I do extensive searching before posting questions because most of the answers are already out there. With that said, I've been pulling 18 hour days on this website and my brain is starting to turn to mush. lol. thank you again. –  Sep 17 '16 at 18:28

0 Answers0