<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Csharp on Random Ramblings</title><link>https://blog.foundev.pro/tags/csharp.html</link><description>Recent content in Csharp on Random Ramblings</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 03 Jun 2009 06:02:00 +0000</lastBuildDate><atom:link href="https://blog.foundev.pro/tags/csharp/index.xml" rel="self" type="application/rss+xml"/><item><title>Castle ActiveRecord and registering classes at runtime</title><link>https://blog.foundev.pro/2009/06/03/castle-activerecord-and-registering-classes-at-runtime.html</link><pubDate>Wed, 03 Jun 2009 06:02:00 +0000</pubDate><guid>https://blog.foundev.pro/2009/06/03/castle-activerecord-and-registering-classes-at-runtime.html</guid><description>&lt;h1&gt;Castle ActiveRecord and registering classes at runtime&lt;/h1&gt;&#10;*EDIT: this is an old post copied over from my [old blog on Los Techies](https://lostechies.com/ryansvihla/2009/06/03/castle-activerecord-and-registering-classes-at-runtime/), I have kept it here for archival reasons.*&#10;&lt;p&gt;I use the following trick for adding ActiveRecord classes after the fact for our in-house plug-in architecture. Thanks to whichever blogger/mailing list I picked this up from so long ago.&lt;/p&gt;&#10;&lt;h2 id="scenario-1-classes-to-load-inherit-from-same-base-class-as-current-running-activerecord-classes"&gt;Scenario 1: Class(es) to load inherit from same base class as current running ActiveRecord classes&lt;/h2&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f7f7f7;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#cf222e"&gt;var&lt;/span&gt; holder &lt;span style="color:#1f2328"&gt;=&lt;/span&gt; ActiveRecordMediator&lt;span style="color:#1f2328"&gt;.&lt;/span&gt;GetSessionFactoryHolder&lt;span style="color:#1f2328"&gt;();&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#57606a"&gt;//register your subclasses here&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ActiveRecordStarter&lt;span style="color:#1f2328"&gt;.&lt;/span&gt;RegisterTypes&lt;span style="color:#1f2328"&gt;(&lt;/span&gt;&lt;span style="color:#cf222e"&gt;typeof&lt;/span&gt;&lt;span style="color:#1f2328"&gt;(&lt;/span&gt;Employee&lt;span style="color:#1f2328"&gt;),&lt;/span&gt; &lt;span style="color:#cf222e"&gt;typeof&lt;/span&gt;&lt;span style="color:#1f2328"&gt;(&lt;/span&gt;Customer&lt;span style="color:#1f2328"&gt;));&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;holder&lt;span style="color:#1f2328"&gt;.&lt;/span&gt;RegisterSessionFactory&lt;span style="color:#1f2328"&gt;(&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; holder&lt;span style="color:#1f2328"&gt;.&lt;/span&gt;GetConfiguration&lt;span style="color:#1f2328"&gt;(&lt;/span&gt;&lt;span style="color:#cf222e"&gt;typeof&lt;/span&gt;&lt;span style="color:#1f2328"&gt;(&lt;/span&gt;ActiveRecordBase&lt;span style="color:#1f2328"&gt;)).&lt;/span&gt;BuildSessionFactory&lt;span style="color:#1f2328"&gt;(),&lt;/span&gt; &lt;span style="color:#cf222e"&gt;typeof&lt;/span&gt;&lt;span style="color:#1f2328"&gt;(&lt;/span&gt;ActiveRecordBase&lt;span style="color:#1f2328"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#1f2328"&gt;);&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#57606a"&gt;//reloads session factory without this types will not be registered. &lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#57606a"&gt;//I believe this is actually a &amp;#34;feature&amp;#34; in Castle trunk. may be fixed now.&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is all you need to register extra classes that are accessing the same database as the application is using.&lt;/p&gt;</description></item><item><title>IronPython how cool it is</title><link>https://blog.foundev.pro/2009/05/28/ironpython-how-cool-it-is.html</link><pubDate>Thu, 28 May 2009 05:08:00 +0000</pubDate><guid>https://blog.foundev.pro/2009/05/28/ironpython-how-cool-it-is.html</guid><description>&lt;h1&gt;IronPython how cool it is&lt;/h1&gt;&#10;*EDIT: this is an old post copied over from my [old blog on Los Techies](https://lostechies.com/ryansvihla/2009/05/28/ironpython-how-cool-it-is/), I have kept it here for archival reasons.*&#10;&lt;p&gt;Briefly, &lt;a href="http://www.codeplex.com/IronPython"&gt;IronPython&lt;/a&gt; is an implementation of Python in the .Net runtime. This allows you access to .Net framework goodness while programming in a dynamic language. The current stable version 2.0.1 maps to CPython 2.5.This allows me to do fun fun things like use my python project to access a c# project. follows is a python script using Pinsor and accessing a .net dll.&lt;/p&gt;</description></item><item><title>Context and Spec style testing and my approach to BDD</title><link>https://blog.foundev.pro/2009/05/22/context-spec-style-testing-and-my-approach-to-bdd.html</link><pubDate>Fri, 22 May 2009 00:21:00 +0000</pubDate><guid>https://blog.foundev.pro/2009/05/22/context-spec-style-testing-and-my-approach-to-bdd.html</guid><description>&lt;h1&gt;Context and Spec style testing and my approach to BDD&lt;/h1&gt;&#10;*EDIT: this is an old post copied over from my [old blog on Los Techies](https://lostechies.com/ryansvihla/2009/05/22/context-spec-style-testing-and-my-approach-to-bdd/), I have kept it here for archival reasons.*&#10;&lt;p&gt;I borrow heavily my approach to testing from a combination of Ayende&amp;rsquo;s &lt;a href="http://rhino-tools.svn.sourceforge.net/viewvc/rhino-tools/trunk/"&gt;Rhino Tools&lt;/a&gt; tests, and my reading of the &lt;a href="http://www.pragprog.com/titles/achbd/the-rspec-book"&gt;Rspec&lt;/a&gt; beta book. But I think I&amp;rsquo;ve stumbled onto something I&amp;rsquo;m happy with and I can generate reports out of. Let&amp;rsquo;s go over some basic rules first:&lt;/p&gt;</description></item></channel></rss>