Skip to content

Instantly share code, notes, and snippets.

@jhollingworth
Created July 29, 2010 10:00
Show Gist options
  • Save jhollingworth/497759 to your computer and use it in GitHub Desktop.
Save jhollingworth/497759 to your computer and use it in GitHub Desktop.
public abstract class Query<T> : IQuery<T>
{
private readonly ISession _session;
protected Query(ISession session)
{
_session = session;
}
public abstract T Execute();
}
public interface IQuery<T>
{
T Execute();
}
public class Venue
{
public string Name { get; set; }
}
public class AllVenuesQuery : Query<List<Venue>>
{
private readonly ISession _session;
public AllVenuesQuery(ISession session) : base(session)
{
_session = session;
}
public override List<Venue> Execute()
{
return (from v in _session.Linq<Venue>()
where v.Name != "Maze"
select v).ToList();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment