using System;
using System.IO.MemoryMappedFiles;
using MessagePack;
using Server.Core;

namespace NetWorkMessage
{
    /// <summary>
    /// 消息对象
    /// </summary>
    public abstract class MessageObject : ProtoObject, IReference, IMessage
    {
        [IgnoreMember]
        public bool IsFromPool
        {
            get;
            set;
        }

        [IgnoreMember]
        public long ReferenceId
        {
            get;
            set;
        }

        public void Dispose()
        {
            VDispose();
            ReferencePool.Recycle(this);
        }
        
        protected virtual void VDispose()
        {
            
        }
    }
}