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

📄 mixtransactionproperty.cs

📁 该文件是多层体系结构的数据访问层
💻 CS
字号:
#region Copyright & License
//
// $Copyright:$
//
#endregion
#region Document Information
// $Author: Bai.shijun $
// $Rev: $ 
// $Date: 05-10-08 16:13 $
#endregion

using System;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Contexts;	

namespace Eai.Data.Transaction
{
   	/// <summary>
	/// 用于<see cref="MixTransactionAttrubite"/>使用的上下文属性。
	/// </summary>
    internal class MixTransactionProperty : IContextProperty, IContributeServerContextSink
    {
        private Type activatorType;
        private MixTransactionOption mixTransOption;

        public MixTransactionProperty(Type activatorType, MixTransactionOption mixTransOption)
        {
            this.activatorType = activatorType;
            this.mixTransOption = mixTransOption;
        }

        public const string PropertyName = "MixTransaction";
        public String Name
        {
            get
            {
                return PropertyName;
            }
        }

        /// <summary>
        /// IsNewContextOK called by the runtime in the new context
        /// </summary>
        public bool IsNewContextOK(Context ctx)
        {
            MixTransactionProperty newProperty = null;
            //Find out if the new context has a property. If not, reject it
            newProperty = ctx.GetProperty(PropertyName) as MixTransactionProperty;
            if (newProperty == null)
            {
                return false;
            }
            return true;
        }

        public void Freeze(Context ctx)
        {
            //Calling ctx.Freeze() prevents adding new properties of any kind.
            //We have no objection for new properties 
            return;
        }

        #region IContributeServerContextSink

        /// <summary>
        /// 返回一个<see cref="MixTransactionSink"/>插入器。
        /// </summary>
        public IMessageSink GetServerContextSink(IMessageSink nextSink)
        {
            return new MixTransactionSink(nextSink, activatorType, mixTransOption);
        }

        #endregion
    }
}

⌨️ 快捷键说明

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