Created
July 29, 2010 10:00
-
-
Save jhollingworth/497759 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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