<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Drew's Blog : .NET</title><link>http://weblogs.asp.net/dmarsh/archive/tags/.NET/default.aspx</link><description>Tags: .NET</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>VS.NET Add-in Contest Third Place Winner's Entry?</title><link>http://weblogs.asp.net/dmarsh/archive/2004/08/13/214263.aspx</link><pubDate>Fri, 13 Aug 2004 17:58:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:214263</guid><dc:creator>drub0y</dc:creator><author>drub0y</author><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/dmarsh/rsscomments.aspx?PostID=214263</wfw:commentRss><comments>http://weblogs.asp.net/dmarsh/archive/2004/08/13/214263.aspx#comments</comments><description>&lt;p&gt;Are you serious with the &lt;A href="http://weblogs.asp.net/rosherove/archive/2004/08/13/214210.aspx"&gt;third place winner being "GoogleFind"&lt;/a&gt;? &lt;/p&gt; &lt;p&gt;I'm probably gonna come off looking like an ass for even bringing it up, but so be it.&amp;nbsp;I posted a macro that did at the beginning of 2003. &lt;a href="http://radio.weblogs.com/0104813/stories/2002/06/19/vsnetGoogleMacro.html"&gt;Here's the original post on my old Radio weblog&lt;/a&gt; dated 1/17/2003 and &lt;A href="http://weblogs.asp.net/dmarsh/articles/3516.aspx"&gt;here's the post when I moved it to weblogs.asp.net&lt;/a&gt; and even that's dated 3/6/2003. Not only that, but the winner went way out of the way and forces you to copy&amp;nbsp;an interop dll to your VS.NET installation when he could have just done what I did and called the environment's built in DTE.ItemOperations.Navigate method. No interop, no dll's to copy.&lt;/p&gt; &lt;p&gt;I'm not looking to win the contest or anything, but it seems unoriginal and unfair to the other entries. I mean, do just go &lt;a href="http://www.google.com/search?q=google+macro"&gt;search Google itself for "Google Macro"&lt;/a&gt;&amp;nbsp;and see what comes up number one.&amp;nbsp;The fact that anyone entering the contest would write something without making sure someone else didn't write it first is kinda sketchy.&amp;nbsp;Not to mention the implementation shows a lack of knowledge of the VS.NET environment, so it's not exactly a poster child for what the entire contest stands for. There has to be more worthy entries in the running.&lt;/p&gt; &lt;p&gt;Finally, I'd like to&amp;nbsp;extend a "sorry, nothin' personal" to &lt;a href="http://www.little-garins.com/blogs/marty"&gt;Martin&lt;/a&gt;&amp;nbsp;up front since I don't even know the guy and I know he didn't do a straight rip of my code, so it's not &lt;em&gt;that&lt;/em&gt; bad.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=214263" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/dmarsh/archive/tags/.NET/default.aspx">.NET</category></item><item><title>The Future of Scripting?</title><link>http://weblogs.asp.net/dmarsh/archive/2003/12/30/46649.aspx</link><pubDate>Tue, 30 Dec 2003 16:50:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:46649</guid><dc:creator>drub0y</dc:creator><author>drub0y</author><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/dmarsh/rsscomments.aspx?PostID=46649</wfw:commentRss><comments>http://weblogs.asp.net/dmarsh/archive/2003/12/30/46649.aspx#comments</comments><description>&lt;P&gt;Everyone's blogging about &lt;A href="http://www.dannyboyd.com/archives/2003_12_28_index.asp#107275109953625219"&gt;Daniel Boyd's open letter to Microsoft regarding the future of scripting technologies&lt;/A&gt; on the Windows platform. Personally, I think that the new Microsoft Shell (MSH) will be the answer to these people's prayers. &lt;/P&gt;
&lt;P&gt;Here's a couple of &lt;A href="http://www.developer.com/net/net/article.php/3286851"&gt;nice&lt;/A&gt; &lt;A href="http://www.developer.com/net/net/article.php/3293141"&gt;articles&lt;/A&gt; by &lt;A href="http://weblogs.asp.net/jnadal/"&gt;Jason Nadal&lt;/A&gt; with some specific details and examples. Also, if you're running Longhorn, you can join the MSH beta by going to &lt;A href="http://www.beta.microsoft.com"&gt;BetaPlace&lt;/A&gt;, entering a Guest ID of "mshPDC" and filling out the survey there.&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=46649" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/dmarsh/archive/tags/.NET/default.aspx">.NET</category></item><item><title>True Streaming Reads from ASP.NET</title><link>http://weblogs.asp.net/dmarsh/archive/2003/12/19/44774.aspx</link><pubDate>Fri, 19 Dec 2003 23:44:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:44774</guid><dc:creator>drub0y</dc:creator><author>drub0y</author><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/dmarsh/rsscomments.aspx?PostID=44774</wfw:commentRss><comments>http://weblogs.asp.net/dmarsh/archive/2003/12/19/44774.aspx#comments</comments><description>&lt;P&gt;&lt;A href="http://www.pocketsoap.com/weblog/2003/12/1392.html"&gt;Simon Fell&lt;SUP&gt;1&lt;/SUP&gt;&amp;nbsp;is venting&lt;/A&gt; about the lack of true&amp;nbsp;streaming reads in ASP.NET. I agree, it really sucks that everything gets buffered.&lt;/P&gt;
&lt;P&gt;I'm not quite clear why this is the way it is. After all, if you look at what is basically the lowest layer of the CLR based ASP.NET runtime, &lt;A href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwebhttpworkerrequestclasstopic.asp?frame=true"&gt;HttpWorkerRequest&lt;/A&gt;, you can see it has a &lt;A href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebHttpWorkerRequestClassReadEntityBodyTopic.asp?frame=true"&gt;ReadEntityBody&lt;/A&gt; method which would appear to enable a streaming read scenario. Underneath the covers, I would imagine&amp;nbsp;Microsoft's concrete implementation could&amp;nbsp;reach back into their native ISAPI extension&amp;nbsp;and leverage IIS' ISAPI server support functions &lt;A href="http://msdn.microsoft.com/library/en-us/iissdk/iis/extensions_ssf_hse_req_io_completion.asp"&gt;HSE_REQ_IO_COMPLETION&lt;/A&gt; and &lt;A href="http://msdn.microsoft.com/library/en-us/iissdk/iis/extensions_ssf_hse_req_async_read_client.asp"&gt;HSE_REQ_ASYNC_READ_CLIENT&lt;/A&gt; to get the job of an asycnhronus streaming read done.&lt;/P&gt;
&lt;P&gt;Hopefully someone from the ASP.NET team can comment on this. The public, well at least two of us anyway,&amp;nbsp;is dying to get streaming reads within the ASP.NET environment. For now, ISAPI is the only way to go.&lt;/P&gt;
&lt;P style="FONT-SIZE: 0.75em"&gt;&lt;STRONG&gt;&lt;SUP&gt;1&lt;/SUP&gt;&lt;/STRONG&gt;&amp;nbsp;Correction, I originally said &lt;A href="http://www.intertwingly.net/blog/"&gt;Sam Ruby&lt;/A&gt;, but I meant &lt;A href="http://www.pocketsoap.com/weblog/"&gt;Simon Fell&lt;/A&gt;. For some reason, I have no clue why, I always confuse those two names. Sorry Simon and Sam. ;)&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=44774" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/dmarsh/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Question For the VSIP Gurus Out There</title><link>http://weblogs.asp.net/dmarsh/archive/2003/12/12/43264.aspx</link><pubDate>Fri, 12 Dec 2003 23:45:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:43264</guid><dc:creator>drub0y</dc:creator><author>drub0y</author><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/dmarsh/rsscomments.aspx?PostID=43264</wfw:commentRss><comments>http://weblogs.asp.net/dmarsh/archive/2003/12/12/43264.aspx#comments</comments><description>&lt;P&gt;&lt;STRONG&gt;Scenario&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Ok, I'm writing an add-in which extends solutions with custom properties. This add-in is written in C#. I've created the extender provider, I'm registering it for the solution object, the properties show up as expected under the properties window in the IDE and all is well. &lt;EM&gt;However&lt;/EM&gt;, for one of these properties I want to provide a custom editor. I've applied the EditorAttribute to my property, but it just seems like the IDE doesn't respect it. Strange thing is, I've applied DescriptionAttribute, TypeConverterAttribute, etc. on all properties and the IDE respects those, so it seems to be&amp;nbsp;a special case related to EditorAttribute.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;So The Question Is&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;What's the trick to get a custom editor to be used for an extended property such that the properties window shows the ellipses (...) box and my custom editor gets displayed when it's clicked?&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=43264" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/dmarsh/archive/tags/.NET/default.aspx">.NET</category></item><item><title>ASP.NET PartialCaching Problem: A Hacked Solution</title><link>http://weblogs.asp.net/dmarsh/archive/2003/11/26/39957.aspx</link><pubDate>Wed, 26 Nov 2003 20:52:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:39957</guid><dc:creator>drub0y</dc:creator><author>drub0y</author><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/dmarsh/rsscomments.aspx?PostID=39957</wfw:commentRss><comments>http://weblogs.asp.net/dmarsh/archive/2003/11/26/39957.aspx#comments</comments><description>&lt;P&gt;Ok, I needed to prove to myself that my theory of being able to just use the built in &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuipartialcachingcontrolclasstopic.asp?frame=true"&gt;PartialCachingControl&lt;/A&gt; would work if it's constructor&amp;nbsp;were just public. So, I resorted to a little hackery and fell back on our friend &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemReflection.asp"&gt;System.Reflection&lt;/A&gt; to instantiate an instance of the class. Here's what I ended up with:&lt;/P&gt;
&lt;BLOCKQUOTE style="TEXT-ALIGN: left"&gt;&lt;CODE&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;// 23.5-hour cache lifetime, shared across all pages&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;PartialCachingAttribute cacheAttribute = &lt;/FONT&gt;&lt;B&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/B&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; PartialCachingAttribute(84600, &lt;/FONT&gt;&lt;B&gt;&lt;FONT color=#0000ff size=2&gt;null&lt;/B&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;B&gt;&lt;FONT color=#0000ff size=2&gt;null&lt;/B&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;B&gt;&lt;FONT color=#0000ff size=2&gt;null&lt;/B&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;B&gt;&lt;FONT color=#0000ff size=2&gt;true&lt;/B&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;);&lt;/P&gt;
&lt;P&gt;PartialCachingControl cacher = (PartialCachingControl)Activator.CreateInstance(&lt;/FONT&gt;&lt;B&gt;&lt;FONT color=#0000ff size=2&gt;typeof&lt;/B&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;(PartialCachingControl), BindingFlags.NonPublic|BindingFlags.Public&lt;BR&gt;|BindingFlags.ExactBinding|BindingFlags.Instance, &lt;/FONT&gt;&lt;B&gt;&lt;FONT color=#0000ff size=2&gt;null&lt;/B&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;B&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/B&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;B&gt;&lt;FONT color=#0000ff size=2&gt;object&lt;/B&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;[] { &lt;/FONT&gt;&lt;B&gt;&lt;FONT color=#0000ff size=2&gt;typeof&lt;/B&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;(StandardFooterCachedInnerControl), cacheAttribute, &lt;/FONT&gt;&lt;B&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/B&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.ID }, CultureInfo.InvariantCulture);&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/B&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;.Controls.Add(cacher);&lt;/FONT&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So, this logic is in the constructor of my &amp;#8220;outer&amp;#8221; control which is responsible for always being in the code tree and overrides &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuicontrolclassonprerendertopic.asp"&gt;Control::OnPreRender&lt;/A&gt; to emit the stylesheet link in the &amp;lt;head&amp;gt; of the page it is contained on. Then, as the code demonstrates, in that &amp;#8220;outer&amp;#8221; controls constructor&amp;nbsp;I construct an instance of the PartialCachingControl using the &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuipartialcachingattributeclasstopic.asp"&gt;PartialCachingAttribute&lt;/A&gt; data to specify the cache rules it should follow (in my case, I just need to cache the data for 23.5 hours and want it shared across all web pages) and specify the&amp;nbsp;type of&amp;nbsp;my inner control (i.e. StandardFooterCachedInnerControl) that actually does the rendering when the data is not cached.&lt;/P&gt;
&lt;P&gt;As expected, this works flawlessly. This is a good enough solution for me since I always control the servers on which my control will be installed. However, it &lt;STRONG&gt;is not &lt;EM&gt;guaranteed&lt;/EM&gt;&lt;/STRONG&gt; to work for anyone writing third party server controls, since they might be installed with lesser code access preventing them from being able to use reflection. I can only hope that the ASP.NET team will respond to my &lt;A href="http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&amp;amp;PostID=404291"&gt;bug report&lt;/A&gt; and properly expose these currently hidden little features in Whidbey for those of us who are writing more complex controls.&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=39957" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/dmarsh/archive/tags/.NET/default.aspx">.NET</category></item><item><title>ASP.NET PartialCaching Problem Part 2</title><link>http://weblogs.asp.net/dmarsh/archive/2003/11/26/39895.aspx</link><pubDate>Wed, 26 Nov 2003 16:07:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:39895</guid><dc:creator>drub0y</dc:creator><author>drub0y</author><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/dmarsh/rsscomments.aspx?PostID=39895</wfw:commentRss><comments>http://weblogs.asp.net/dmarsh/archive/2003/11/26/39895.aspx#comments</comments><description>&lt;DIV class=comment_author&gt;&lt;A id=_ctl0_pageBody-1_CommentList__ctl3_NameLink href="http://staff.develop.com/igriffiths/" target=_blank&gt;Ian Griffiths&lt;/A&gt;&amp;nbsp;wrote the following in the comments&amp;nbsp;section of&amp;nbsp;&lt;A href="posts/39793.aspx"&gt;this previous post&lt;/A&gt;:&lt;/DIV&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;DIV class=comment_content&gt;Can't you make the cached control the child of an uncached control? The uncached control wouldn't contribute anything to the output - it just wraps the cached control. That way you can put your behaviour in the uncached control, but still get caching for its child.&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;
&lt;DIV class=comment_content dir=ltr&gt;That would totally make sense, except that the only way to get a partially cached control into the control tree is to either:&lt;/DIV&gt;
&lt;OL dir=ltr type=a&gt;
&lt;LI&gt;Statically declare it in the ASPX. In this case when the ASPX is parsed, the parser substitues a &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuistaticpartialcachingcontrolclasstopic.asp?frame=true"&gt;StaticPartialCachingControl&lt;/A&gt; instance in place of your control and then places your custom server control in that as a child. This method won't work unless I want to force my users to declare two controls statically in their ASPX which makes no sense since this is logically one control.&lt;BR&gt;
&lt;LI&gt;Load it using &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUITemplateControlClassLoadControlTopic.asp?frame=true"&gt;TemplateControl::LoadControl&lt;/A&gt;. In this case when the ASCX is parsed and loaded, the LoadControl method places the resulting custom control as the child of&amp;nbsp;a &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuipartialcachingcontrolclasstopic.asp?frame=true"&gt;PartialCachingControl&lt;/A&gt; instance. Obviously since I'm not an ASCX this method cannot be applied. However, as your scenario suggests, I should be able to leverage the PartialCachingControl class and add to my &amp;#8220;outer&amp;#8221; server control's control tree&amp;nbsp;internally and then add&amp;nbsp;my actual&amp;nbsp;cached &amp;#8220;inner&amp;#8221; control to it as a child. Problem is, PartialCachingControl's only constructor&amp;nbsp;is protected by assembly level access. :(&lt;/LI&gt;&lt;/OL&gt;
&lt;P dir=ltr&gt;Next, I thought I could create my own custom class that inherits from &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuibasepartialcachingcontrolclasstopic.asp"&gt;BasePartialCachingControl&lt;/A&gt; and exposes the features that I need. Then I basically follow all the steps outlined in option 'b' using my custom partial caching control in place of PartialCachingControl and it should work. Problem solved, right? Ummm.... no. While BasePartialCachingControl is public, the method you need to override to return the server control that's wrapped when it needs to be rendered (BasePartialCachingControl::CreateCachedControl) is once again protected by assembly only level access! Bad, &lt;EM&gt;bad&lt;/EM&gt; class design. I slap the ASP.NET developers on the wrist for this. There's no reason that the BasePartialCachingControl class should be public at all if one of its abstract members is marked with assembly level protection. That said, there's really no reason for that member to be marked assembly only... well...&amp;nbsp;except to screw someone like me up.&lt;/P&gt;
&lt;P dir=ltr&gt;So, what's left? The only thing I can think to do is manage all the cache work myself. I can create a re-usable&amp;nbsp;control which follows the same wrapping pattern as the partial caching architecture does. You add controls to that re-usable control, then in the &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuicontrolclassrendertopic.asp"&gt;Control::Render &lt;/A&gt;override I setup my own &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuihtmltextwriterclasstopic.asp"&gt;HtmlTextWriter&lt;/A&gt; over my own &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemiostringwriterclasstopic.asp"&gt;StringWriter&lt;/A&gt; then I&amp;nbsp;pass that to a call to&amp;nbsp;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIControlClassRenderChildrenTopic.asp?frame=true"&gt;Control::RenderChildren&lt;/A&gt;. When RenderChildren completes I take what it wrote through the HtmlTextWriter and stuff it into the standard caching architecture myself.&lt;/P&gt;
&lt;P dir=ltr&gt;In closing, I'd just like to say that I really hate it when an API gets something &lt;EM&gt;just about&lt;/EM&gt; right and forces me to re-implement all the work that they've already done, but didn't expose correctly. FYI, this hasn't been fixed in Whidbey. So, &lt;A href="http://weblogs.asp.net/scottgu/"&gt;Scott&lt;/A&gt;, if you're listening, please just change the access level of PartialCachingControl's constructor and BasePartialCachingControl's CreateCachedControl method to public.&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=39895" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/dmarsh/archive/tags/.NET/default.aspx">.NET</category></item><item><title>ASP.NET PartialCachingAttribute Problem</title><link>http://weblogs.asp.net/dmarsh/archive/2003/11/25/39793.aspx</link><pubDate>Wed, 26 Nov 2003 00:40:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:39793</guid><dc:creator>drub0y</dc:creator><author>drub0y</author><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/dmarsh/rsscomments.aspx?PostID=39793</wfw:commentRss><comments>http://weblogs.asp.net/dmarsh/archive/2003/11/25/39793.aspx#comments</comments><description>&lt;P&gt;&lt;STRONG&gt;Preface:&lt;/STRONG&gt; I've seen this discussed before, but haven't really found a solution through all my searching, so I'm hoping I'm just missing something.&lt;/P&gt;
&lt;P&gt;As you may or may not know, if you're creating a server control you can enable that control to be automagically cached by the ASP.NET output caching services by applying a &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuipartialcachingattributeclasstopic.asp"&gt;PartialCachingAttribute&lt;/A&gt; to it. Once the control is rendered it's output is cached according to the number of seconds specified by the attribute. The control will never be instantiated or called in the rendering tree again until the cache expires. Cool right? Well, it is, but the magic happening here is unfortunately not very flexible. &lt;/P&gt;
&lt;P&gt;When a server control is added to the page's control tree, it is checked for the PartialCachingAttribute. If the attribute is present, the control is wrapped with a &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIPartialCachingControlClassTopic.asp?frame=true"&gt;PartialCachingControl&lt;/A&gt; instance. This PartialCachingControl class acts as a proxy for the actual server control in the page's control tree.&amp;nbsp;In the&amp;nbsp;OnRender implementation of PartialCachingControl is where all the magic happens (actually there's a &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIBasePartialCachingControlClassTopic.asp?frame=true"&gt;BasePartialCachingControl&lt;/A&gt; class under there, but for simplicity we'll ignore that). The magic is the logic I discussed in the previous paragraph: &lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;First, the cache is checked. If the cached output is [still] available (i.e. it hasn't expired) then it is just blasted out to the Response stream and that's that. If the cached output is not available, an instance of the actual server control is created. Next, there's a &lt;EM&gt;really&lt;/EM&gt; nasty internal only&amp;nbsp;hack done to switch the TextWriter for the current HttpResponse object so that it's an in-memory StringWriter instead (check out HttpResponse::SwitchWriter with ILDasm). This is done so that the PartialCachingControl can take the buffer and cache it using the caching architecture before it's blasted out to the HttpResponse's stream. Once this bit of trickery is completed, the original TextWriter is replaced on the HttpResponse and normal processing continues.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;Ok, so with that dissection/explanation out of the way, the real problem is this. What if my cached server control needs to perform non-render time logic? In my specific case, I always need to emit a &lt;LINK&gt;to a stylesheet. Well, it looks like I'm SOL and can no longer use the partial caching architecture anymore. &lt;/P&gt;
&lt;P dir=ltr&gt;Has anyone solved this problem elegantly? My only option now seems to be to stop using the partial caching feature and basically do all the cache work manually within my server control's Render override. :\&amp;nbsp;I'd need to sniff the &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuihtmltextwriterclasstopic.asp"&gt;HtmlTextWriter&lt;/A&gt; type being used for the scope of the request, instantiate my own version of it with all the proper settings over my own StreamWriter, use that to write all my content, then get the text from the underlying StreamWriter, manually stuff it in the cache&amp;nbsp;and then manually blast it out to the actual&amp;nbsp;response stream.&lt;/P&gt;
&lt;P dir=ltr&gt;I can't understand why PartialCachingControl doesn't at least instantiate your server control and, at the bare minimum, pass on the OnInit phase of control activation. :(&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=39793" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/dmarsh/archive/tags/.NET/default.aspx">.NET</category></item><item><title>WinFS != ObjectSpaces</title><link>http://weblogs.asp.net/dmarsh/archive/2003/11/23/39343.aspx</link><pubDate>Sun, 23 Nov 2003 17:56:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:39343</guid><dc:creator>drub0y</dc:creator><author>drub0y</author><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/dmarsh/rsscomments.aspx?PostID=39343</wfw:commentRss><comments>http://weblogs.asp.net/dmarsh/archive/2003/11/23/39343.aspx#comments</comments><description>&lt;BLOCKQUOTE&gt;&lt;I&gt;
&lt;P&gt;In Luca Bolognese's &lt;A href="http://microsoft.sitestream.com/PDC2003/DAT/DAT410_files/Botto_files/DAT410_Bolognese.ppt"&gt;PDC presentation &lt;/A&gt;on ObjectSpaces, he stated in a diagram that you should use ADO.NET's objects DataSets/DataReaders if &lt;EM&gt;"You require maximum control/performance/functionality" &lt;/EM&gt;That seems to indicate that we should not use ObjectSpaces if performance, funcationality and control are a requirement.&amp;nbsp; If this is the case, it would seem that using ObjectSpaces in WinFS is very contrary.&amp;nbsp; WinFS has to be quick...not just fast...lightning fast.&amp;nbsp; We are talking about impatient users.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;I think it is important that we get Mike Deem to respond to this in his Blog.&amp;nbsp; I am going to forward this to him and post it up on the newsgroups, but maybe I am missing something.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;A title="Why is WinFS Using ObjectSpaces?" href="http://adoguy.com/content.aspx?id=rantview&amp;amp;rantid=56"&gt;[Shawn Wildermuth]&lt;/A&gt;&lt;/P&gt;&lt;/I&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It's easy to see why Shawn's concerned about this. WinFS looks so much like ObjectSpaces it's scary. However, what I think is important to realize is that the ObjectSpaces API is designed to be abstract and work over any possible datastore that might be backing your object data. The WinFS API on the other hand is designed and implemented to work with a very, &lt;I&gt;very&lt;/I&gt; specific datastore. Truthfully we have no idea what the implementation of that datastore is, but we've been told emphatically by Microsoft reps that &lt;B&gt;it is not just SQL server&lt;/B&gt;. With that in mind, there probably isn't much in the way of mapping/data translation as opposed to ObjectSpaces which does everything using XmlSerialization to&amp;nbsp;get the data out of the object instance and ultimately into&amp;nbsp;a DataSet which can then be persisted to the backing datastore.&lt;/P&gt;
&lt;P&gt;As for the performance comments, remember ObjectSpaces&amp;nbsp;is intended to be used in enterprise applications where you may be fielding 100[0]s of requests per second. With that in mind there's no doubt that using DataSets/DataReaders would be more performant since you would factor out all that mapping/translation logic. WinFS, in this first incarnation anyway, is being designed as a client technology. There is no &amp;#8220;server story&amp;#8221; for WinFS yet according to Microsoft reps. Considering the facts though, WinFS should theoretically outperform ObjectSpaces hands down by RTM.&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=39343" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/dmarsh/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/dmarsh/archive/tags/Longhorn/default.aspx">Longhorn</category></item><item><title>My PDC Calendar</title><link>http://weblogs.asp.net/dmarsh/archive/2003/10/24/33405.aspx</link><pubDate>Sat, 25 Oct 2003 01:25:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:33405</guid><dc:creator>drub0y</dc:creator><author>drub0y</author><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/dmarsh/rsscomments.aspx?PostID=33405</wfw:commentRss><comments>http://weblogs.asp.net/dmarsh/archive/2003/10/24/33405.aspx#comments</comments><description>In case anyone's interested. Here's what &lt;A href="http://home.nyc.rr.com/dmarsh/myPdcCalendar.htm"&gt;my PDC Calendar&lt;/A&gt; is looking like so far. Of course I might change things on the fly depending on how I'm feeling about certain subjects, but probably not too drastically. You'll notice it consists mostly of Indigo sessions with sprinklings of Avalon and Longhorn.&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=33405" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/dmarsh/archive/tags/.NET/default.aspx">.NET</category></item><item><title>PDC Bound</title><link>http://weblogs.asp.net/dmarsh/archive/2003/10/24/33315.aspx</link><pubDate>Fri, 24 Oct 2003 17:18:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:33315</guid><dc:creator>drub0y</dc:creator><author>drub0y</author><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/dmarsh/rsscomments.aspx?PostID=33315</wfw:commentRss><comments>http://weblogs.asp.net/dmarsh/archive/2003/10/24/33315.aspx#comments</comments><description>&lt;P&gt;Welp, I depart Newark airport tommorrow&amp;nbsp;at 3PM to head for LA. I'm really excited that I'm going to be there to experience the first major step in the revolution of Windows programming since Win32. &lt;/P&gt;
&lt;P&gt;I'm really looking forward to finally being able to talk about Whidbey in public. The few things &lt;A href="http://weblogs.asp.net/scottgu/posts/32965.aspx"&gt;Scott has leaked about ASP.NET&lt;/A&gt; are&amp;nbsp;but a taste of what you can expect to see once you get Whidbey up and running. I'm also looking forward to finally getting my hands on Longhorn, Avalon and Indigo. So little is actually known at this point about them, but all will be revealed starting Sunday. Being able to actually sit down and experience the technologies first hand is the best way to learn and understand them. So&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Saturday night is going to be like xmas eve for PDC attendees. I don't know if I'll even be able to fall asleep. ;)&lt;/P&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=33315" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/dmarsh/archive/tags/.NET/default.aspx">.NET</category></item></channel></rss>