<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>The Hostile Blogger</title>
        <link>http://blogs.hibernatingrhinos.com/Craig/Default.aspx</link>
        <description>Craig Neuwirt</description>
        <language>en-US</language>
        <copyright>Craig</copyright>
        <managingEditor>cneuwirt@gmail.com</managingEditor>
        <generator>Subtext Version 1.9.5.177</generator>
        <image>
            <title>The Hostile Blogger</title>
            <url>http://blogs.hibernatingrhinos.com/images/RSS2Image.gif</url>
            <link>http://blogs.hibernatingrhinos.com/Craig/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>Multi-Table Entity Support for ActiveRecord</title>
            <link>http://blogs.hibernatingrhinos.com/Craig/archive/2008/06/29/multi-table-entity-support-for-activerecord.aspx</link>
            <description>&lt;p&gt;NHibernate supports the ability to map a single entity to multiple tables. Now I know this is not encouraged, but it is sometimes necessary. I just started a project in which the existing code base uses the ASP.NET Membership Provider. The existing software uses ActiveRecord and wanted to represent the concept of a user with several fields for the membership database. The user in the membership database is spread over several tables so the ActveRecord model used had lots of formulas which really smelled.&lt;/p&gt;
&lt;p&gt;To understand what NHibernate can do, &lt;a href="http://www.ayende.com/Blog/archive/2007/04/24/Multi-Table-Entities-in-NHibernate.aspx"&gt;Ayende&lt;/a&gt; has a really nice post on this subject.&lt;/p&gt;
&lt;p&gt;To avoid the formula clutter, I added ActiveRecord support for this. T&lt;/p&gt;
&lt;p&gt;Here's an example of how to mark an ActiveRecord class to join multiple tables&lt;/p&gt;
&lt;pre&gt;[ActiveRecord("People")&lt;br /&gt;JoinedTable("Addresses", Column = "person_id")]&lt;br /&gt;public class Person : ActiveRecordBase&lt;br /&gt;&lt;/pre&gt;
&lt;span style="font-family: Helvetica; white-space: normal;"&gt;A new attribute, JoinedTable has been introduced that identifies the additional table to be joined an the column used to join the,  Multiple of these attributes can be present.&lt;/span&gt;
&lt;span style="font-family: Helvetica; white-space: normal;"&gt;Here's how you would identify properties, field's, any's or components that come from the alternate table&lt;/span&gt;
&lt;pre&gt;[Nested("name_", Table = "Addresses")]&lt;br /&gt;public FullName FullName&lt;br /&gt;{&lt;br /&gt;   get { return _fullName; }&lt;br /&gt;   set { _fullName = value; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;[Property(Table = "Addresses")]&lt;br /&gt;public string Address&lt;br /&gt;{&lt;br /&gt;   get { return _address; }&lt;br /&gt;   set { _address = value; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;[Field(Table = "Addresses")]&lt;br /&gt;public string City;&lt;br /&gt;&lt;/pre&gt;
&lt;span style="font-family: Helvetica; white-space: normal;"&gt;&lt;span style="font-family: Helvetica; white-space: normal;"&gt;As you can see, the [Property], [Field], [Nested], and [Any] attributes now accept a Table property which links to a Table in a [JoinedTable] attribute&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style="font-family: Helvetica; white-space: normal;"&gt;Cheers.&lt;/span&gt; &lt;span style="font-family: Helvetica; white-space: normal;"&gt;Craig&lt;/span&gt;
&lt;div class="posttagsblock"&gt;&lt;a rel="tag" href="http://technorati.com/tag/Untitled"&gt;Untitled&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.hibernatingrhinos.com/Craig/aggbug/24.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Craig</dc:creator>
            <guid>http://blogs.hibernatingrhinos.com/Craig/archive/2008/06/29/multi-table-entity-support-for-activerecord.aspx</guid>
            <pubDate>Sun, 29 Jun 2008 07:17:28 GMT</pubDate>
            <wfw:comment>http://blogs.hibernatingrhinos.com/Craig/comments/24.aspx</wfw:comment>
            <comments>http://blogs.hibernatingrhinos.com/Craig/archive/2008/06/29/multi-table-entity-support-for-activerecord.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.hibernatingrhinos.com/Craig/comments/commentRss/24.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.hibernatingrhinos.com/Craig/services/trackbacks/24.aspx</trackback:ping>
        </item>
        <item>
            <title>Welcome</title>
            <link>http://blogs.hibernatingrhinos.com/Craig/archive/2008/03/28/welcome.aspx</link>
            <description>&lt;p&gt;My name is Craig Neuwirt and I am principal consultant and partner of &lt;a href="http://www.improvingenterprises.com/"&gt;Improving Enterprises&lt;/a&gt;. I am the proud father of 2 girls and a boy ages 5, 3 and 8 months. My limited or nonexistent blogging is directly related to that. However, my friend &lt;a href="http://www.ayende.com/Blog/"&gt;Ayende&lt;/a&gt; award me, and I quote, "the first hostile blogging award". Ayende was also nice enough to provide me a blog so the least I can do is try and use it. Despite my limited free time, I am an active contributor to &lt;a href="http://www.castleproject.org/"&gt;Castle&lt;/a&gt; and &lt;a href="http://www.ayende.com/default.aspx"&gt;RhinoTools&lt;/a&gt; open source projects. I have had several comments that mailing groups are not the best medium to share my information so I will try and utilize this blog to do that. They will not be plentiful nor beautiful, but if I have something to say, i'll see it here.&lt;/p&gt;

&lt;div class="posttagsblock"&gt;&lt;a href="http://technorati.com/tag/Hello" rel="tag"&gt;Hello&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.hibernatingrhinos.com/Craig/aggbug/1.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Craig</dc:creator>
            <guid>http://blogs.hibernatingrhinos.com/Craig/archive/2008/03/28/welcome.aspx</guid>
            <pubDate>Fri, 28 Mar 2008 11:15:33 GMT</pubDate>
            <wfw:comment>http://blogs.hibernatingrhinos.com/Craig/comments/1.aspx</wfw:comment>
            <comments>http://blogs.hibernatingrhinos.com/Craig/archive/2008/03/28/welcome.aspx#feedback</comments>
            <slash:comments>10</slash:comments>
            <wfw:commentRss>http://blogs.hibernatingrhinos.com/Craig/comments/commentRss/1.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.hibernatingrhinos.com/Craig/services/trackbacks/1.aspx</trackback:ping>
        </item>
    </channel>
</rss>