<commit_before>using System;
using Castle.DynamicProxy;
using MbCache.Configuration;
using MbCache.Core;
using MbCache.Logic;

namespace MbCache.ProxyImpl.Castle
{
    public class ProxyFactory : IProxyFactory
    {
        private static readonly ProxyGenerator _generator = new ProxyGenerator();
        private ICache _cache;
        private IMbCacheKey _mbCacheKey;

        public void Initialize(ICache cache, IMbCacheKey mbCacheKey)
        {
            _cache = cache;
            _mbCacheKey = mbCacheKey;
        }

        public T CreateProxy<T>(ImplementationAndMethods methodData,
                                params object[] parameters)
        {
            var type = typeof(T);
            var cacheInterceptor = new CacheInterceptor(_cache, _mbCacheKey, type);
            var options = new ProxyGenerationOptions(new CacheProxyGenerationHook(methodData.Methods));
            options.AddMixinInstance(createCachingComponent(type, methodData));
            return (T)_generator.CreateClassProxy(methodData.ConcreteType, options, parameters, cacheInterceptor);

        }

        public bool AllowNonVirtualMember
        {
            get { return true; }
        }

        private ICachingComponent createCachingComponent(Type type, ImplementationAndMethods details)
        {
            return new CachingComponent(_cache, _mbCacheKey, type, details);
        }
    }<commit_msg>dont sign dynamic castle proxy assembly<commit_after>using System;
using Castle.DynamicProxy;
using MbCache.Configuration;
using MbCache.Core;
using MbCache.Logic;

namespace MbCache.ProxyImpl.Castle
{
    public class ProxyFactory : IProxyFactory
    {
        private static readonly ProxyGenerator _generator = new ProxyGenerator(new DefaultProxyBuilder(new ModuleScope(false, true)));
        private ICache _cache;
        private IMbCacheKey _mbCacheKey;

        public void Initialize(ICache cache, IMbCacheKey mbCacheKey)
        {
            _cache = cache;
            _mbCacheKey = mbCacheKey;
        }

        public T CreateProxy<T>(ImplementationAndMethods methodData,
                                params object[] parameters)
        {
            var type = typeof(T);
            var cacheInterceptor = new CacheInterceptor(_cache, _mbCacheKey, type);
            var options = new ProxyGenerationOptions(new CacheProxyGenerationHook(methodData.Methods));
            options.AddMixinInstance(createCachingComponent(type, methodData));
            return (T)_generator.CreateClassProxy(methodData.ConcreteType, options, parameters, cacheInterceptor);

        }

        public bool AllowNonVirtualMember
        {
            get { return true; }
        }

        private ICachingComponent createCachingComponent(Type type, ImplementationAndMethods details)
        {
            return new CachingComponent(_cache, _mbCacheKey, type, details);
        }
    }
{'fraction_non_alphanumeric': 0.06533010715520221, 'fraction_numerical': 0.0, 'mean_word_length': 2.649432534678436, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4900885', 'n_tokens_mistral': 726, 'n_tokens_neox': 702, 'n_words': 178}