My favorites | Sign in
Logo
                
Changes to /trunk/src/Example/Remember.Model/Specification.cs
r0 vs. r392   Edit
  Compare: vs.   Format:
Revision r392
Go to: 
Project members, sign in to write a code review
/trunk/src/Example/Remember.Model/Specification.cs   r0 /trunk/src/Example/Remember.Model/Specification.cs   r392
  1 using System;
  2 using System.Collections.Generic;
  3 using System.Linq;
  4 using System.Text;
  5
  6 namespace Remember.Model
  7 {
  8 public abstract class Specification<T>
  9 where T : class
  10 {
  11 public bool IsSatisfiedBy(T candidate)
  12 {
  13 if (candidate == null)
  14 throw new ArgumentNullException("candidate");
  15
  16 return SatisfiersFrom(new[] { candidate }).Any();
  17 }
  18
  19 public IEnumerable<T> SatisfiersFrom(IEnumerable<T> candidates)
  20 {
  21 if (candidates == null)
  22 throw new ArgumentNullException("candidates");
  23
  24 return SatisfiersFrom(candidates.AsQueryable());
  25 }
  26
  27 public abstract IQueryable<T> SatisfiersFrom(IQueryable<T> candidates);
  28 }
  29 }
Hosted by Google Code