示例#1
0
文件: Parcel.cs 项目: uzbekdev1/nfx
        /// <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;
        }
示例#2
0
 /// <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;
 }
示例#3
0
文件: Parcel.cs 项目: uzbekdev1/nfx
        /// <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;
        }
示例#4
0
文件: Parcel.cs 项目: kamilkk/nfx
            /// <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;
            }
示例#5
0
文件: Parcel.cs 项目: kamilkk/nfx
            /// <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;
            }
示例#6
0
文件: Parcel.cs 项目: sergey-msu/nfx
 /// <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;
 }
示例#7
0
 public SomeDataParcel(GDID id, SomeData payload, IReplicationVersionInfo ver = null) : base(id, payload, ver)
 {
 }