﻿<?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>Harry M commented on Refactoring toward frictionless &amp; odorless code: Getting rid of globals</title><description>@Scooletz i was thinking of the situation that you are calling an action that doesn't hit the database, but there are actions on the controller that do. With the lazy Func
&lt;isession you wouldn't have the overhead of opening a transaction.
  
  
Could get really funky with a lazy proxyied ISession and keep the code even cleaner I guess.
&gt;</description><link>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment10</link><guid>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment10</guid><pubDate>Tue, 12 Apr 2011 12:49:56 GMT</pubDate></item><item><title>Patrick Smacchia commented on Refactoring toward frictionless &amp; odorless code: Getting rid of globals</title><description>&gt;While I don’t really mind having global state, it tends to bite you on the ass eventually, 
  
  
It always does bite afterthought IMHO
</description><link>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment9</link><guid>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment9</guid><pubDate>Tue, 12 Apr 2011 08:58:30 GMT</pubDate></item><item><title>Dmitry commented on Refactoring toward frictionless &amp; odorless code: Getting rid of globals</title><description>Maybe DI is not cool anymore @ ALT .NET.
</description><link>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment8</link><guid>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment8</guid><pubDate>Tue, 12 Apr 2011 04:10:21 GMT</pubDate></item><item><title>Nick Sergeev commented on Refactoring toward frictionless &amp; odorless code: Getting rid of globals</title><description>Why we can't simply inject session directly to constructor? What the point of custom filter?
</description><link>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment7</link><guid>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment7</guid><pubDate>Mon, 11 Apr 2011 17:40:43 GMT</pubDate></item><item><title>Scooletz commented on Refactoring toward frictionless &amp; odorless code: Getting rid of globals</title><description>@Harry M
  
It should end with an ISession injected right to a controller constructor (or the action itself :&gt;). No current resolver needed.
</description><link>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment6</link><guid>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment6</guid><pubDate>Mon, 11 Apr 2011 11:31:37 GMT</pubDate></item><item><title>Guillaume commented on Refactoring toward frictionless &amp; odorless code: Getting rid of globals</title><description>Have you considered using a custom "ActionInvoker" in your controller instead ?
</description><link>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment5</link><guid>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment5</guid><pubDate>Mon, 11 Apr 2011 09:33:56 GMT</pubDate></item><item><title>Harry M commented on Refactoring toward frictionless &amp; odorless code: Getting rid of globals</title><description>Is this series going to end up with a constuctor injected (Func
&lt;isession getOrOpenSessionForCurrentRequest*)?
  
  
* well maybe something with a shorter name
&gt;</description><link>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment4</link><guid>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment4</guid><pubDate>Mon, 11 Apr 2011 09:31:30 GMT</pubDate></item><item><title>Scooletz commented on Refactoring toward frictionless &amp; odorless code: Getting rid of globals</title><description>Yeah, the session factory is hold in a static field, so it's singleton, but it cannot be used anywhere else (for instance if I need StatelessSession or evicition of some cache regions). It should be a singleton in a container.
</description><link>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment3</link><guid>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment3</guid><pubDate>Mon, 11 Apr 2011 09:18:35 GMT</pubDate></item><item><title>Scooletz commented on Refactoring toward frictionless &amp; odorless code: Getting rid of globals</title><description>Yes:
  
- the session is injected via a property, constructor is much nicer.
  
- the session factory is hold in a filter and I don't know if the filter is instantiated once per application (it should)
</description><link>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment2</link><guid>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment2</guid><pubDate>Mon, 11 Apr 2011 09:16:27 GMT</pubDate></item><item><title>Paul Stovell commented on Refactoring toward frictionless &amp; odorless code: Getting rid of globals</title><description>The attribute should probably create/commit a transaction too. 
</description><link>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment1</link><guid>http://ayende.com/4808/refactoring-toward-frictionless-odorless-code-getting-rid-of-globals#comment1</guid><pubDate>Mon, 11 Apr 2011 09:16:26 GMT</pubDate></item></channel></rss>