﻿<?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>Rob Ashton commented on Review: Microsoft N Layer App Sample, part VIII&amp;ndash;CRUD is so 90s</title><description>wow.</description><link>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment17</link><guid>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment17</guid><pubDate>Thu, 14 Jul 2011 06:23:09 GMT</pubDate></item><item><title>Duncan Smart commented on Review: Microsoft N Layer App Sample, part VIII&amp;ndash;CRUD is so 90s</title><description>Should have said "For one thing..."</description><link>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment16</link><guid>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment16</guid><pubDate>Thu, 14 Jul 2011 03:08:08 GMT</pubDate></item><item><title>Duncan Smart commented on Review: Microsoft N Layer App Sample, part VIII&amp;ndash;CRUD is so 90s</title><description>For in thing, I suspect the developer's first language isn't English (nor their 2nd or 3rd perhaps... :) ). It seems that "Change" is a typo for "Charge"... but still.</description><link>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment15</link><guid>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment15</guid><pubDate>Thu, 14 Jul 2011 03:07:17 GMT</pubDate></item><item><title>Željko commented on Review: Microsoft N Layer App Sample, part VIII&amp;ndash;CRUD is so 90s</title><description>As I see it, one reason to cast a null to some object would be if we had a function that expected  a certain object type as a parameter. The compiler would then need the cast to decide for the correct function. But in the Microsoft example, I really don't understand it.</description><link>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment14</link><guid>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment14</guid><pubDate>Wed, 13 Jul 2011 21:09:20 GMT</pubDate></item><item><title>Alex Simkin commented on Review: Microsoft N Layer App Sample, part VIII&amp;ndash;CRUD is so 90s</title><description>Casting null may be used in two cases:

1. For generic type inference when compiler cannot figure out type, and
2. When trying to use null as a result for the ternary operator to avoid "no implicit conversion" error. 

However, this is so 90's. Cool guys should use default(...) in such cases.

</description><link>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment13</link><guid>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment13</guid><pubDate>Wed, 13 Jul 2011 20:04:14 GMT</pubDate></item><item><title>Kamran commented on Review: Microsoft N Layer App Sample, part VIII&amp;ndash;CRUD is so 90s</title><description>Is this really how you should be performing this operation in an "N-Layer" application? Why not just encapsulate that saving logic (i.e. business logic!) into your service itself. What if someone provided an invalid account to the method (etc etc)?:

    public void LockAccount(string acctNum) {
        ServiceResult result = BankingService.LockAccount(acctNum);

        if (result.WasSuccessful) {
            // do something (display message, redirect, etc.)

            return RedirectToAction("Index");
        } else {
            // set errors/warnings/alerts/whatever
            // return view model or some alert mechanism
            base.Alert(result.Errors, "Sorry, we could not lock the account due to some errors:");

            return View();
        }
    }

Or something to that effect (i.e. encapsulating this saving stuff into the service itself) so that consumers of your service layer don't need to manually save entities? All of that code smells wrong to me.</description><link>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment12</link><guid>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment12</guid><pubDate>Wed, 13 Jul 2011 20:01:44 GMT</pubDate></item><item><title>tawani commented on Review: Microsoft N Layer App Sample, part VIII&amp;ndash;CRUD is so 90s</title><description>Who every wrote/reviewed/verified this code should not be allowed next to an IDE </description><link>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment11</link><guid>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment11</guid><pubDate>Wed, 13 Jul 2011 16:22:12 GMT</pubDate></item><item><title>David commented on Review: Microsoft N Layer App Sample, part VIII&amp;ndash;CRUD is so 90s</title><description>Well, a cast of null can be done in order to remind you what kind of type class you are dealing with. It does not heart. It can be a matter of readability.
For instance, I saw similar 'null casting' in PEX &amp; MOLES code.

In any case, I beleive that most of that code is outdated as they are working on V2.0 code. That code review is part of V1.0 Sample.</description><link>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment10</link><guid>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment10</guid><pubDate>Wed, 13 Jul 2011 14:21:24 GMT</pubDate></item><item><title>Nick commented on Review: Microsoft N Layer App Sample, part VIII&amp;ndash;CRUD is so 90s</title><description>Haha this is just embarrassing.</description><link>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment9</link><guid>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment9</guid><pubDate>Wed, 13 Jul 2011 13:51:22 GMT</pubDate></item><item><title>Alex Simkin commented on Review: Microsoft N Layer App Sample, part VIII&amp;ndash;CRUD is so 90s</title><description>@Jay

This is what Ayende ment as casting of null:

if (bankAccount == (BankAccount)null) {</description><link>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment8</link><guid>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment8</guid><pubDate>Wed, 13 Jul 2011 13:42:30 GMT</pubDate></item><item><title>Jay commented on Review: Microsoft N Layer App Sample, part VIII&amp;ndash;CRUD is so 90s</title><description>I don't quite understand the casting of null part??</description><link>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment7</link><guid>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment7</guid><pubDate>Wed, 13 Jul 2011 13:04:41 GMT</pubDate></item><item><title>Frank Quednau commented on Review: Microsoft N Layer App Sample, part VIII&amp;ndash;CRUD is so 90s</title><description>Sigh, and then customers frown because the argumentation and opinions expressed to them are so detached from Microsoft.

The null-cast alone shows blatant ignorance to what the developer is actually doing.

I have been wondering lately, did you find anything remotely positive about the whole "official guidance"?</description><link>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment6</link><guid>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment6</guid><pubDate>Wed, 13 Jul 2011 13:01:44 GMT</pubDate></item><item><title>Jeff Sternal commented on Review: Microsoft N Layer App Sample, part VIII&amp;ndash;CRUD is so 90s</title><description>If I'm reading this right, the LockAccount method also unlock locked accounts.</description><link>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment5</link><guid>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment5</guid><pubDate>Wed, 13 Jul 2011 12:42:59 GMT</pubDate></item><item><title>Scooletz commented on Review: Microsoft N Layer App Sample, part VIII&amp;ndash;CRUD is so 90s</title><description>Want to learn all the presented internals, how they _should_ be implemented, in terms of locking, tracking, states? Read NHibernate code and _learn_. The wrap around wrap around ORM. Gosh, are they paid for each line of code (additional bonus for ctrl+c, ctrl+v?</description><link>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment4</link><guid>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment4</guid><pubDate>Wed, 13 Jul 2011 12:16:07 GMT</pubDate></item><item><title>Peter Morlion commented on Review: Microsoft N Layer App Sample, part VIII&amp;ndash;CRUD is so 90s</title><description>With all respect to the people who coded this, but it looks like it was coded by an intern. Very sloppy stuff.</description><link>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment3</link><guid>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment3</guid><pubDate>Wed, 13 Jul 2011 11:36:55 GMT</pubDate></item><item><title>Dave commented on Review: Microsoft N Layer App Sample, part VIII&amp;ndash;CRUD is so 90s</title><description>Better questions are why LockAccount is always negating the lock status, allowing LOCKaccount also to unlock the account if it was already locked.

And why is a entity only marked 'modified' if changeTracker is set? Does this mean that if account.StartTrackingAll() isn't called that entity is never marked modified, but it is actually saved to the database??

And most importantly. If you lock an account, why on earth would you want to redirect the user to a transfer money page? </description><link>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment2</link><guid>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment2</guid><pubDate>Wed, 13 Jul 2011 09:29:59 GMT</pubDate></item><item><title>iwayneo commented on Review: Microsoft N Layer App Sample, part VIII&amp;ndash;CRUD is so 90s</title><description>ceremony, ceremony ceremony... why make patterns easy to work with? I mean, if you're MS - if your customers are learning patterns that are used in other languages - that might mean they have transferable knowledge. 

_This_ is what this is all about.

Take the EntLib pile of old *shit*

policy injection anyone?! 

and the EntLib Data Access Application Block!?!? A _lump_ of code that actually makes the task at hand 10000% harder than it would have been without it - while also completely screwing with the whole layout of your system....

NICE! 

Honestly - what the hell were they thinking?! http://msdn.microsoft.com/en-us/magazine/cc163766.aspx</description><link>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment1</link><guid>http://ayende.com/33793/review-microsoft-n-layer-app-sample-part-viii-crud-is-so-90s#comment1</guid><pubDate>Wed, 13 Jul 2011 09:12:55 GMT</pubDate></item></channel></rss>