private void CreateTypeBuilder()
        {
            TypeAttributes newAttributes = _typeToIntercept.Attributes;
            newAttributes = FilterTypeAttributes(newAttributes);

            Type baseClass = GetGenericType(_typeToIntercept);

            ModuleBuilder moduleBuilder = InterceptorClassGenerator.CreateModuleBuilder(AssemblyBuilder);
            _typeBuilder = moduleBuilder.DefineType(
                "DynamicModule.ns.Wrapped_" + _typeToIntercept.Name + "_" + Guid.NewGuid().ToString("N"),
                newAttributes,
                baseClass);

            _mainTypeMapper = DefineGenericArguments(_typeBuilder, baseClass);

            if (_typeToIntercept.IsGenericType)
            {
                var definition = _typeToIntercept.GetGenericTypeDefinition();
                var mappedParameters = definition.GetGenericArguments().Select(t => _mainTypeMapper.Map(t)).ToArray();
                _targetType = definition.MakeGenericType(mappedParameters);
            }
            else
            {
                _targetType = _typeToIntercept;
            }

            _proxyInterceptionPipelineField = InterceptingProxyImplementor.ImplementIInterceptingProxy(_typeBuilder);
        }
        private void CreateTypeBuilder()
        {
            TypeAttributes newAttributes = TypeAttributes.Public | TypeAttributes.Class;

            ModuleBuilder moduleBuilder = InterceptorClassGenerator.CreateModuleBuilder(AssemblyBuilder);

            _typeBuilder = moduleBuilder.DefineType(CreateTypeName(), newAttributes);

            _mainInterfaceMapper = DefineGenericArguments();

            _proxyInterceptionPipelineField = InterceptingProxyImplementor.ImplementIInterceptingProxy(_typeBuilder);
            _targetField      = _typeBuilder.DefineField("target", _typeToIntercept, FieldAttributes.Private);
            _typeToProxyField = _typeBuilder.DefineField("typeToProxy", typeof(Type), FieldAttributes.Private);
        }