Last active
August 29, 2015 14:27
-
-
Save hazzik/ae6f9185ceb186004f50 to your computer and use it in GitHub Desktop.
NHibernateQuery
This file contains hidden or 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
interface IQuery<TCriteria, TResult> { TResult Execute(TCriteria criteria); } | |
class BooksWithISBN { public string ISBN { get; set; } } | |
class BooksWithISBNQuery : IQuery<BooksWithISBN, IEnumerable<Book>> { | |
public IEnumerable<Book> Execute(BooksWithISBN criteria) { | |
return session.Query<Book>().Where(b => b.ISBN == criteria.ISBN).AsEnumerable(); | |
} | |
} |
This file contains hidden or 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
interface IQuery<TResult> | |
interface IBooksWithISBN : IQuery<TResult> { string ISBN { get; set; } } | |
class BooksWithISBNQuery : IBooksWithISBN { | |
public string ISBN { get; set; } | |
public IEnumerable<Book> Execute() { | |
return session.Query<Book>().Where(b => b.ISBN == ISBN).AsEnumerable(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment