Repositories can be employed to segregate applications from the complexities of data access, making code easier to maintain. In this video, Jeremy McPeak starts by explaining the heart of the repository pattern: the CRUD principle. Jeremy then demonstrates variations on this implementation while cautioning against potential pattern violations. Following along in Visual Studio, novice C# developers will learn how to define an interface to implement concrete repository classes, correctly implement repository patterns, and create specialized repositories.

Take your C# skills to the next level with Learning Paths.

Jeremy McPeak is a self-taught programmer who began his career tinkering with websites in 1998. He is the author of Beginning JavaScript, 5th Edition, JavaScript 24-Hour Trainer, and co-author of Professional Ajax, 2nd Edition. He also contributes to Tuts+ Code (, providing articles, video tutorials, and courses on JavaScript, C#, ASP.NET, and PHP. He is currently employed by an oil and gas company, building in-house conventional and web applications.

Article image: Screen from "How do I use the repository pattern in C#?" (source: O'Reilly).