﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using Sofire.Dynamic.Factories;
using Sofire.Dynamic;

namespace Sofire.DataComm.Remoting.Server
{
    /// <summary>
    /// 契约方法信息。
    /// </summary>
    internal class ContractMethodInfo
    {
        /// <summary>
        /// 契约方法的标识。
        /// </summary>
        public readonly int Ident;
        /// <summary>
        /// 契约方法的方法。
        /// </summary>
        public readonly MethodInfo Method;
        /// <summary>
        /// 一组表示参数是否为 ref 或 out 参数的布尔值组。
        /// </summary>
        public readonly bool[] RefParameters;
        /// <summary>
        /// 契约方法的方法的委托。
        /// </summary>
        public readonly DynamicMethodHandler Handler;


        internal ContractMethodInfo(int ident, MethodInfo method, bool[] refParameters, Type serviceType)
        {
            this.Ident = ident;
            this.Method = method;
            this.RefParameters = refParameters;
            this.Handler = DynamicMethodFactory.Instance.Create(method, serviceType);
        }


    }
}
