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()
      {
      }

原文地址:https://www.cnblogs.com/kenny999/p/2327751.html