Class EntityProperty
Defines how this property hsould be handled when maintained as a column in sql server
Inheritance
Inherited Members
Namespace: LemonEdge.API.Attributes
Assembly: API.dll
Syntax
[AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
public sealed class EntityProperty : Attribute
Constructors
EntityProperty(SQLType, Boolean)
Defines the property with the specified sql type, whether it is nullable
Declaration
public EntityProperty(SQLType type, bool nullable)
Parameters
Type | Name | Description |
---|---|---|
SQLType | type | The sql type used to store the value of this property in sql |
System.Boolean | nullable | Indicates if the property should be nullable or not in sql |
EntityProperty(SQLType, Boolean, Boolean)
Defines the property with the specified sql type, whether it is nullable, and whether it should be marked as sparse
Declaration
public EntityProperty(SQLType type, bool nullable, bool sparse)
Parameters
Type | Name | Description |
---|---|---|
SQLType | type | The sql type used to store the value of this property in sql |
System.Boolean | nullable | Indicates if the property should be nullable or not in sql |
System.Boolean | sparse | Indicates if this column should be stored as a sparse column in sql |
EntityProperty(SQLType, Boolean, String)
Defines the property with the specified sql type, whether it is nullable, and what default sql to use when upgrading the column to not nullable
Declaration
public EntityProperty(SQLType type, bool nullable, string defaultSQL)
Parameters
Type | Name | Description |
---|---|---|
SQLType | type | The sql type used to store the value of this property in sql |
System.Boolean | nullable | Indicates if the property should be nullable or not in sql |
System.String | defaultSQL | If this column is being upgraded from nullable to not nullable, this is the default sql to apply to that column when altering it |
EntityProperty(SQLType, Int16, Boolean)
Defines the property with the specified sql type with a specfied length (required if the sql type is of string type), whether it is nullable
Declaration
public EntityProperty(SQLType type, short length, bool nullable)
Parameters
Type | Name | Description |
---|---|---|
SQLType | type | The sql type used to store the value of this property in sql |
System.Int16 | length | The length to use for the string column. i.e. if the type is NVarChar then a length of 30, would be stored as nvarchar(30). If no length is supplied then nvarchar(max) is used. |
System.Boolean | nullable | Indicates if the property should be nullable or not in sql |
EntityProperty(SQLType, Int16, Boolean, String)
Defines the property with the specified sql type with a specfied length (required if the sql type is of string type), whether it is nullable, and what default sql to use when upgrading the column to not nullable
Declaration
public EntityProperty(SQLType type, short length, bool nullable, string defaultSQL)
Parameters
Type | Name | Description |
---|---|---|
SQLType | type | The sql type used to store the value of this property in sql |
System.Int16 | length | The length to use for the string column. i.e. if the type is NVarChar then a length of 30, would be stored as nvarchar(30). If no length is supplied then nvarchar(max) is used. |
System.Boolean | nullable | Indicates if the property should be nullable or not in sql |
System.String | defaultSQL | If this column is being upgraded from nullable to not nullable, this is the default sql to apply to that column when altering it |
EntityProperty(SQLType, Int16, Int16, Boolean)
Defines the property with the specified sql type and its precision and scale (when a decimal type), whether it is nullable
Declaration
public EntityProperty(SQLType type, short precision, short scale, bool nullable)
Parameters
Type | Name | Description |
---|---|---|
SQLType | type | The sql type used to store the value of this property in sql |
System.Int16 | precision | The precision component of the decimal type, giving rise to decimal( |
System.Int16 | scale | The scale component of the decimal type, giving rise to decimal( |
System.Boolean | nullable | Indicates if the property should be nullable or not in sql |
EntityProperty(SQLType, Int16, Int16, Boolean, Boolean)
Defines the property with the specified sql type and its precision and scale (when a decimal type), whether it is nullable, and whether it should be marked as sparse
Declaration
public EntityProperty(SQLType type, short precision, short scale, bool nullable, bool sparse)
Parameters
Type | Name | Description |
---|---|---|
SQLType | type | The sql type used to store the value of this property in sql |
System.Int16 | precision | The precision component of the decimal type, giving rise to decimal( |
System.Int16 | scale | The scale component of the decimal type, giving rise to decimal( |
System.Boolean | nullable | Indicates if the property should be nullable or not in sql |
System.Boolean | sparse | Indicates if this column should be stored as a sparse column in sql |
EntityProperty(SQLType, Int16, Int16, Boolean, Boolean, String)
Defines the property with the specified sql type and its precision and scale (when a decimal type), whether it is nullable, whether it should be marked as sparse, and what default sql to use when upgrading the column to not nullable
Declaration
public EntityProperty(SQLType type, short precision, short scale, bool nullable, bool sparse, string defaultSQL)
Parameters
Type | Name | Description |
---|---|---|
SQLType | type | The sql type used to store the value of this property in sql |
System.Int16 | precision | The precision component of the decimal type, giving rise to decimal( |
System.Int16 | scale | The scale component of the decimal type, giving rise to decimal( |
System.Boolean | nullable | Indicates if the property should be nullable or not in sql |
System.Boolean | sparse | Indicates if this column should be stored as a sparse column in sql |
System.String | defaultSQL | If this column is being upgraded from nullable to not nullable, this is the default sql to apply to that column when altering it |
EntityProperty(SQLType, Int16, Int16, Boolean, String)
Defines the property with the specified sql type and its precision and scale (when a decimal type), whether it is nullable, and what default sql to use when upgrading the column to not nullable
Declaration
public EntityProperty(SQLType type, short precision, short scale, bool nullable, string defaultSQL)
Parameters
Type | Name | Description |
---|---|---|
SQLType | type | The sql type used to store the value of this property in sql |
System.Int16 | precision | The precision component of the decimal type, giving rise to decimal( |
System.Int16 | scale | The scale component of the decimal type, giving rise to decimal( |
System.Boolean | nullable | Indicates if the property should be nullable or not in sql |
System.String | defaultSQL | If this column is being upgraded from nullable to not nullable, this is the default sql to apply to that column when altering it |
Properties
Collation
If the sql type is of string type, this is the collation to use. If left blank this will default to the collation of the database itself
Declaration
public string Collation { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ColumnName
The name of the column to be created in sql for this property.
If blank this defaults to the actual name of the property itself
Declaration
public string ColumnName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
FriendlyLabel
The friendly label to use when displaying this property value in the UI.
If blank this default to the name of the property itself using the Wordify(String) and by removing any trailing ID
Declaration
public string FriendlyLabel { get; set; }
Property Value
Type | Description |
---|---|
System.String |
IsDate
If this is a datetimeoffset, this indicates we only require it for the date component, and the time should always be 0 so dates match when filtered
Declaration
public bool IsDate { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsEntityTypeLink
Indicates this property is a guid that holds a link to the unique global ids of entity types themselves.
This is often used in conjunction with a property that holds the id to an item (using EntityLinkToAnyParentRelationship) where this property holds the type of entity the other holds the id for
Declaration
public bool IsEntityTypeLink { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
OldColumnNames
If this column has been upgraded and has had its name changed, this is a list of all the old column names so the system can upgrade the appropriate tables and queries
Declaration
public string[] OldColumnNames { get; set; }
Property Value
Type | Description |
---|---|
System.String[] |
Type
The sql type used to store this property value in sql server
Declaration
public ColumnType Type { get; }
Property Value
Type | Description |
---|---|
ColumnType |
UseForReplicatingDescriptorType
Indicates this property belongs to a descriptor that is replicated for each descriptor in the system Essentially means this property is "virtual" and maintained by the system, the actual table won't hold this column, the functions will. The column holds the id of the entity type this descriptor is replicated for. For example, Permissions uses this to indicate the EntityTypeID is the property that should be used to replicate the permissions table for each descriptor
Declaration
public bool UseForReplicatingDescriptorType { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |