public IQueryable <TEntity> Set <TEntity>() where TEntity : class { if (typeof(TEntity) == typeof(Location)) { return((IQueryable <TEntity>)Locations.AsQueryable()); } if (typeof(TEntity) == typeof(Person)) { return((IQueryable <TEntity>)Persons.AsQueryable()); } if (typeof(TEntity) == typeof(RainbowType)) { return((IQueryable <TEntity>)RainbowTypes.AsQueryable()); } if (typeof(TEntity) == typeof(RainbowSighting)) { return((IQueryable <TEntity>)RainbowSightings.AsQueryable()); } throw new InvalidOperationException("Invalid entity type: " + typeof(TEntity)); }