Parcel MembersNFX Class Library

[This is preliminary documentation and is subject to change.]

The Parcel type exposes the following members.
Constructors

  NameDescription
Protected methodParcel 
Used for serialization
Protected methodParcel(Object)
This ctor is never public, used with __ctor__injectID
Protected methodParcel(GDID, Object)
Called when creating new Parcel instances by the original author. The new instance is in 'ParcelState.Creating' state
Protected methodParcel(GDID, Object, IReplicationVersionInfo)
Called by device to load parcel from storage. The new instance is in 'ParcelState.Sealed' state. Business logic devs - do not call
Back to Top
Methods

  NameDescription
Protected method__ctor__injectID
Internal framework method, developers: never call
Public methodDeepClone
Duplicates this parcel by doing a complete deep-clone of its state via serialization. This method is useful for making copies of the same parcel for different threads as it is thread-safe while no other thread mutates the instance, however Parcel instances are NOT THREAD-SAFE for parallel changes. The existing parcel MUST be SEALED (otherwise it can not be serialized). This method is also used before a call to Open() if parcel needs to be "un-opened" the cloned instance may be reverted to
Protected methodDestructor
Override this method to do actual destructor work
(Inherited from DisposableObject.)
Public methodDispose
Deterministically disposes object. DO NOT OVERRIDE this method, override Destructor() instead
(Inherited from DisposableObject.)
Protected methodDoMerge
Override to merge other parcels into this one. Return true if merge changed the payload. See Merge(). This implementation throws an exception
Protected methodDoOpen
Override to perform actions when parcel is unsealed (opened) for modification
Protected methodDoSeal
Override to seal the parcel instance, i.e. generate some calculated fields. The version information is already generated by the time this method is called
Protected methodDoValidate
Override to perform parcel/payload validation after modification. Add validation exceptions into m_ValidationExceptions field. Use bank for cross-checks (i.e. may run queries to check consistency)
Public methodEnsureObjectNotDisposed
Checks to see whether object dispose started or has already been disposed and throws an exception if Dispose() was called
(Inherited from DisposableObject.)
Public methodEquals
Tests for parcel equality based on the same type and GDID value
(Overrides OnlineObject Equals(Object).)
Protected methodFinalize (Inherited from DisposableObject.)
Public methodGetDistributedStableHash
Public methodGetHashCode
Generates hash code based on parcel type and GDID value
(Overrides OnlineObject GetHashCode .)
Public methodStatic memberGetParcelCacheTableName
Obtains parcel cache name from either it's associated DataParcelAttribute or if not defined, from parcel type full name
Public methodOnlineGetType
Gets the OnlineType of the current instance.
(Inherited from OnlineObject.)
Protected methodOnlineMemberwiseClone
Creates a shallow copy of the current OnlineObject.
(Inherited from OnlineObject.)
Public methodMerge
Merges other parcel instances into this one. A parcel type may support merging (when DataParcel attribute SupportsMerge is set to true) of data from other parcels/versions into this instance. This parcel must not be sealed as merge may change the payload in which case TRUE is returned. The parcel needs to be sealed again after the change. If a call to this method returns false, then nothing was changed as this instance already contains the latest data/could not be merged. Merging is used for version conflict resolution: servers check if the type of the updated parcel instance SupportsMerge, then if it does, Opens parcel and calls this method passing other versions in question to this method. The framework does not impose a limit on the supplied parcel types, however most of the parcel types support merge only with the same-typed parcel instances. IMPORTANT: The ordering of parcel versions is not guaranteed.
Public methodOpen
Opens parcel for modification. Parcel must be in the Sealed state for this call and must not be ReadOnly. Once open for modification, a parcel can not be "UnOpened", only Seal()-ed. This is because there is no way to track whether some part of payload object has changed by the calling code. Use DeepClone() before calling Open to retain a copy of Sealed parcel to revert to the cloned instance instead
Public methodSeal
Seal parcel after modification May call this method on parcels in either Creating or Modifying states. Bank is used to create the ReplicationVersionInfo which is depends on store/bank implementation. Parcels can replicate only within stores/technologies that have sealed them
Public methodToString (Overrides OnlineObject ToString .)
Public methodValidate
Performs validation of the data. Does not throw but populates validation exceptions if data is not valid. Bank context may be used to run sub-queries during consistency/crosschecks May call this method on parcels in either Creating or Modifying states
Back to Top
Extension Methods

  NameDescription
Public Extension MethodAsBool (Defined by ObjectValueConversion.)
Public Extension MethodAsByte (Defined by ObjectValueConversion.)
Public Extension MethodAsChar (Defined by ObjectValueConversion.)
Public Extension MethodAsDateTime Overloaded. (Defined by ObjectValueConversion.)
Public Extension MethodAsDateTime(DateTime, ConvertErrorHandling)Overloaded. (Defined by ObjectValueConversion.)
Public Extension MethodAsDecimal (Defined by ObjectValueConversion.)
Public Extension MethodAsDouble (Defined by ObjectValueConversion.)
Public Extension MethodAsEnum TEnum  (Defined by ObjectValueConversion.)
Public Extension MethodAsFloat (Defined by ObjectValueConversion.)
Public Extension MethodAsGDID Overloaded. (Defined by ObjectValueConversion.)
Public Extension MethodAsGDID(GDID, ConvertErrorHandling)Overloaded. (Defined by ObjectValueConversion.)
Public Extension MethodAsGDIDSymbol Overloaded. (Defined by ObjectValueConversion.)
Public Extension MethodAsGDIDSymbol(GDIDSymbol, ConvertErrorHandling)Overloaded. (Defined by ObjectValueConversion.)
Public Extension MethodAsGUID (Defined by ObjectValueConversion.)
Public Extension MethodAsInt (Defined by ObjectValueConversion.)
Public Extension MethodAsJSONConfig (Defined by ObjectValueConversion.)
Public Extension MethodAsLaconicConfig (Defined by ObjectValueConversion.)
Public Extension MethodAsLong (Defined by ObjectValueConversion.)
Public Extension MethodAsNonNullOrEmptyString (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableBool (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableByte (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableChar (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableDateTime (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableDecimal (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableDouble (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableEnum TEnum  (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableFloat (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableGDID (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableGDIDSymbol (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableGUID (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableInt (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableLong (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableSByte (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableShort (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableTimeSpan (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableUInt (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableULong (Defined by ObjectValueConversion.)
Public Extension MethodAsNullableUShort (Defined by ObjectValueConversion.)
Public Extension MethodAsSByte (Defined by ObjectValueConversion.)
Public Extension MethodAsShort (Defined by ObjectValueConversion.)
Public Extension MethodAsString (Defined by ObjectValueConversion.)
Public Extension MethodAsTimeSpan Overloaded. (Defined by ObjectValueConversion.)
Public Extension MethodAsTimeSpan(TimeSpan, ConvertErrorHandling)Overloaded. (Defined by ObjectValueConversion.)
Public Extension MethodAsUInt (Defined by ObjectValueConversion.)
Public Extension MethodAsULong (Defined by ObjectValueConversion.)
Public Extension MethodAsUri (Defined by ObjectValueConversion.)
Public Extension MethodAsUShort (Defined by ObjectValueConversion.)
Public Extension MethodAsXMLConfig (Defined by ObjectValueConversion.)
Public Extension MethodToErlObject Overloaded.
Try to convert .NET native object type to corresponding Erlang term. Throw exception if conversion is not possible
(Defined by ErlObject.)
Public Extension MethodToErlObject(ErlTypeOrder, Boolean)Overloaded.
Try to convert .NET native object type to corresponding Erlang term of given type. Throw exception if conversion is not possible
(Defined by ErlObject.)
Public Extension MethodToJSON(JSONWritingOptions)Overloaded.
Serializes object into JSON string
(Defined by JSONExtensions.)
Public Extension MethodToJSON(TextWriter, JSONWritingOptions)Overloaded.
Serializes object into JSON format using provided TextWriter
(Defined by JSONExtensions.)
Public Extension MethodToJSON(Stream, JSONWritingOptions, Encoding)Overloaded.
Serializes object into JSON format using provided stream and optional encoding
(Defined by JSONExtensions.)
Back to Top
Fields

  NameDescription
Public fieldStatic memberDEFAULT_REPLICATION_PRIORITY
Default priority of replication
Protected fieldm_ValidationExceptions
Public fieldStatic memberSTANDARD_KNOWN_SERIALIZER_TYPES
Defines well-known frequently used types for slim serializer compression
Back to Top
Properties

  NameDescription
Public propertyCacheAbsoluteExpirationUTC
Implements IParcelCachePolicy contract. The default implementation returns null. Override to supply a different absolute cache expiration UTC timestamp for this parcel that may depend on particular parcel payload state (i.e. field values).
Public propertyCachePriority
Implements IParcelCachePolicy contract. The default implementation returns null. Override to supply a relative cache priority of this parcel that may depend on particular parcel payload state (i.e. field values).
Public propertyCacheReadMaxAgeSec
Implements IParcelCachePolicy contract. The default implementation returns null. Override to supply a value for maximum validity span of cached parcel that may depend on particular parcel payload state (i.e. field values). This property may be used to obtain a value before parcel is re-read from the store
Public propertyCacheWriteMaxAgeSec
Implements IParcelCachePolicy contract. The default implementation returns null. Override to supply a value for maximum length of this isntance stay in cache that may depend on particular parcel payload state (i.e. field values)
Public propertyDisposed
Indicates whether this object was already disposed - the Dispose() has finished
(Inherited from DisposableObject.)
Public propertyDisposeStarted
Indicates whether this object Dispose() has been called and dispose started but not finished yet
(Inherited from DisposableObject.)
Public propertyEffectiveCachePolicy
Returns effective cache policy the one that is calculated from attribute and overidden by the instance
Public propertyGDID
Returns GDID for data that this parcel represents
Public propertyMetadataAttribute
Returns DataParcelAttribute that describes this parcel. Every parcel MUST be decorated by the DataParcel attribute
Public propertyNewlySealed
Returns true when parcel was just sealed after a call to Open or .ctor/create. Datastore may check this flag and disallow saving of parcel instances that have not changed
Public propertyPayload
Returns payload of this parcel. This may be null for deleted parcels (VersionDeleted). WARNING!!! Although parcels do not allow to set Payload property if they are sealed, one can still mutate/modify the payload object graph even on a sealed parcel instance, i.e. one may write:
mySealedParcel.Payload.DueDates.Add(DateTime.Now) (given DueDates of type List(DateTime))
. This case is considered to be a bug in the calling-code. The framework has no way of preventing such an inadvertent behavior as there is no way to intercept a mutation via transitive or direct references/functors in an object graph referenced by Payload property because payload type does not impose (and should not) any constraints on what can be a payload. In Aum language we will use static type checker that will detect possible property access via Payload BEFORE calling Open()
Public propertyReadOnly
Indicates whether the data may be altered. ReadOnly parcels can not be Opened after that have been Sealed by their creator
Public propertyReplicationPriority
Returns replication priority, override to make replication priority dependent on instance, i.e. a user profile data for a celebrity user may need to have higher replication rate. The lower value indicates the higher priority
Public propertyReplicationVersionInfo
Implements IReplicatable interface
Public propertyShardingID
Returns the ShardingID used for sharding, default implementation returns this parcel type and GDID. Override to return another sharding key, i.e. a social comment msg may use parent item (that the msg relates to) ID as the shard key so msgs are co-located with related items. Use CompositeShardingID to return multiple values. IMPORTANT!!! ShardingID must return an immutable value, the one that CAN NOT be changed during parcel payload life
Public propertyShardingPointer
Returns the ShardingPointer(type:ID) used for sharding, default implementation returns this parcel type and GDID. Override ShardingID property to return another sharding key, i.e. a social comment msg may use parent item (that the msg relates to) ID as the shard key so msgs are co-located with related items. Use CompositeShardingID to return multiple values. IMPORTANT!!! ShardingPointer must return an immutable value, the one that CAN NOT be changed during parcel payload life
Public propertyState
Returns the state of the parcel: Creating|Modifying|Sealed
Public propertyValidationExceptions
Returns validation exceptions - populated by a call to Validate
Back to Top
Explicit Interface Implementations

  NameDescription
Explicit interface implemetationPrivate propertyICachePolicy CacheTableName
Implements IParcelCachePolicy contract. The implementation returns null for parcel.
Back to Top
See Also