Repository pattern and LINQ
Earlier we had a high-level discussion on repositories. Now we are ready to dig in a little deeper. We know that repositories are all about providing a way for our domain logic to access resources in the outside world. We know that they can be used for web services, XML files, and just about anything else. In our case, we will discuss how to access data in a database using the new LINQ to SQL framework.
We haven't really touched upon anything related to the Fisharoo application so far, which means that we don't really have anything in the database for us to play with just yet. For that reason, I created a simple Person
table for us to work with. It has the following fields: PersonID
, FirstName
, LastName
, and Email
. I then created four entries in the database for us to work with.
CREATE TABLE [dbo].[Person]( [PersonID] [int] IDENTITY(1,1) NOT NULL, [FirstName] [varchar](30) NULL, [LastName] [varchar](30) NULL, [Email] [varchar](150) NULL ) ON [PRIMARY...