Castle.ActiveRecord 学与练[3]中

第一部分:特性介绍
ActiveRecordAttribute:
--------------------------------------------------------------------------------------------------------------------------------------
  Name Description
Public BatchSize
From NHibernate documentation: Specify a "batch size" for fetching instances of this class by identifier.
Public DiscriminatorColumn
Gets or sets the Discriminator column for a table inheritance modeling
为表设置一个识别器字段
Public DiscriminatorType
Gets or sets the column type (like string or integer) for the discriminator column
为识别器字段设置一个字段类型(例如:String或者Int)
Public DiscriminatorValue
Gets or sets the value that represents the target class on the discriminator column
为识别器字段设置一个可以描述目标类的值
Public DynamicInsert
From NHibernate documentation: Specifies that INSERT SQL should be generated at runtime and contain only the columns whose values are not null.
Public DynamicUpdate
From NHibernate documentation: Specifies that UPDATE SQL should be generated at runtime and contain only those columns whose values have changed.
Public Lazy
Enable lazy loading for the type
打开延迟加载
Public LazySpecified
Gets a value indicating whether explicit lazy behavior was specified. If explicit lazy behavior was not specified, it goes to the configuration to decide if the type should be lazy or not.
Public Locking
From NHibernate documentation: Determines the optimistic locking strategy.
Public Mutable
From NHibernate documentation: Specifies that instances of the class are (not) mutable.
Public Persister
From NHibernate documentation: Specifies a custom IEntityPersister.
Public Polymorphism
From NHibernate documentation: Determines whether implicit or explicit query polymorphism is used.
Public Proxy
Associates a proxy type with the target type
Public Schema
Gets or sets the schema name associated with the type
设置概要的信息
Public SelectBeforeUpdate
From NHibernate documentation: Specifies that NHibernate should never perform an SQL UPDATE unless it is certain that an object is actually modified. In certain cases (actually, only when a transient object has been associated with a new session using update()), this means that NHibernate will perform an extra SQL SELECT to determine if an UPDATE is actually required.
Public Table
Gets or sets the table name associated with the type
表名,类名与表名相同可为空
Public UseAutoImport
From NHibernate documentation: The auto-import attribute lets us use unqualified class names in the query language, by default. The assembly and namespace attributes specify the assembly where persistent classes are located and the namespace they are declared in.
Public Where
SQL condition to retrieve objects
指定一个附加SQL的WHERE子句
--------------------------------------------------------------------------------------------------------------------------------------

PrimaryKeyAttribute:
--------------------------------------------------------------------------------------------------------------------------------------
  Name Description
Public Column
Gets or sets the column name
设置字段名
Public ColumnType
Gets or sets the type of the column.
设置字段类型
Public CustomGenerator
Gets or sets the custom generator. The generator must implement IIdentifierGenerator
设置一个自定义的生成器.这个生成器必要实现IIdentifierGenerator接口
Public Generator
Gets or sets the generator.
设置一个生成器,是一个.NET类的名字,用来为该持久化类的实例生成惟一的标识.
Public Length
Gets or sets the length of values in the column
设置字段长度
Public Params
Comma separated value of parameters to the generator
用parameters来为生成器配置参数或者初始化参数.
Public SequenceName
Gets or sets the name of the sequence.
当指定主键的生成方式为Sequence时,序列的名称
当指定主键的生成方式为Sequence时,Sequence的名称.
Public UnsavedValue
Gets or sets the unsaved value.
设置该实例未保存时的值
--------------------------------------------------------------------------------------------------------------------------------------

PrimaryKeyType
--------------------------------------------------------------------------------------------------------------------------------------
Name Description
Public Identity
Use Identity column (auto number) Note: This force an immediate call to the DB when Create() is called
DB2,MySQL, MS SQL Server, SybaseHypersonicSQL的内置标识字段提供支持,生成自增的整型
当Create() 方法执行时,便会触发数据库表自增类型字段自增.
Public Sequence
Use a sequence
序列
Public HiLo
Use the HiLo algorithm to get the next value 
高低位,使用一个高/低位算法来高效的生成Int64, Int32 或者 Int16类型的标识符。
Public SeqHiLo
Use a sequence and a HiLo algorithm - better performance on Oracle
使用序列的高低位,使用一个高/低位算法来高效的生成Int64, Int32 或者 Int16类型的标识符,给定一个数据库序列(sequence)的名字。
Public UuidHex
Use the hex representation of a unique identifier
用一个System.Guid和它的ToString(string format)方法生成字符串类型的标识符。
Public UuidString
Use the string representation of a unique identifier
用一个新的System.Guid产生一个byte[] ,把它转换成字符串。
Public Guid
Generate a Guid for the primary key Note: You should prefer using GuidComb over this value.
用一个新的System.Guid 作为标识符。
Public GuidComb
Generate a Guid in sequence, so it will have better insert performance in the DB.
Jimmy Nilsso的一个算法产生一个新的System.Guid
Public Native
Use an identity or sequence if supported by the database, otherwise, use the HiLo algorithm
根据底层数据库的能力选择 identity, sequence 或者 hilo中的一个。默认值。
Public Assigned
The primary key value is always assigned. Note: using this you will lose the ability to call Save(), and will need to call Create() or Update() explicitly.
让应用程序在自己为对象分配一个标示符。
Public Foreign
This is a foreign key to another table
外键
Public Counter
Returns a Int64 constructed from the system time and a counter value.
返回一个INT64类型的系统时间和一个记数器值.
Public Increment
Returns a Int64, constructed by counting from the maximum primary key value at startup.
主键最大值加1
Public Custom
A custom generator will be provided. See CustomGenerator
--------------------------------------------------------------------------------------------------------------------------------------

PropertyAttribute:
--------------------------------------------------------------------------------------------------------------------------------------
  Name Description
Public Check
From NHibernate documentation: create an SQL check constraint on either column or table
约束
Public Column
Gets or sets the column name
设置字段名
Public ColumnType
Gets or sets the type of the column.
设置字段类型
Public Formula
Gets or sets the formula used to calculate this property
一个SQL表达式,定义了这个计算(computed) 属性的值。计算属性没有和它对应的数据库字段。
Public Index
From NHibernate documentation: specifies the name of a (multi-column) index
Public Insert
Set to false to ignore this property when inserting entities of this ActiveRecord class.
表明在用于INSERTSQL语句中是否包含这个字段。默认为true
Public Length
Gets or sets the length of the property (for strings - nvarchar(50) )
字段长度
Public NotNull
Gets or sets a value indicating whether this property allow null.
是否允许为空
Public SqlType
From NHibernate documentation: overrides the default column type
重写默认的字段类型.
Public Unique
Gets or sets a value indicating whether this PropertyAttribute is unique.
是否允许重复.
Public UniqueKey
From NHibernate documentation: A unique-key attribute can be used to group columns in a single unit key constraint.
Public Update
Set to false to ignore this property when updating entities of this ActiveRecord class.
表明在用于UPDATESQL语句中是否包含这个字段。默认为true
--------------------------------------------------------------------------------------------------------------------------------------

你可能感兴趣的:(.net,orm,IOC,ActiveRecord,Castle)