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

 

你可能感兴趣的:(ActiveRecord)