Class DataParcelAttribute
Decorates Pacel-derivative classes specifying distributed data store options. Unlike the CRUD family of metadata attributes this attributed is NOT TARGETABLE on purpose beacause different sharding definitions would have affected the properties of the parcel which could have been very complex to maintain/account for. So, every parcel has ONLY ONE set opf metadata definition. In case when different parcel definitions needed a new parcel type should be created which can reuse the payload - this is much easier to implement (two parcels) than targeting within the same parcel. Table mappings are targetable
Inheritance
Implements
Inherited Members
Namespace: NFX.DataAccess.Distributed
Assembly: NFX.dll
Syntax
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class DataParcelAttribute : Attribute, ICachePolicy
Constructors
DataParcelAttribute(String, String, Boolean, Type, String, String, Int32, Int32, Int32, String)
Declaration
public DataParcelAttribute(string schemaName, string areaName, bool supportsMerge = false, Type shardingParcel = null, string replicationChannel = null, string cacheTableName = null, int cacheWriteMaxAgeSec = -1, int cacheReadMaxAgeSec = -1, int cachePriority = -1, string targetTableMappings = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | schemaName | |
System.String | areaName | |
System.Boolean | supportsMerge | |
System.Type | shardingParcel | |
System.String | replicationChannel | |
System.String | cacheTableName | |
System.Int32 | cacheWriteMaxAgeSec | |
System.Int32 | cacheReadMaxAgeSec | |
System.Int32 | cachePriority | |
System.String | targetTableMappings |
Properties
AreaName
Specifies the Areaname - the logical subdivision in the store where parcels reside within the schema(see SchemaName): i.e. 'commonClinicalData'. Depending on a particular store setup this logical name may or may not represent physical servers/locations in the store. Every store implementation maps logical paths to physical servers and/or shards. This feature provides very high degree of distributed database design flexibility, as some parcels may represent common/dictionary data that does not need to be sharded, whereas others may represent purely transactional high-volume data that needs to be sharded. The value is required and is always specified or exception is thrown in .ctor
Declaration
public string AreaName { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Keep in mind that in a distributed database system various parcels may be stored not only in different locations, be optionally sharded, and even be stored in different back-end technologies (i.e. NoSQL/RDBMS/flat files)
CacheAbsoluteExpirationUTC
This property can not be set on the attribute level and always returns null
Declaration
public DateTime? CacheAbsoluteExpirationUTC { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTime> |
CachePriority
Specifies the relative cache priority of this parcel This property acts as a default, the runtime first checks parcel instance properties then reverts to this attribute
Declaration
public int ? CachePriority { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
CacheReadMaxAgeSec
Specifies the maximum age of parcel instance in cache to be suitable for reading This property acts as a default, the runtime first checks parcel instance properties then reverts to this attribute
Declaration
public int ? CacheReadMaxAgeSec { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
CacheTableName
Specifies the name of the cache table for this parcel This property acts as a default, the runtime first checks parcel instance properties then reverts to this attribute
Declaration
public string CacheTableName { get; }
Property Value
Type | Description |
---|---|
System.String |
CacheWriteMaxAgeSec
Specifies for how long should this parcel be cached in RAM after a write (after a saved change). This property acts as a default, the runtime first checks parcel instance properties then reverts to this attribute
Declaration
public int ? CacheWriteMaxAgeSec { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
ReplicationChannel
Specifies the name of the replication channel used to pump data between servers/data centers/locations
Declaration
public string ReplicationChannel { get; }
Property Value
Type | Description |
---|---|
System.String |
SchemaName
Specifies the name for logical schema that parcel decorated by this attribute belongs to. The exact location within the data store is detailed further with AreaName property. The value is required and is always specified or exception is thrown in .ctor
Declaration
public string SchemaName { get; }
Property Value
Type | Description |
---|---|
System.String |
ShardingParcel
Specifies the type of Parcel that is used for sharding. By default this parameter is null, so parcels are sharded on their own instance types, however there are cases when a parcel overrides ShardingID and specifies ShardingParcel type via this member so it gets stored along with the specified parcel
Declaration
public Type ShardingParcel { get; }
Property Value
Type | Description |
---|---|
System.Type |
SupportsMerge
Returns true if parcel supports merge with other versions. Server may merge multiple parcel versions to resolve versioning conflict. Default implementation returns false
Declaration
public bool SupportsMerge { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
TableMappings
Returns mappins of target->table attributes. Pass in [DataParcel(targetTableMappings = "targetName1=tableName1{atr1=v1 atr2=v2...} targetName2=tableName2{atr1=v1 atr2=v2...}...")];
Declaration
public IRegistry<TargetTableMapping> TableMappings { get; }
Property Value
Type | Description |
---|---|
IRegistry<TargetTableMapping> |
Methods
GetParcelAttr(Type)
Returns DataParcelAttribute for a parcel type. Use Parcel.MetadataAttribute to obtain the attribute instance polymorphically for instance. If parcel is not decorated by the attribute then exception is thrown
Declaration
public static DataParcelAttribute GetParcelAttr(Type tparcel)
Parameters
Type | Name | Description |
---|---|---|
System.Type | tparcel |
Returns
Type | Description |
---|---|
DataParcelAttribute |