Beispiel #1
0
        public SGInterface WithMethodSignatures(params SGMethodSignature[] methods)
        {
            if (methods == null || methods.Any(x => x == null))
            {
                throw new ArgumentException("Method signatures cannot be null.");
            }

            MethodSignatures.AddRange(methods);
            return(this);
        }
Beispiel #2
0
        public RegistrationInfo(Type serviceInterface)
        {
            Interface = serviceInterface;

            foreach (var mi in serviceInterface.GetMethods())
            {
                var paramTypeString = "";
                var param           = mi.GetParameters();
                paramTypeString = string.Join("-", param.Select(p => p.ParameterType.FullName).ToArray());
                string item = $"{mi.DeclaringType.FullName}.{mi.Name}-{paramTypeString}".ToLower();
                MethodSignatures.Add(item, new MethodMap(item, serviceInterface, mi));
            }
        }
        /// <summary>
        /// Adds an initialized method generator to the factory.
        /// </summary>
        /// <param name="methodGeneratorInstance"></param>
        protected void AddMethodGenerator(BaseHqlGeneratorForMethod methodGeneratorInstance)
        {
            MethodGenerators.Add(methodGeneratorInstance);
            foreach (MethodInfo supportedSignature in methodGeneratorInstance.SupportedMethods)
            {
                if (MethodSignatures.Contains(supportedSignature))
                {
                    throw new Exception(String.Format("Method signature {0} loaded by method hql generator {1} has already been added", supportedSignature, methodGeneratorInstance));
                }

                MethodSignatures.Add(supportedSignature);
            }
        }