Castle is an open source project for the. NET platform, from the data Access framework ORM to the IOC container, to the MVC framework of the web layer, AOP, and basically everything in the entire development process, providing a good service for our rapid building of enterprise-class applications.
ActiveRecord provides a concise, O/R mapping
ActiveRecord is a data access framework provided in castle that encapsulates nhibernate operations at the bottom and uses attributes instead of mapping files, and it provides a simple, O-R map that lets you marvel at how easy it is to implement a persistent data layer.
First, establish the entity class and complete the mapping of the database
Namespace ZDS. Test.model
{
[ActiveRecord ("Users")] public
class users:activerecordbase<users>// Activerecordbase
{
private int oid, inherited from Castle;
[PrimaryKey (Primarykeytype.identity, "Oid")]
public int Oid
{get
{return Oid;}
set {oid = value;}
private string name;
[Property ("Name", Length=100,notnull=true)]
public string name
{get
{
set {name = value;}
private string sex;
[Property ("Sex")]
public string Sex
{get
{return Sex;}
set {sex = value;}
private string age;
[Property (' age ')]
public string Age
{get {return age
;}
set {age = value;}
}
}