Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7871635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:57:53+00:00 2026-06-03T01:57:53+00:00

So I’ve been playing with re-engineering the data access in a project that I

  • 0

So I’ve been playing with re-engineering the data access in a project that I recently put into production.

I started reading about Repository and Unit of Work patterns and it got me intrigued. I’d never used TDD before but thought I might give it a shot.

What I’m working on isn’t critical so it’s more a hobby for me to get a better understanding.

I have got something working but want to see if I’ve missed the mark completely. Here’s what I have… (I’ll use Sln instead of the name of the solution for simplicity)

Sln.DataAccess
+ Entities
  + Person.cs (contains the model definition of a Person)
  + IIdentifiedObject.cs (just an interface demanding a (Guid)Id property)
+ Repositories
  + IRepository.cs[1]
+ IUnitOfWork.cs[2]

Sln.DataAccess.Memory
+ PersonRepository.cs[3]
+ Context.cs[4]
+ GenericRepository.cs[5]
+ UnitOfWork.cs[6]

Sln.DataAccess.Sql (I suppose this could be Sln.DataAccess.EF but anyway...)
+ PersonRepository.cs
+ Context.cs
+ GenericRepository.cs
+ UnitOfWork.cs

Sln.Test
+ Various unit tests.

The SQL Context/Repository/etc… are all essentially the same except that it access the database via Entity Framework instead of in-memory Lists.

The real question I am asking is whether I have missed the mark on the whole Repository/UnitOfWork patterns or if there are any suggestions anyone can give where I could improve on what I have.

Here are the source files.

  • [1] https://gist.github.com/fddf625b1ee10bc0420a
  • [2] https://gist.github.com/a020a016dd695309cb5c
  • [3] https://gist.github.com/5f774e5f8dbcd41b1119
  • [4] https://gist.github.com/9ab621962a5ea04403da
  • [5] https://gist.github.com/a6d8f5f1b5fdcbbfaaf6
  • [6] https://gist.github.com/7df0dca18489dd5555f8
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T01:57:54+00:00Added an answer on June 3, 2026 at 1:57 am

    OK so I achieved what I wanted.

    See this project on Git that I created (it should be open) and it demonstrates exactly what I wanted.

    The Sln.DataAccess assembly has absolutely zero references to how the data is actually stored, there are no classes in it, only interfaces that define the way objects can be accessed and the structure of those objects.

    The actual means of persistence, (in-memory or database) are completely hidden from outside their respective assembly.

    https://github.com/bmckenzie/projects

    One thing I would like to fix is the Set<>() method in my in-memory Context class, take a look here: https://github.com/bmckenzie/projects/blob/development/Projects.DataAccess.Memory/Context.cs

    I would rather avoid that if() {} and use some sort of a dictionary, if anyone has any suggestions?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.