Hi,
I am trying to build a generic repository that wraps SubSonic. I have this code:
Dictionary<Type, SubSonic.Repository.IRepository> repositories =
new Dictionary<Type,SubSonic.Repository.IRepository>();
private IDataProvider dataProvider = ...;
private SubSonic.Repository.IRepository getRepository<T>()
{
if (this.repositories.ContainsKey(typeof(T)) == false)
{
this.repositories [ typeof(T) ] = new SimpleRepository(this.dataProvider);
}
return (this.repositories [ typeof(T) ]);
}
public IQueryable<T> Lookup<T>()
{
SubSonic.Repository.IRepository repo = this.getRepository<T>();
return (repo.All<T>());
}
However, when I try to run perform a lookup, I get a System.Data.SqlClient.SqlException: Invalid object name 'Posts'.
For example:
IQueryable<Post> posts = Lookup<Post>();
It seems SubSonic is trying to pluralize the Post class. Is there any way to prevent it from doing so?
Thanks,
Ricardo Peres