Summary of the XPO Learning of the Blog Park ARMING

xiaoxiao2021-03-05  55

Original: XPO learning two --Attribute summary of: Arming

12. Summary for Attribute:

It should be seen that in the entire XPO framework, Attribute is quite frequent, you can list common:

[Aggregated] no parameters

A Property or A field, and can only be referenced by persistent classes or XPCollection.

Implement two-lasting cascade-deleted function.

[Association ("PersonadDresses", TypeOf (address)]]

Working on a Property or A field

Implement two long-lasting cascading relationships

Parameters: 1, the name of the association;

[MAPTO ("T_Person")]]

Working in persistent class or a property or a field

Time to persistence: Specify the table name of the persistent class map. If not specified, the default table name is the class name.

When acting on Property or Field: The column name of the table.

The parameter is a table name or column name, which is case sensitive.

[Persistent ("CREATEDON")] Forced mapping field

Working on a Property or A field

XPO is generally only for persistence operations to Wrantored Property and Public Field in the persistent class. Therefore, the only Field can be compulsive for mandatory persistence.

Parameters: Table name (optional)

[Nonprysistent]

Working on a class, Property or A field

Indicates that there is no persistence operation for class or Property, Field.

The parameter is not.

[Dbtype]

Specifies the data type used when you created.

Parameters: The data type of the string is represented.

[Mapinheritance (mapinheritancetype.Owntable)]

Working in persistent classes.

Two lasting classes are inheritance relationships, the storage method of lasting information.

parameter:

MapinheritanceType.Owntable: Independent tables, store unique parts, respectively.

MapinheritanceType.ParentTable: Stores all in the parent table.

[Delayed ("Document")]]]]]]]

Can only act on Property.

Delayed data is loaded, and the data is not loaded when the persistence class is constructed, just when Property is first accessed.

Combined with class XpdelayedProperty to use to delay the functions of delay.

Parameters: Quote The XpdelayedProperty Type Field Name.

[SIZE (SIZEATTRIBUTE.UNLIMITED] Data length

Role range a Property or a field.

Specifies the mapping table field length. Just reflect when the field is created. When the field already exists, XPO will not check this value at this time.

Parameters: length or sizeattribute.unlimited (no limit length)

Can not be specified. If it is String, the default is 100.

[Key], [key (true)], [key (autogenerate = true)]

Working on a Property or A field.

Specify the primary key. Each persistence class requires a Propery or Field specified as KEY. A significant difference in XPObject and XPBaseObject is that XPObject has an OID primary key.

Parameters: BOOL type (optional). Whether the key value (INT or GUID) is automatically generated by XPO. The default is False. [Indexed]

Working on a Property or A field.

Specify an index. The index is unique index by default.

There is no configuration parameter. But you can set it to a unique index with SET [indexed (unique = true)]

[OptimisticLocking (False)]

Working in persistent classes.

Whether it is optimistic lock (thanks to Format's finger-wrong). If locked, the XPO checks if the original data has been changed, not the Who Lastst WHO Win. XPO adds a system field "OptimisticLockField" in a table class that lastsbly class maps, apparently used to mark status. Therefore, if it is mapped to the view, it is explicitly set to not lock.

Parameters: BOOL value (optional, default is true)

[ValueConverter (TypeOf) class)]

Acting on Property.

Values ​​and type conversions, very interesting features. Both database extraction values ​​and save values ​​can be used as a conversion.

[Nullue ("")]

A Property or Field acting on simple data type.

Specifies the data corresponding to the persistent class when the corresponding library is NULL. It is also true.

Parameters: Different parameters are introduced according to different data types. It is more convenient to see:

PUBLIC CLASS EXAMPLE: XPOBJECT {

[Nullue (int32.minvalue)] public int nulloncess; [nullue (0)] public int nullonzerofield;

[NullValue ("")] public string nullonemptystringfieldstring;

[NullValue]] Public String Nullonnullfieldstring;

I want to list only commonly used, but look at the code, I will pass two. [Explicitload]

[MEMBERDESIGNTIMEVISIBILITY]

(Fail)

[Aggregated] no parameters

A Property or A field, and can only be referenced by persistent classes or XPCollection.

Implement two-lasting cascade-deleted function.

[Association ("PersonadDresses", TypeOf (address)]]

Working on a Property or A field

Implement two long-lasting cascading relationships

Parameters: 1, the name of the association;

[MAPTO ("T_Person")]]

Working in persistent class or a property or a field

Time to persistence: Specify the table name of the persistent class map. If not specified, the default table name is the class name.

When acting on Property or Field: The column name of the table.

The parameter is a table name or column name, which is case sensitive.

[Persistent ("CREATEDON")] Forced mapping field

Working on a Property or A field

XPO is generally only for persistence operations to Wrantored Property and Public Field in the persistent class. Therefore, the only Field can be compulsive for mandatory persistence. Parameters: Table name (optional)

[Nonprysistent]

Working on a class, Property or A field

Indicates that there is no persistence operation for class or Property, Field.

The parameter is not.

[Dbtype]

Specifies the data type used when you created.

Parameters: The data type of the string is represented.

[Mapinheritance (mapinheritancetype.Owntable)]

Working in persistent classes.

Two lasting classes are inheritance relationships, the storage method of lasting information.

parameter:

MapinheritanceType.Owntable: Independent tables, store unique parts, respectively.

MapinheritanceType.ParentTable: Stores all in the parent table.

[Delayed ("Document")]]]]]]]

Can only act on Property.

Delayed data is loaded, and the data is not loaded when the persistence class is constructed, just when Property is first accessed.

Combined with class XpdelayedProperty to use to delay the functions of delay.

Parameters: Quote The XpdelayedProperty Type Field Name.

[SIZE (SIZEATTRIBUTE.UNLIMITED] Data length

Role range a Property or a field.

Specifies the mapping table field length. Just reflect when the field is created. When the field already exists, XPO will not check this value at this time.

Parameters: length or sizeattribute.unlimited (no limit length)

Can not be specified. If it is String, the default is 100.

[Key], [key (true)], [key (autogenerate = true)]

Working on a Property or A field.

Specify the primary key. Each persistence class requires a Propery or Field specified as KEY. A significant difference in XPObject and XPBaseObject is that XPObject has an OID primary key.

Parameters: BOOL type (optional). Whether the key value (INT or GUID) is automatically generated by XPO. The default is False.

[Indexed]

Working on a Property or A field.

Specify an index. The index is unique index by default.

There is no configuration parameter. But you can set it to a unique index with SET [indexed (unique = true)]

[OptimisticLocking (False)]

Working in persistent classes.

Whether it is optimistic lock (thanks to Format's finger-wrong). If locked, the XPO checks if the original data has been changed, not the Who Lastst WHO Win. XPO adds a system field "OptimisticLockField" in a table class that lastsbly class maps, apparently used to mark status. Therefore, if it is mapped to the view, it is explicitly set to not lock.

Parameters: BOOL value (optional, default is true)

[ValueConverter (TypeOf) class)]

Acting on Property.

Values ​​and type conversions, very interesting features. Both database extraction values ​​and save values ​​can be used as a conversion.

[Nullue ("")]

A Property or Field acting on simple data type.

Specifies the data corresponding to the persistent class when the corresponding library is NULL. It is also true.

Parameters: Different parameters are introduced according to different data types. See example is convenient: public class example: XpObject {

[Nullue (int32.minvalue)] public int nulloncess; [nullue (0)] public int nullonzerofield;

[NullValue ("")] public string nullonemptystringfieldstring;

[NullValue]] Public String Nullonnullfieldstring;

I want to list only commonly used, but look at the code, I will pass two. [Explicitload]

[MEMBERDESIGNTIMEVISIBILITY]

(Fail)

转载请注明原文地址:https://www.9cbs.com/read-32823.html

New Post(0)