Skip to content

Instantly share code, notes, and snippets.

@donnfelker
Created August 17, 2010 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donnfelker/532103 to your computer and use it in GitHub Desktop.
Save donnfelker/532103 to your computer and use it in GitHub Desktop.
List<int> userIds = (from item in _userRepository.Fetch()
where item.Name.Contains(search)
|| item.Role.Name.Contains(search)
select item.User.Id);
// Or
var stuff = _repository.Fetch();
var result = stuff.Where(x => x.StuffId== someId && (x.StuffName == null || x.StuffType != null));
public interface IQueryableRepository<T>: IRepository<T>
{
IQueryable<T> Fetch();
}
public class QueryableRepository<T> : Repository<T>, IQueryableRepository<T>
{
// Repository<T> comes from Sharp Arch.
public IQueryable<T> Fetch()
{
ISession session = Session;
var query = from item in session.Linq<T>() select item;
return query;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment