Ejemplo n.º 1
0
 public TestDescription(
     Type remotedInterfaceType,
     string remotedInterfaceKindName     = "actor",
     bool useCRCIdGeneration             = false,
     MethodReturnCheck methodReturnCheck = MethodReturnCheck.EnsureReturnsTask)
     : base(remotedInterfaceKindName, remotedInterfaceType, useCRCIdGeneration, methodReturnCheck)
 {
 }
Ejemplo n.º 2
0
        private static MethodDescription[] GetMethodDescriptions(
            string remotedInterfaceKindName,
            Type remotedInterfaceType,
            MethodReturnCheck methodReturnCheck)
        {
            EnsureValidMethods(remotedInterfaceKindName, remotedInterfaceType, methodReturnCheck);
            var methods = remotedInterfaceType.GetMethods().Select(
                methodInfo => MethodDescription.Create(remotedInterfaceKindName, methodInfo)).ToList();

            return(methods.ToArray());
        }
Ejemplo n.º 3
0
        protected InterfaceDescription(
            string remotedInterfaceKindName,
            Type remotedInterfaceType,
            MethodReturnCheck methodReturnCheck = MethodReturnCheck.EnsureReturnsTask)
        {
            EnsureNotGeneric(remotedInterfaceKindName, remotedInterfaceType);

            this.remotedInterfaceType = remotedInterfaceType;
            this.interfaceId          = IdUtil.ComputeId(remotedInterfaceType);
            this.methods = GetMethodDescriptions(remotedInterfaceKindName, remotedInterfaceType, methodReturnCheck);
        }
        private static MethodDescription[] GetMethodDescriptions(
            string remotedInterfaceKindName,
            Type remotedInterfaceType,
            MethodReturnCheck methodReturnCheck)
        {
            EnsureValidMethods(remotedInterfaceKindName, remotedInterfaceType, methodReturnCheck);
            var methods            = remotedInterfaceType.GetMethods();
            var methodDescriptions = new MethodDescription[methods.Length];

            for (int i = 0; i < methods.Length; i++)
            {
                methodDescriptions[i] = MethodDescription.Create(remotedInterfaceKindName, methods[i]);
            }
            return(methodDescriptions);
        }
Ejemplo n.º 5
0
        protected InterfaceDescription(
            string remotedInterfaceKindName,
            Type remotedInterfaceType,
            bool useCRCIdGeneration,
            MethodReturnCheck methodReturnCheck = MethodReturnCheck.EnsureReturnsTask)
        {
            EnsureNotGeneric(remotedInterfaceKindName, remotedInterfaceType);

            this.remotedInterfaceType = remotedInterfaceType;
            this.useCRCIdGeneration   = useCRCIdGeneration;
            if (this.useCRCIdGeneration)
            {
                this.interfaceId = IdUtil.ComputeIdWithCRC(remotedInterfaceType);
                //This is needed for backward compatibility support to V1 Stack like ActorEventproxy
                this.interfaceIdV1 = IdUtil.ComputeId(remotedInterfaceType);
            }
            else
            {
                this.interfaceId = IdUtil.ComputeId(remotedInterfaceType);
            }

            this.methods = GetMethodDescriptions(remotedInterfaceKindName, remotedInterfaceType, methodReturnCheck, useCRCIdGeneration);
        }
Ejemplo n.º 6
0
        private static void EnsureValidMethods(
            string remotedInterfaceKindName,
            Type remotedInterfaceType,
            MethodReturnCheck methodReturnCheck)
        {
            var methodNameSet = new HashSet <string>();

            foreach (var m in remotedInterfaceType.GetMethods())
            {
                EnsureNotOverloaded(remotedInterfaceKindName, remotedInterfaceType, m, methodNameSet);
                EnsureNotGeneric(remotedInterfaceKindName, remotedInterfaceType, m);
                EnsureNotVariableArgs(remotedInterfaceKindName, remotedInterfaceType, m);

                if (methodReturnCheck == MethodReturnCheck.EnsureReturnsTask)
                {
                    EnsureReturnsTask(remotedInterfaceKindName, remotedInterfaceType, m);
                }

                if (methodReturnCheck == MethodReturnCheck.EnsureReturnsVoid)
                {
                    EnsureReturnsVoid(remotedInterfaceKindName, remotedInterfaceType, m);
                }
            }
        }