ASP.NET MVC Storefront Part 3: Pipes and Filters

Please install Silverlight or click download to watch video locally.

Rob Conery discusses the feedback from Parts 1 and 2, and then dive into the Pipes and Filters implementation on the IQueryable repository.

Presented by Rob Conery

Duration: 10 minutes, 45 seconds

Date: 27 May 2008

Watch    Video   |   Download    Video

Video downloads: WMV  |  Zune  |  iPod  |  PSP  |  MPEG-4  |  3GP

Audio downloads: AAC  |  WMA  |  MPEG-4  |  MPEG-3  |  MPEG-2

Comments : 12

Leave a Comment

RobCarr : On September 01, 2008 12:32 PM said:

Video is over 16 mins not 10 mins.

vasireddybharathreddy : On September 06, 2008 10:38 PM said:

Video is too good but as it is new I felt it to be too fast. I think it does same for others too.

leather : On September 18, 2008 8:21 AM said:

Hmm... Is this an intro to MVC or pipes and filters and TDD???

Good video but it's slightly frustrating if you want to get into the details on the MVC... In future perhaps you could focus on one thing at a time?

james_world : On October 27, 2008 6:53 AM said:

I think this is a great series - there are plenty of tutorials around tightly focussed on MVC (you don't have to leave this site to find them). I really appreciate the effort to give a complete view of the vision of MVC - of which testability is a notable part. I also appreciate the willingness to take comments constructively and feedback into the process. For those who think the pace is too fast - use the pause and rewind buttons! An excellent piece of work Rob, that I will be recommending to others.

joechung : On January 01, 2009 7:46 PM said:

This was a nice video demonstrating TDD, but there wasn't really much about ASP.NET MVC.

Pikesville Paesano : On January 04, 2009 12:42 AM said:

While I'm a died in the wool stored proc author, I'm intriqued by pipes & filters, I do however have one thought: If you have a table with several foreign keys and you're likely to want to filter by all of them, wouldn't it make sense to have your service consolidate these filtering methods? Imagine an address class and an address filter with filters for city, County, state, etc. I used an enum and a switch statement to keep the clutter down on my Service:

       public IList<Address> GetAddressCollectionFilterWithKeyField(Address.FilterKey KeyField,  int id)

       {

           switch (KeyField)

           {

               case Address.FilterKey.AddressType:

                   return _repository.GetAddressCollection().WithAddressType(id).ToLi st();

               case Address.FilterKey.District:

                   return _repository.GetAddressCollection().WithDistrict(id).ToList( );

               case Address.FilterKey.City:

                   return _repository.GetAddressCollection().WithCity(id).ToList();

               case Address.FilterKey.County:

                   return _repository.GetAddressCollection().WithCounty(id).ToList();

               case Address.FilterKey.State:

                   return _repository.GetAddressCollection().WithState(id).ToList();

               default:

                   return null;

           }

       }

any thoughts to potential weaknesses to this approach?

Pikesville Paesano : On January 04, 2009 12:50 AM said:

Another thought, when it comes to testing, why not create fewer test methods, but add more assertions?

For example:

[TestMethod]

public void catalogService_Repository_Can_Filter_ById()

{

   Address  address = catalogService.GetAddressById(2);

   Assert.IsNotNull(address);

   address = catalogService.GetAddressById(3);

   Assert.IsNotNull(address);

   address = catalogService.GetAddressById(-1);

   Assert.IsNull(address);

}

note that the final test is for null - this revealed that when .WithId(id).Single(); is null, it throws an exception, so I wrapped my GetAddressByID  function with a try catch & returned a null if it failed.

Thoughts anyone?

This is a wonderful series!

cheburek : On April 01, 2009 9:23 AM said:

Good video but to much attention for tests. I think that it is fine to talk about tests in one chapter but showing the same 3 videos is too boring. The final target is working application but not tests. Thus I don't understand why it is so important to show in video that we add some method that throws exception, write test, build application and run test to make sure that method is calling. Let's more concentrate on the architecture of application and how to do something but not show the test writing manual.

Rafal Skalski : On April 15, 2009 10:21 PM said:

Good stuff, TDD is new black (at least for me :)

for those who may wonder like me why tests returns 10 products with category 11, new code below for GetProducts() method in TestCatalogRepository

public IQueryable<Product> GetProducts() {

IList<Product> result = new List<Product>();

//loop for each category

int loopIndex = 0;

for (int x = 10; x <= 15; x++) {

for (int y = 1; y <= 5; y++) {

Product p = new Product();

p.Name = "Product" + loopIndex.ToString();

p.ID = x;

p.ListPrice = x * 5.68M;

p.SummaryDescription = "Test";

p.CategoryID = x;

loopIndex++;

result.Add(p);

}

}

return result.AsQueryable<Product>();

}

taken from http://mvcsamples.codeplex.com/SourceControl/changeset/view/3019#80461

I wish more people spent some time writing or making video tutorials about repository pattern.

cheers Rob

Al Brin : On April 19, 2009 7:56 PM said:

Way too fast! I've got to go study the pipes and filters pattern, but don't know when I'll have time. :(

xelfix24 : On June 27, 2009 4:59 PM said:

Where can I download the source codes???

xelfix24 : On June 27, 2009 4:59 PM said:

Where can I download the source code?

Leave a Comment

You must be logged in to leave a comment. Click here to log in.

Microsoft Communities