Castle Learning Notes----Understanding Castle.avtiverecord

Source: Internet
Author: User

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;}
}
}
    

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.