.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Post New Web Links

nhibernate +fluent +lazyload(?)

Posted By:      Posted Date: September 19, 2010    Points: 0   Category :ASP.Net
 

Hi all.


Tables:



Mapping:


public class ArticleMap : ClassMap<Article>
    {
        public ArticleMap()
        {
            Table(FieldNames.Article.Table);
            Id(x => x.ID).GeneratedBy.Native();
            Map(x => x.Author).Not.Nullable();
            Map(x => x.CreatedDate).Not.Nullable();
            Map(x => x.Content).Not.Nullable();
            References(x => x.Category).Not.Nullable().Column(FieldNames.Article.CategoryID);
            Map(x => x.Published).Not.Nullable();
            Map(x => x.Saved).Not.Nullable();
            Map(x => x.IsNews).Not.Nullable();
            
            HasManyToMany(x => x.Tags).Table("ArticleTags").ParentKeyColumn("ID").ChildKeyColumn("ArticleID");
        }
    }

public class TagMap : ClassMap<Tag>
    {
        public TagMap()
        {
            Table(FieldNames.Tag.Table);
            Id(x => x.Id);
            Map(x => x.Name).Not.Nullable();
            
            HasManyToMany(x => x.Articles).Table("ArticleTags")



View Complete Post


More Related Resource Links

Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend