castle ActiveRecord入门实例(2)-映射管理

1.类别映射

[ActiveRecord("Catalog")]
public class Catalog: ActiveRecordBase<Catalog>

{
  [PrimaryKey]
  public int CatalogId { get; set; }
  [Property]
  public string Name { get; set; }

  [HasMany]
  public IList<Movies> MovieList{ get; set; }
}

 

 

[ActiveRecord("Movies")]
public class Movies : ActiveRecordBase<Movies>
{
  [PrimaryKey]
  public int ID{get;set;}
  [Property]
  public string Title{get;set;}
  [Property]
  public DateTime ReleaseDate{get;set;}
  [Property]
  public string Genre{get;set;}
  [Property]
  public double Price{get;set;}
  [Property]
  public string Rating{get;set;}

  [BelongsTo("CatalogId")]
  public Catalog catalog { get; set; }


      public Movies()
      {
      }

 

posted on 2012-01-20 09:55  kenny jiang  阅读(137)  评论(0编辑  收藏  举报