⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transparentpersistenceattribute.cs

📁 Perst开源实时数据库
💻 CS
字号:
using System;
using Perst.Impl;
using System.Runtime.Remoting.Contexts;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Activation;
  

namespace Perst
{
    /// <summary>
    /// Attribute providing transparent persistency for context bound objects.
    /// It should be used for classes derived from PeristentContext class.
    /// Objects of these classes automatically on demand load their 
    /// content from the database and also automatically detect object modification.
    /// </summary>
    [AttributeUsage(AttributeTargets.Class)]
    public class TransparentPersistenceAttribute : ContextAttribute, IContributeObjectSink
    {
        public TransparentPersistenceAttribute() : base("PerstMOP")
        {
        }
   
        public override bool IsContextOK(Context ctx, IConstructionCallMessage ctor) 
        {
            return false;
        }
        public IMessageSink GetObjectSink(MarshalByRefObject target, IMessageSink next) 
        {
            return new PerstSink((PersistentContext)target, next);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -