I think there is a sample included. Your repository should be in the controller so you should have something like:
//ctor
public SampleController(IRepository<User> userRepo){
_userRepo = userRepo;
}
where _userRepo is a private member declared as:
private readonly IRepository<User> _userRepo;
Then on a method you can have something like:
Public ActionResult GetList(string email, string color) {
_userRepo.GetAll().FindUser(email).FindByColor(color);
}
Now I'm assuming you have an extension method called FindByColor.
Hope that helps.
Sent from my iPod
On Feb 10, 2013, at 2:48 AM, mardo <
martin...@gmail.com> wrote:
> First thank you for building a great design. I have some general questions that I hope could get answered.
>
> First, I dont like using the repository directly in the domain because I know I will start recreating the same queries all over the place. From what i can understand this is what the IQuery capability is for.
>
> So I created:
>
> using System.Linq;
> using SignSpy.Domain;
>
> namespace SignSpy.Domain.Queries
> {
> /// <summary>
> /// Query object to return all customers who are considered active, based on a minimum number of orders
> ///
> /// This is a "find" vs. a "query"; i.e., this filters the source based using supplied criteria
> /// </summary>
> public static class UserQuery
> {
> public static IQueryable<User> FindUser(this IQueryable<User> user, string email) {
> return user.Where(c => c.EMailAddress == email);
> }
>
> }
> }
>
> I am having a heck of a time figuring out how to call this in my repository the MyStore didnt have any examples.
>
> Any help would be much appreciated, its my guess I could then do something like this.
>
> _obj.FindUser("
bl...@aol.com").WhereColorIs("Blue");
>
> At least that is my goal here.
>
> Any help would be much appreciated, and thank you in advance for reading.
>
> -Marty
>
>
> --
> You received this message because you are subscribed to the Google Groups "S#arp Lite" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
sharp-lite+...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.
>
>