I'd like to expose a Repository as an 'IQueryable' type.
The repository uses Linq to NHibernate to communicate with the database.
Can anyone point me at an example implementation?
For example, what would the corresponding 'GetEnumerator()' implementation on my repository look like?
Edit:
Would something like this be appropriate?
public class MyTypeRepository : IEnumerable<MyType>
{
IEnumerator<MyType> IEnumerable<MyType>.GetEnumerator()
{
return Session.Linq<MyType>().GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable<MyType>)this).GetEnumerator();
}
}