private MethodBoxBuilderResult <TBox> BuildMethod(MethodBoxBuilderContext options)
        {
            if (_methodBoxBuilderAction == null)
            {
                throw new Exception("MethodBoxBuilderAction is not defined!");
            }
            var boxkit = new MethodBoxBuilderResult <TBox>();

            _methodBoxBuilderAction(options, boxkit);
            if (boxkit.Ignore)
            {
                return(null);
            }

            return(boxkit);
        }
Exemple #2
0
        internal TBox Add(MethodBoxBuilderResult <TBox> builderResult)
        {
            lock (_dictionaryLock) {
                var sig = builderResult.CustomSearch?.ToString() ?? MethodSearch.FromMethodInfo(builderResult.MethodInfoBox.MethodInfo).ToString();
                if (_methodInfoBoxes.ContainsKey(sig))
                {
                    throw new Exception("A Mehod with same Key already exists!");
                }
                else
                {
                    _methodInfoBoxes.Add(sig, builderResult.MethodInfoBox);
                }


                return(_methodInfoBoxes[sig]);
            }
        }