Category Archives: MVC

Generic Repository for Entity Framework with DbContext and Code First

I’ve recently been developing a small n-tier application using Domain Driven Development. In the interests of having a separation of concerns I built a generic repository that can be passed into my services.   using System; using System.Data; using System.Linq; using System.Data.Entity; using System.Linq.Expressions;   namespace Swink.Repositories { public class Repository<TEntity, TContext> : IRepository<TEntity>, IDisposable [...]

Google Static Maps Zend View Helper

From time to time I’ve needed to add static Google maps to my website. The reason to use static maps may vary from accessibility concerns to usage on mobile devices that don’t support JavaScript. Since I’m a lazy programmer I like to create re-usable objects so that I don’t have to rewrite the code over [...]

Custom Zend DB Table Row Class with Validation and Filtering

This is a follow up post to my previous post about creating a custom Zend Db Table base class. As mentioned in the previous post the Zend Framework implementation of their database abstraction layer is an implementation of the Table Data Gateway pattern and the Row Data Gateway pattern. This implementation is well tested and provides a [...]

Custom Zend DB Table Base Class with Static Finder Methods

I’m putting it out there that I’m a fan of the Active Record Software Design Pattern.  Zend Framework uses a different design pattern for it’s database modelling called the Table Data Gateway Pattern.  In reality both are very good at doing what they’re meant to do, ie, model the tables in a database and return [...]