Geeks With Blogs

News

MySpace


A Curious Mind #tastic

Please note that this is pre-AutoMap which I haven't dived into yet, but I thought it would be nice to share none-the-less.

    public class LeadMap :
        ClassMap
    {
        public LeadMap()
        {
            Id(o => o.Id);
            Map(o => o.CreatedOn);
            Component(o => o.Company,
                                        x =>
                                        {
                                            x.Map(m => m.Name);
                                            x.Map(m => m.Address);
                                            x.Map(m => m.Website);
                                            x.Map(m => m.Telephone);
                                        });
            Component(o => o.Contact,
                                        x =>
                                        {
                                            x.Map(m => m.Name);
                                            x.Map(m => m.Telephone);
                                            x.Map(m => m.Email);
                                            x.Map(m => m.Title);
                                        });
            Component(o => o.Survey,
                                            x =>
                                            {
                                                x.Map(m => m.DoTheyWantToBeAnAgent);
                                                x.Map(m => m.WhatTypeOfAgentDoTheyWantToBe);
                                                x.Map(m => m.FoundUsVia);
                                                x.Map(m => m.InBizSector);
                                                x.Map(m => m.WantsAFollowUpCall);
                                                x.Map(m => m.WantsToKnowAboutMainProducts);
                                                x.Map(m => m.WantsToKnowAboutOtherProducts);
                                                x.Map(m => m.WantsToKnowAboutPricing);
                                            });
            HasMany(o => o.InterestedIn)
                .Component(x=> {
                                   x.TableName = "Lead_Items";
                                   x.Map(m => m.ItemId);
                }
                ).AsSet();
        }
    }
Posted on Monday, August 18, 2008 6:46 PM | Back to top


Comments on this post: Sample FluentNHibernate Class Map

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Dru Sellers | Powered by: GeeksWithBlogs.net