castle ActiveRecord入门实例(2)-映射管理
2012-01-20 09:55
429 查看
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("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()
{
}
}
相关文章推荐
- castle ActiveRecord入门实例(1)-单表操作
- Castle Active Record for .NET2.0快速入门示例
- Castle ActiveRecord学习实践(4):实现One-Many关系的映射
- Castle ActiveRecord学习实践(4):实现One-Many关系的映射
- C#.Net Castle Active Record for .NET2.0快速入门示例
- ObjectQuery for Castle.ActiveRecord 使用指南(1):入门
- Castle ActiveRecord学习笔记四:各种映射
- Castle ActiveRecord学习实践(4):实现One-Many关系的映射
- C#.Net Castle ActiveRecord学习实践(1):快速入门指南
- 基于Castle ActiveRecord开发Domain Model详解(一)对象关系到数据表的映射
- Castle ActiveRecord学习实践(5):实现Many–Many关系的映射
- Castle Active Record for .NET2.0快速入门示例
- 在VS 2005 下搭建Castle Active Record + Access 开发环境实例
- C#.Net Castle ActiveRecord学习实践(3):映射基础
- Castle Active Record不需要映射文件,值得了解
- Castle Active Record for .NET2.0快速入门示例
- C#.Net Castle ActiveRecord学习实践(4):实现One-Many关系的映射
- Castle Active Record for .NET2.0快速入门示例
- C#.Net Castle ActiveRecord学习实践(5):实现Many–Many关系的映射
- Castle Active Record for .NET2.0快速入门示例