📄 castle.activerecord.xml
字号:
</summary>
<example>
In the following example, the column is also
called 'name', so you don't have to specify.
<code>
public class Blog : ActiveRecordBase
{
...
[Property]
public int Name
{
get { return _name; }
set { _name = value; }
}
</code>
To map a column name, use
<code>
[Property("blog_name")]
public int Name
{
get { return _name; }
set { _name = value; }
}
</code>
</example>
</member>
<member name="T:Castle.ActiveRecord.NestedAttribute">
<summary>
Maps properties of a child object to columns of the table
of a parent class.
</summary>
<example>
The following code illustrates the use of a
nested <c>PostalAddress</c> class
<code>
[ActiveRecord("Companies")]
public class Company : ActiveRecordBase
{
private int id;
private PostalAddress _address;
public Company()
{
}
public Company(string name)
{
this.name = name;
}
[PrimaryKey]
public int Id
{
get { return id; }
set { id = value; }
}
[Nested]
public PostalAddress Address
{
get { return _address; }
set { _address = value; }
}
}
public class PostalAddress
{
private String _address;
private String _city;
private String _state;
private String _zipcode;
[Property]
public String Address
{
get { return _address; }
set { _address = value; }
}
[Property]
public String City
{
get { return _city; }
set { _city = value;}
}
[Property]
public String State
{
get { return _state; }
set { _state = value; }
}
[Property]
public String ZipCode
{
get { return _zipcode; }
set { _zipcode = value; }
}
}
</code>
</example>
</member>
<member name="T:Castle.ActiveRecord.OneToOneAttribute">
<summary>
Associates a foreign table where the current class
and the target class share their primary key.
</summary>
<example>
The following code exemplifies two classes that maps
to two tables sharing the primary key:
<code>
[ActiveRecord("Employee")]
public class Employee : ActiveRecordBase
{
private int id;
private Award award;
[PrimaryKey(PrimaryKeyType.Native, "EmployeeID")]
public int ID
{
get { return this.id; }
set { this.id = value; }
}
[OneToOne]
public Award Award
{
get { return this.award; }
set { this.award = value; }
}
}
[ActiveRecord("Award")]
public class Award : ActiveRecordBase
{
private Employee employee;
private int id;
public Award()
{
}
public Award(Employee employee)
{
this.employee = employee;
}
[OneToOne]
public Employee Employee
{
get { return this.employee; }
set { this.employee = value; }
}
[PrimaryKey(PrimaryKeyType.Foreign, "EmployeeID")]
public int ID
{
get { return this.id; }
set { this.id = value; }
}
public static Award[] FindAll()
{
return ((Award[]) (ActiveRecordBase.FindAll(typeof(Award))));
}
public static void DeleteAll()
{
ActiveRecordBase.DeleteAll( typeof(Award) );
}
}
Employee emp = new Employee();
emp.Name = "john doe";
emp.Save();
Award award = new Award(emp);
award.Description = "Invisible employee";
award.Save();
</code>
</example>
<remarks>
Usually classes that uses the primary key
generated elsewhere (foreign) uses the PrimaryKey attribute with the
generator type <c>PrimaryKeyType.Foreign</c>
</remarks>
</member>
<member name="T:Castle.ActiveRecord.PrimaryKeyAttribute">
<summary>
Indicates the property which is the primary key.
</summary>
<example><code>
public class Blog : ActiveRecordBase
{
...
[PrimaryKey(PrimaryKeyType.Native)]
public int Id
{
get { return _id; }
set { _id = value; }
}
</code></example>
</member>
<member name="P:Castle.ActiveRecord.PrimaryKeyAttribute.Params">
<summary>
Comma separated value of parameters to the generator
</summary>
</member>
<member name="T:Castle.ActiveRecord.Framework.Config.ActiveRecordSectionHandler">
<summary>
Reads the configuration from a entry 'activerecord'
in the xml associated with the AppDomain
</summary>
</member>
<member name="T:Castle.ActiveRecord.Framework.Config.XmlConfigurationSource">
<summary>
Source of configuration based on Xml
source like files, streams or readers.
</summary>
</member>
<member name="T:Castle.ActiveRecord.Framework.Config.InPlaceConfigurationSource">
<summary>
Usefull for test cases.
</summary>
</member>
<member name="T:Castle.ActiveRecord.Framework.IConfigurationSource">
<summary>
Abstracts the source of configuration for the framework.
</summary>
</member>
<member name="M:Castle.ActiveRecord.Framework.IConfigurationSource.GetConfiguration(System.Type)">
<summary>
Implementors should return an <see cref="T:Castle.Model.Configuration.IConfiguration"/>
instance
</summary>
<param name="type"></param>
<returns></returns>
</member>
<member name="M:Castle.ActiveRecord.Framework.Internal.ActiveRecordModel.Register(System.Type,Castle.ActiveRecord.Framework.Internal.ActiveRecordModel)">
<summary>
Internally used
</summary>
<param name="arType"></param>
<param name="model"></param>
</member>
<member name="M:Castle.ActiveRecord.Framework.Internal.ActiveRecordModel.GetModel(System.Type)">
<summary>
Internally used
</summary>
<param name="arType"></param>
<returns></returns>
</member>
<member name="P:Castle.ActiveRecord.Framework.Internal.ActiveRecordModel.Key">
<summary>
Used only by joined subclasses
</summary>
</member>
<member name="T:Castle.ActiveRecord.Framework.Internal.HasManyToAnyModel.Config">
<summary>
I need this class to pass special configuration for the many-to-any
</summary>
</member>
<member name="T:Castle.ActiveRecord.Framework.Internal.GraphConnectorVisitor">
<summary>
Connects <see cref="T:Castle.ActiveRecord.Framework.Internal.ActiveRecordModel"/> with their parents
<see cref="T:Castle.ActiveRecord.Framework.Internal.ActiveRecordModel"/>
</summary>
</member>
<member name="T:Castle.ActiveRecord.Framework.Internal.SemanticVerifierVisitor">
<summary>
Traverse the tree checking the semantics of the relation and
association. The goal is to raise clear exceptions if tips of how
to fix any error.
</summary>
</member>
<member name="T:Castle.ActiveRecord.Framework.Internal.XmlGenerationVisitor">
<summary>
Traverse the tree emitting proper xml configuration
</summary>
</member>
<member name="T:Castle.ActiveRecord.Framework.Scopes.AbstractScope">
<summary>
Abstract <seealso cref="T:Castle.ActiveRecord.ISessionScope"/> implementation
</summary>
</member>
<member name="T:Castle.ActiveRecord.ISessionScope">
<summary>
Contract for implementation of scopes.
</summary>
<remarks>
A scope can implement a logic that affects
AR for the scope lifetime. Session cache and
transaction are the best examples, but you
can create new scopes adding new semantics.
<para>
The methods on this interface are mostly invoked
by the <see cref="T:Castle.ActiveRecord.Framework.ISessionFactoryHolder"/>
implementation
</para>
</remarks>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -