/// <summary> /// 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 /// </summary> public void Seal(IBank bank) { if (bank == null) { throw new DistributedDataAccessException(StringConsts.ARGUMENT_ERROR + "Parcel.Seal(bank==null)"); } if (m_State != ParcelState.Creating && m_State != ParcelState.Modifying) { throw new DistributedDataAccessException(StringConsts.DISTRIBUTED_DATA_PARCEL_INVALID_OPERATION_ERROR.Args("Seal", GetType().FullName, m_State)); } Validate(bank); if (ValidationExceptions.Any()) { throw ParcelSealValidationException.ForErrors(GetType().FullName, ValidationExceptions); } m_ReplicationVersionInfo = bank.GenerateReplicationVersionInfo(this); DoSeal(bank); m_State = ParcelState.Sealed; m_NewlySealed = true; }
/// <summary> /// Called by device to load parcel from storage. /// The new instance is in 'ParcelState.Sealed' state. /// Business logic devs - do not call /// </summary> protected Parcel(GDID id, object payload, IReplicationVersionInfo versInfo) { m_GDID = id; m_State = ParcelState.Sealed; m_PayloadUnwrapped = true; m_Payload = payload; m_ReplicationVersionInfo = versInfo; }
/// <summary> /// Called by device to load parcel from storage. /// The new instance is in 'ParcelState.Sealed' state. /// Business logic devs - do not call /// </summary> protected Parcel(GDID id, object payload, IReplicationVersionInfo versInfo) { m_GDID = id; if (versInfo == null) { throw new DistributedDataAccessException(StringConsts.ARGUMENT_ERROR + GetType().FullName + ".ctor(versInfo==null)"); } if (payload == null && !versInfo.VersionDeleted) { throw new DistributedDataAccessException(StringConsts.ARGUMENT_ERROR + GetType().FullName + ".ctor(payload==null)"); } m_State = ParcelState.Sealed; m_Payload = payload; m_ReplicationVersionInfo = versInfo; }
/// <summary> /// 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 /// </summary> public void Seal(IBank bank) { if (bank==null) throw new DistributedDataAccessException(StringConsts.ARGUMENT_ERROR+"Parcel.Seal(bank==null)"); if (m_State!= ParcelState.Creating && m_State!=ParcelState.Modifying) throw new DistributedDataAccessException(StringConsts.DISTRIBUTED_DATA_PARCEL_INVALID_OPERATION_ERROR.Args("Seal", GetType().FullName, m_State) ); Validate(bank); if (ValidationExceptions.Any()) throw ParcelSealValidationException.ForErrors(GetType().FullName, ValidationExceptions); m_ReplicationVersionInfo = bank.GenerateReplicationVersionInfo(this); DoSeal(bank); m_State = ParcelState.Sealed; m_NewlySealed = true; }
/// <summary> /// Called by device to load parcel from storage. /// The new instance is in 'ParcelState.Sealed' state. /// Business logic devs - do not call /// </summary> protected Parcel(GDID id, object payload, IReplicationVersionInfo versInfo) { m_GDID = id; if (payload==null) throw new DistributedDataAccessException(StringConsts.ARGUMENT_ERROR+GetType().FullName+".ctor(payload==null)"); if (versInfo==null) throw new DistributedDataAccessException(StringConsts.ARGUMENT_ERROR+GetType().FullName+".ctor(versInfo==null)"); m_State = ParcelState.Sealed; m_Payload = payload; m_ReplicationVersionInfo = versInfo; }
public SomeDataParcel(GDID id, SomeData payload, IReplicationVersionInfo ver = null) : base(id, payload, ver) { }