<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-8942599.post642624330475513778..comments</id><updated>2009-07-23T02:08:35.207-04:00</updated><category term='AOP'/><category term='Visual Studio'/><category term='Analytics'/><category term='SQL'/><category term='CSS'/><category term='SharePoint'/><category term='rants'/><category term='Windows Services'/><category term='selenium'/><category term='Tips'/><category term='msbuild'/><category term='general'/><category term='opinions'/><category term='windows 7'/><category term='twelve-days-of-code'/><category term='Legacy Projects'/><category term='vegas mix06'/><category term='TDD'/><category term='BDD'/><category term='web 2.0'/><category term='Software Design'/><category term='FxCop'/><category term='selenium toolkit'/><category term='log4net'/><category term='.net'/><category term='fun'/><category term='guided by tests'/><category term='blogging'/><category term='cool tech'/><category term='unity'/><title type='text'>Comments on the urban canuk, eh: Creating a better Wrapper using AOP</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.bryancook.net/feeds/642624330475513778/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default'/><link rel='alternate' type='text/html' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html'/><author><name>bryan</name><uri>http://www.blogger.com/profile/01332614158223702009</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8942599.post-3107979035757383476</id><published>2009-07-23T02:08:35.207-04:00</published><updated>2009-07-23T02:08:35.207-04:00</updated><title type='text'>Right on, Krzysztof.  I&amp;#39;m working on an update...</title><content type='html'>Right on, Krzysztof.  I&amp;#39;m working on an update for this post and realized my mistake after visiting those links  the second time through.&lt;br /&gt;&lt;br /&gt;Disappointing though -- I didn&amp;#39;t see a GenerateProxyWithoutTarget overload that accepts a ProxyGeneratorOptions with Generics support.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/3107979035757383476'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/3107979035757383476'/><link rel='alternate' type='text/html' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html?showComment=1248329315207#c3107979035757383476' title=''/><author><name>bryan</name><uri>http://www.blogger.com/profile/01332614158223702009</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html' ref='tag:blogger.com,1999:blog-8942599.post-642624330475513778' source='http://www.blogger.com/feeds/8942599/posts/default/642624330475513778' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1859931516'/></entry><entry><id>tag:blogger.com,1999:blog-8942599.post-3438232082452449937</id><published>2009-07-21T04:57:14.754-04:00</published><updated>2009-07-21T04:57:14.754-04:00</updated><title type='text'>Bryan,

well - no. IProxyGenerationHook does that....</title><content type='html'>Bryan,&lt;br /&gt;&lt;br /&gt;well - no. IProxyGenerationHook does that.&lt;br /&gt;ProxyGenerationHook statically, during proxy type creation process decides which methods should be overriden hence, which you want to allow to be intercepted.&lt;br /&gt;IInterceptorSelector operates on proxy _instance_. For each instance before first call to the method it gets called to decide which interceptors should be used for that particular method.&lt;br /&gt;&lt;br /&gt;So you can use the Hook to filter out methods you dont want to intercept, and then with the Selector put appropriate interceptors for each method you want to intercept.&lt;br /&gt;&lt;br /&gt;I prefer interceptor-per-method approach, that is each interceptor works with only one method (or all methods in case of general use interceptors), so that interceptor can get straight to the point, without wasting time verifying it indeed is intercepting the call it is interested in.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/3438232082452449937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/3438232082452449937'/><link rel='alternate' type='text/html' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html?showComment=1248166634754#c3438232082452449937' title=''/><author><name>Krzysztof Koźmic (2)</name><uri>http://www.blogger.com/profile/03148626964269392558</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html' ref='tag:blogger.com,1999:blog-8942599.post-642624330475513778' source='http://www.blogger.com/feeds/8942599/posts/default/642624330475513778' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-164103187'/></entry><entry><id>tag:blogger.com,1999:blog-8942599.post-6266614592610704212</id><published>2009-07-10T10:51:49.865-04:00</published><updated>2009-07-10T10:51:49.865-04:00</updated><title type='text'>Krzysztof,

Thanks for the feedback.  The &lt;a href=...</title><content type='html'>Krzysztof,&lt;br /&gt;&lt;br /&gt;Thanks for the feedback.  The &lt;a href="http://api.castleproject.org/html/T_Castle_DynamicProxy_IInterceptorSelector.htm" rel="nofollow"&gt;IInterceptorSelector&lt;/a&gt; looks interesting -- a custom selector is associated to the ProxyGenerator as part of the &lt;a href="http://api.castleproject.org/html/T_Castle_DynamicProxy_ProxyGenerationOptions.htm" rel="nofollow"&gt;ProxyGeneratorOptions&lt;/a&gt; -- which in turn helps the &lt;a href="http://api.castleproject.org/html/M_Castle_DynamicProxy_ProxyGenerator_CreateInterfaceProxyWithoutTarget_3.htm" rel="nofollow"&gt;ProxyGenerator&lt;/a&gt; determine which methods should be intercepted up front?&lt;br /&gt;&lt;br /&gt;I can see how this would cut down on reflecting the incoming method to determine if it should be intercepted, but the remaining reflection would still be required to map the incoming method to the 3rd party class.&lt;br /&gt;&lt;br /&gt;I keep meaning to come back to this post and optimize for performance/memory, and the IInterceptorSelector gives me some good ideas.&lt;br /&gt;&lt;br /&gt;Cheers.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/6266614592610704212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/6266614592610704212'/><link rel='alternate' type='text/html' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html?showComment=1247237509865#c6266614592610704212' title=''/><author><name>bryan</name><uri>http://www.blogger.com/profile/01332614158223702009</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html' ref='tag:blogger.com,1999:blog-8942599.post-642624330475513778' source='http://www.blogger.com/feeds/8942599/posts/default/642624330475513778' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1859931516'/></entry><entry><id>tag:blogger.com,1999:blog-8942599.post-7759023357124247123</id><published>2009-07-10T09:18:27.160-04:00</published><updated>2009-07-10T09:18:27.160-04:00</updated><title type='text'>Nice article. You could use IInterceptorSelector a...</title><content type='html'>Nice article. You could use IInterceptorSelector and use interceptor per method strategy to improve performance (not pay the cost of reflection for each call) and make the code cleaner.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/7759023357124247123'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/7759023357124247123'/><link rel='alternate' type='text/html' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html?showComment=1247231907160#c7759023357124247123' title=''/><author><name>Krzysztof Koźmic (2)</name><uri>http://www.blogger.com/profile/03148626964269392558</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html' ref='tag:blogger.com,1999:blog-8942599.post-642624330475513778' source='http://www.blogger.com/feeds/8942599/posts/default/642624330475513778' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-164103187'/></entry><entry><id>tag:blogger.com,1999:blog-8942599.post-6428102504104552978</id><published>2009-02-06T15:56:00.000-05:00</published><updated>2009-02-06T15:56:00.000-05:00</updated><title type='text'>Thanks for the AutoMapper recommendation.&lt;br&gt;&lt;br&gt;Y...</title><content type='html'>Thanks for the AutoMapper recommendation.&lt;BR/&gt;&lt;BR/&gt;You're point is valid, there's no compile time checking here. Either way, I wouldn't blindly expect this to work without a few unit tests in place.&lt;BR/&gt;&lt;BR/&gt;To your point about very simple mapping, or complex boundary conditions, this &lt;I&gt;sample&lt;/I&gt;  does not address those concerns.  Though with some creative thinking, it's not hard to imagine forwarding complex calls to a customized interceptor.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/6428102504104552978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/6428102504104552978'/><link rel='alternate' type='text/html' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html?showComment=1233953760000#c6428102504104552978' title=''/><author><name>bryan</name><uri>http://www.blogger.com/profile/01332614158223702009</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html' ref='tag:blogger.com,1999:blog-8942599.post-642624330475513778' source='http://www.blogger.com/feeds/8942599/posts/default/642624330475513778' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1859931516'/></entry><entry><id>tag:blogger.com,1999:blog-8942599.post-1830653605587867051</id><published>2009-02-06T11:17:00.000-05:00</published><updated>2009-02-06T11:17:00.000-05:00</updated><title type='text'>Check out also AutoMapper (http://www.codeplex.com...</title><content type='html'>Check out also AutoMapper (http://www.codeplex.com/AutoMapper). Eventhough its purpose is not exactly the same as what you are tryng to solve but  sometimes it is only about data objects and then it is perfectly acceptable to do it in "more disconnected" way. but anyway, honestly i dont like neither solution. it is true that mapping is almost always just a very stupid boring code but you have almost always exceptions. What if field in adapter interface must be translated into two fields in target object. And this is really very simple transformation. Moreover i like when compiler do as much checking as possible for me and you are giving up this feature.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/1830653605587867051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/1830653605587867051'/><link rel='alternate' type='text/html' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html?showComment=1233937020000#c1830653605587867051' title=''/><author><name>naraga</name><uri>http://www.blogger.com/profile/14068293829766895933</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html' ref='tag:blogger.com,1999:blog-8942599.post-642624330475513778' source='http://www.blogger.com/feeds/8942599/posts/default/642624330475513778' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-640716975'/></entry><entry><id>tag:blogger.com,1999:blog-8942599.post-6137331999325781110</id><published>2009-02-06T10:18:00.000-05:00</published><updated>2009-02-06T10:18:00.000-05:00</updated><title type='text'>Linq is definitely fun!  I was going for readabili...</title><content type='html'>Linq is definitely fun!  I was going for readability using the Select/Where/Single syntax, but your comments are valid and optimization here is needed.  I've updated the sample.&lt;BR/&gt;&lt;BR/&gt;This bug fix provides more meaningful exception information, as we'll be returning &lt;I&gt;NotSupportedException&lt;/I&gt; instead of a &lt;I&gt;NullReferenceException&lt;/I&gt;.  I've updated the exception to provide more meaningful detail as well.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/6137331999325781110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/6137331999325781110'/><link rel='alternate' type='text/html' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html?showComment=1233933480000#c6137331999325781110' title=''/><author><name>bryan</name><uri>http://www.blogger.com/profile/01332614158223702009</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html' ref='tag:blogger.com,1999:blog-8942599.post-642624330475513778' source='http://www.blogger.com/feeds/8942599/posts/default/642624330475513778' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1859931516'/></entry><entry><id>tag:blogger.com,1999:blog-8942599.post-6317149645397767875</id><published>2009-02-06T07:51:00.000-05:00</published><updated>2009-02-06T07:51:00.000-05:00</updated><title type='text'>The Linq part can actually be shortened (and corre...</title><content type='html'>The Linq part can actually be shortened (and corrected) to .OfType&amp;lt;MappedFieldAttribute&amp;gt;().SingleOrDefault(mf =&amp;gt; mf.TargetType == _targetType)&lt;BR/&gt;The original code will fail if there are additional attributes and the null comparison will never evaluate to true.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/6317149645397767875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/6317149645397767875'/><link rel='alternate' type='text/html' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html?showComment=1233924660000#c6317149645397767875' title=''/><author><name>khaba</name><uri>http://khaba.myopenid.com/</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/openid16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html' ref='tag:blogger.com,1999:blog-8942599.post-642624330475513778' source='http://www.blogger.com/feeds/8942599/posts/default/642624330475513778' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-468317800'/></entry><entry><id>tag:blogger.com,1999:blog-8942599.post-6167211125419132341</id><published>2009-02-06T03:48:00.000-05:00</published><updated>2009-02-06T03:48:00.000-05:00</updated><title type='text'>Just a note, the line&lt;br&gt;&lt;br&gt;if (attribute == null...</title><content type='html'>Just a note, the line&lt;BR/&gt;&lt;BR/&gt;if (attribute == null) return false;&lt;BR/&gt;&lt;BR/&gt;is meaningless after using Singel(), since it will throw an exception if no matching attribute is found. To return null if nothing is found you have to use SingleOrDefault()</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/6167211125419132341'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/6167211125419132341'/><link rel='alternate' type='text/html' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html?showComment=1233910080000#c6167211125419132341' title=''/><author><name>Nitride</name><uri>http://www.blogger.com/profile/06362075640927930101</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html' ref='tag:blogger.com,1999:blog-8942599.post-642624330475513778' source='http://www.blogger.com/feeds/8942599/posts/default/642624330475513778' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1854602068'/></entry><entry><id>tag:blogger.com,1999:blog-8942599.post-7973349982897126316</id><published>2009-02-05T22:31:00.000-05:00</published><updated>2009-02-05T22:31:00.000-05:00</updated><title type='text'>My favorite part of your post is the Linq usage to...</title><content type='html'>My favorite part of your post is the Linq usage to look for custom attributes. Creative idea, excellent article.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/7973349982897126316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8942599/642624330475513778/comments/default/7973349982897126316'/><link rel='alternate' type='text/html' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html?showComment=1233891060000#c7973349982897126316' title=''/><author><name>bradygaster</name><uri>http://bradygaster.myopenid.com/</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/openid16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.bryancook.net/2009/02/creating-better-wrapper-using-aop.html' ref='tag:blogger.com,1999:blog-8942599.post-642624330475513778' source='http://www.blogger.com/feeds/8942599/posts/default/642624330475513778' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1718596693'/></entry></feed>
