﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Phil commented on Northwind Starter Kit Review: From start to finishing&amp;ndash;tracing a request</title><description>+1 to Dmitry.  Having data access in your domain model is an absolute nightmare.  Even though you can mock your DA interfaces it makes for way uglier tests.</description><link>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment10</link><guid>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment10</guid><pubDate>Wed, 25 Jan 2012 23:22:11 GMT</pubDate></item><item><title>Dan Turner commented on Northwind Starter Kit Review: From start to finishing&amp;ndash;tracing a request</title><description>constructs a view of a Customer*</description><link>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment9</link><guid>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment9</guid><pubDate>Mon, 23 Jan 2012 05:58:08 GMT</pubDate></item><item><title>Dan Turner commented on Northwind Starter Kit Review: From start to finishing&amp;ndash;tracing a request</title><description>So I'm guessing your problem is with the Repository and not the Service?

Because in my opinion that service performs a clear purpose, it constructs a view Customer.  Admittedly it seems as though the service and view could have been named better.  I am also more than happy to see code like this NOT happen in the body of a controller action for all but the most simplest of scenarios.</description><link>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment8</link><guid>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment8</guid><pubDate>Mon, 23 Jan 2012 05:57:25 GMT</pubDate></item><item><title>Dmitry commented on Northwind Starter Kit Review: From start to finishing&amp;ndash;tracing a request</title><description>@Stan

You are not supposed to have data access code (whether it is repositories or ADO .NET classes) inside entities. That is the whole point of the POCO concept.</description><link>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment7</link><guid>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment7</guid><pubDate>Mon, 23 Jan 2012 04:46:06 GMT</pubDate></item><item><title>Stan commented on Northwind Starter Kit Review: From start to finishing&amp;ndash;tracing a request</title><description>When your model is just a bag of properties and your application is just a CRUD you realy dont need repository.
When you have complex model it is another story.
It is a common case for commands when I should access one aggregate from other and than I prefer to inject repository into my entities instead of ISession. Just dont like to see NH use in a model.
For queries I dont fetch model entities and than convert them to DTOs. I map DTOs to DB and directly use ISession in my query handlers.</description><link>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment6</link><guid>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment6</guid><pubDate>Sun, 22 Jan 2012 15:16:44 GMT</pubDate></item><item><title>Lord spa commented on Northwind Starter Kit Review: From start to finishing&amp;ndash;tracing a request</title><description>Despite many worthy views to the contrary I stick to lines of code at my favourite metric.  It encourages the team to stop writing rubbish that others have to decipher and maintain, and to cut out layers of abstraction when they find them.</description><link>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment5</link><guid>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment5</guid><pubDate>Sat, 21 Jan 2012 08:38:39 GMT</pubDate></item><item><title>Dan commented on Northwind Starter Kit Review: From start to finishing&amp;ndash;tracing a request</title><description>@dotnetchris

I like your assertion that "Generic repositories only provide value if they're produced through composition, not inheritance."  I've seen this done many times before and never been comfortable with it.

Would you propose that, instead of 

CustomerRepository : GenericRepository&lt;Customer&gt;{ }

Use something like:

CustomerRepository : ICustomerRepository
{
    GenericRepository r {get;set;}

    public Customer FindById(string id){ return r.FindById(id};
}

Or am I missing your point?</description><link>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment4</link><guid>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment4</guid><pubDate>Fri, 20 Jan 2012 15:35:06 GMT</pubDate></item><item><title>dotnetchris commented on Northwind Starter Kit Review: From start to finishing&amp;ndash;tracing a request</title><description>IMO, the inherent failure here is the dependency this author has taken: ICustomerRepository. ICustomerRepository then implements a generic repository through inheritance which is epic fail. Generic repositories only provide value if they're produced through composition, not inheritance.

If this code showed:

public CustomerDetailWindowWorkerServices(IRepository&amp;lt;Customer&amp;gt;  customerRepository)

it would likely have far more value.

Completing repository implementations through inheritance is a gigantic anemic model problem. Leaving you with tons of useless classes like:

public CustomerRepository : GenericRepository&amp;lt;Customer&amp;gt; { Public Customer FindById(string id) { return base.FindById(id) } }

Or other noise abstractions. Or even entirely empty classes

public CustomerRepository : GenericRepository&amp;lt;Customer&amp;gt; { }

^ can't get any more anemic than that.

First post had all my generics butchered, hopefully this one works. </description><link>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment3</link><guid>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment3</guid><pubDate>Fri, 20 Jan 2012 14:48:58 GMT</pubDate></item><item><title>dotnetchris commented on Northwind Starter Kit Review: From start to finishing&amp;ndash;tracing a request</title><description>IMO, the inherent failure here is the dependency this author has taken: ICustomerRepository. ICustomerRepository then implements a generic repository through inheritance which is epic fail. Generic repositories only provide value if they're produced through composition, not inheritance.

If this code showed:

public CustomerDetailWindowWorkerServices(IRepository&lt;Customer&gt; customerRepository)

it would likely have far more value.

Completing repository implementations through inheritance is a gigantic anemic model problem. Leaving you with tons of useless classes like:

public CustomerRepository : GenericRepository&lt;Customer&gt;
{
Public Customer FindById(string id) {
return base.FindById(id)
}
}

Or other noise abstractions. Or even entirely empty classes

public CustomerRepository : GenericRepository&lt;Customer&gt;
{
}

^ can't get any more anemic than that.</description><link>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment2</link><guid>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment2</guid><pubDate>Fri, 20 Jan 2012 14:33:16 GMT</pubDate></item><item><title>Rafal commented on Northwind Starter Kit Review: From start to finishing&amp;ndash;tracing a request</title><description>The point is to increase the sales of your ORM profiler.</description><link>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment1</link><guid>http://ayende.com/153060/northwind-starter-kit-review-from-start-to-finishing-tracing-a-request#comment1</guid><pubDate>Fri, 20 Jan 2012 10:04:12 GMT</pubDate></item></channel></rss>