Wrong interceptor is chosen when multiple bindings exist - ninject

I have multiple implementations of an interface and I want to apply different interceptors for each of them e.g.:
public interface IFoo { int Run(); }
public class Foo1 : IFoo
{
public int Run() { return 1; }
}
public class Foo2 : IFoo
{
public int Run() { return 2; }
}
Example interceptors:
public class MultiplyBy10 : IInterceptor
{
public void Intercept(IInvocation invocation)
{
invocation.Proceed();
invocation.ReturnValue = (int)invocation.ReturnValue * 10;
}
}
public class MultiplyBy100: IInterceptor
{
public void Intercept(IInvocation invocation)
{
invocation.Proceed();
invocation.ReturnValue = (int)invocation.ReturnValue * 100;
}
}
Binding:
var kernel = new StandardKernel();
kernel.Bind<IFoo>().To<Foo1>().Named("1");
kernel.Bind<IFoo>().To<Foo2>().Named("2");
kernel.Intercept(ctx => ctx.Plan.Type == typeof(Foo1)).With<MultiplyBy10>();
kernel.Intercept(ctx => ctx.Plan.Type == typeof(Foo2)).With<MultiplyBy100>();
I expect Foo1 to be multiplied by 10 and Foo2 by 100. But instead both are multiplied by 10 i.e.:
var foo1 = kernel.Get<IFoo>(ctx => ctx.Name == "1");
var foo2 = kernel.Get<IFoo>(ctx => ctx.Name == "2");
Assert.That(foo1.Run(), Is.EqualTo(10));
// fails: returns 20
Assert.That(foo2.Run(), Is.EqualTo(200));
Is this a bug or am I doing something wrong?

It was a bug. It's now fixed on master: https://github.com/ninject/ninject.extensions.interception/commit/fb5ca07c287e4c61f630e8da7ba6fd827ce6be85

Related

How might I construct a non-default constructor model from a query string in ASP.Net Core?

I would like to construct an object that has a non-default constructor from query string parameters in ASP.Net Core. In essence, I have two models that have a common ancestor class with different parameterizations. Based on some conditions in an API endpoint, one model will be constructed with parameters from the query string.
[HttpGet("{model}")]
public ModelBase Get(string model)
{
switch (model)
{
case "foo":
ModelFoo foo = GetModelFromQueryString<ModelFoo>();
return foo;
case "bar":
ModelBar bar = GetModelFromQueryString<ModelBar>();
return bar;
}
return null;
}
GetModelFromQueryString<TModel> is obviously the magical function that I wish I knew existed. If it already exists or someone could help provide implementation details, that would answer my question.
The example model classes would be like the following:
class ModelFoo : ModelBase
{
public ModelFoo(int param1=1, int param2=2)
{
// ...
}
}
class ModelBar : ModelBase
{
public ModelBar(int paramBaz=3)
{
// ...
}
}
This would ideally make the following HTTP calls yield the desired results:
GET api/foo?param1=7&param2=9 yields new ModelFoo(param1:7, param2:9).
GET api/bar?paramBaz=42 yields new ModelBar(paramBaz:42).
GET api/foo yields new ModelFoo(param1:1, param2:2).
GET api/foo?param2=11 yields new ModelFoo(param1:1, param2:11).
How might I go about this? Should I restructure entirely?
I realize that this may be a bit of a complicated, multi-faceted question so any and all help is much appreciated!
You can try to use my working demo.
Class:
public class ModelBase
{
}
class ModelFoo : ModelBase
{
public int param1 { get; set; }
public int param2 { get; set; }
public ModelFoo(int param1 = 1, int param2 = 2)
{
this.param1 = param1;
this.param2 = param2;
}
}
class ModelBar : ModelBase
{
public int paramBaz { get; set; }
public ModelBar(int paramBaz = 3)
{
this.paramBaz = paramBaz;
}
}
Action:
[HttpGet("{model}")]
public ModelBase Get(string model,int param1,int param2,int paramBaz)
{
switch (model)
{
case "foo":
if(param1!=0 ^ param2!=0)
{
if(param1 != 0)
{
ModelFoo foo1 = new ModelFoo
{
param1 = param1,
};
return foo1;
}
if (param2 != 0)
{
ModelFoo foo2 = new ModelFoo
{
param2 = param2,
};
return foo2;
}
}
if (param1 == 0 && param2 == 0)
{
ModelFoo foo3 = new ModelFoo();
return foo3;
}
ModelFoo foo4 = new ModelFoo
{
param1 = param1,
param2 = param2,
};
return foo4;
case "bar":
if (paramBaz != 0)
{
ModelBar bar = new ModelBar
{
paramBaz = paramBaz,
};
return bar;
}
ModelBar bar1 = new ModelBar();
return bar1;
}
return null;
}
Not really a direct answer to your question, but the needed building blocks are already available.
Newtonsoft JSON.net supports creating types if the constructor parameter matches the property names and also supports creating instances of an interface if the concrete type is set within a $type property:
public static class Program
{
public static async Task<int> Main(string[] args)
{
var sourceList = new List<IModel> { new ModelFoo(3, 7), new ModelBar(11) };
var jsonList = JsonConvert.SerializeObject(sourceList, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Auto });
var list = JsonConvert.DeserializeObject<List<IModel>>(jsonList, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Auto });
return 0;
}
}
public interface IModel { }
public class ModelFoo : IModel
{
public ModelFoo(int first, int second)
{
First = first;
Second = second;
}
public int First { get; }
public int Second { get; }
}
public class ModelBar : IModel
{
public ModelBar(int third)
{
Third = third;
}
public int Third { get; }
}

closed generic type registration - Autofac – cannot resolve parameter x of constructor

I am getting the following exception:
"None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'NetCore.DAL.EF.Repositories.Core.Common.SystemSettingRepository' can be invoked with the available services and parameters:\r\nCannot resolve parameter 'NetCore.DAL.EF.DatabaseFactory1[NetCore.DAL.EF.AppDbContext] databaseFactory' of constructor 'Void .ctor(NetCore.DAL.EF.DatabaseFactory1[NetCore.DAL.EF.AppDbContext])'."
Here is the Autofac registration info for SystemSettingRepository:
autofacServiceProvider.Non-Public members._lifetimeScope.ComponentRegistry.Registrations[28] = {Activator = SystemSettingRepository (ReflectionActivator), Services = [Dcs.NetCore.ApplicationCore.BLL.Domain.Features.Common.SystemSettings.ISystemSettingRepository, Dcs.NetCore.Infrastructure.Common.IRepository`1[[Dcs.NetCore.ApplicationCore.BLL.Domain.Entities.Common.SystemSetting, Dcs.NetCore.ApplicationCore.BLL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], NetCore.DAL.EF.Repositories.Core.Common.SystemSettingRepository], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope}
autofacServiceProvider.Non-Public members._lifetimeScope.ComponentRegistry.Registrations[28].Target.Services[0].ServiceType = {Dcs.NetCore.ApplicationCore.BLL.Domain.Features.Common.SystemSettings.ISystemSettingRepository}
autofacServiceProvider.Non-Public members._lifetimeScope.ComponentRegistry.Registrations[28].Target.Services[1].ServiceType = {Dcs.NetCore.Infrastructure.Common.IRepository`1[Dcs.NetCore.ApplicationCore.BLL.Domain.Entities.Common.SystemSetting]}
autofacServiceProvider.Non-Public members._lifetimeScope.ComponentRegistry.Registrations[28].Target.Services[2].ServiceType = {NetCore.DAL.EF.Repositories.Core.Common.SystemSettingRepository}
As you can see, the services are registered. However, the databaseFactory parameter is not. Here is my code:
public class Startup
{
…
public IServiceProvider ConfigureServices(IServiceCollection services)
{
…
return AutofacBuilder();
}
private AutofacServiceProvider AutofacBuilder()
{
var builder = new ContainerBuilder();
builder.RegisterModule<AutofacModule_AspNetCore>();
builder.Populate(_services);
this.AutofacContainer = builder.Build();
var autofacServiceProvider = new AutofacServiceProvider(this.AutofacContainer);
return autofacServiceProvider;
}
}
public class AutofacModule_AspNetCore : Autofac.Module
{
protected override void Load(ContainerBuilder builder)
{
RegisterDbContexts();
RegisterComponents();
}
private void RegisterComponents()
{
_builder.RegisterGeneric(typeof(DatabaseFactory<>))
.As(typeof(IDatabaseFactory<>))
.InstancePerDependency();
_builder.RegisterAssemblyTypes(_assembly)
.AsClosedTypesOf(typeof(IRepository<>))
.WithParameter(new ResolvedParameter((p, i) => p.Name == "databaseFactory",
(p, i) => i.Resolve<DatabaseFactory<AppDbContext>>()))
//.WithParameter("databaseFactory", new DatabaseFactory<AppDbContext>())
//.WithParameter(ResolvedParameter//.ForNamed<IDbContext>("coreDomainDbContext"));
//.WithParameter("databaseFactory", )
.InstancePerDependency();
}
private void RegisterDbContexts()
{
RegisterAppDbContextInstance();
}
private void RegisterAppDbContextInstance()
{
// register DbContextOptionsBuilderHelper
_builder.RegisterType<AppDbContextOptionsBuilderHelper>()
.InstancePerDependency();
// configure DbContextOptions
var dbContextOptionsBuilderHelper = new AppDbContextOptionsBuilderHelper();
var dbContextOptionsBuilder = dbContextOptionsBuilderHelper.GetDbContextOptionsBuilder();
// register DbContext
_builder.RegisterType<AppDbContext>()
.WithParameter("options", dbContextOptionsBuilder.Options)
.InstancePerDependency();
}
}
public class DatabaseFactory<T> : Disposable, IDatabaseFactory<T>
where T : DbContext //, new()
{
private T _dbContext;
private AppDbContextOptionsBuilderHelper _appDbContextOptionsBuilderHelper;
private DefaultDbContextOptionsBuilderHelper _defaultDbContextOptionsBuilderHelper;
public DatabaseFactory()
{
this._appDbContextOptionsBuilderHelper = new AppDbContextOptionsBuilderHelper(); // TODO: refactor to ctor injection
this._defaultDbContextOptionsBuilderHelper = new DefaultDbContextOptionsBuilderHelper(); // TODO: refactor to ctor injection
}
public T Get()
{
if (_dbContext == null)
Create();
return _dbContext;
}
private void Create()
{
switch (typeof(T).Name)
{
case "AppDbContext":
{
CreateAppDbContext();
break;
}
case "DefaultDbContext":
{
CreateDefaultDbContext();
break;
}
}
}
private void CreateAppDbContext()
{
var dbContextOptionsBuilder = _appDbContextOptionsBuilderHelper.GetDbContextOptionsBuilder();
this._dbContext = new AppDbContext(dbContextOptionsBuilder.Options) as T;
}
//protected override void DisposeCore()
//{
//
// cref: Autofac.Util.Disposable
//
// //TODO: should I override Autofac.Util.Disposable here?
// var msg = "DatabaseFactory.DisposeCore() executing";
// if (_dbContext != null)
// _dbContext.Dispose();
//}
}
public partial class AppDbContext : DbContext
{
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
{ }
public AppDbContext()
{}
}
public class SystemSettingRepository : RepositoryBase<SystemSetting, AppDbContext>, ISystemSettingRepository
{
public SystemSettingRepository(DatabaseFactory<AppDbContext> databaseFactory)
: base(databaseFactory)
{ }
}
public interface ISystemSettingRepository : IRepository<SystemSetting>
{}
public partial interface IRepository<T> where T : class
{}
public abstract class RepositoryBase<T, U> : IRepositoryBase<T, U>
where T : class
where U : DbContext //, new()
{
private U _dbContext;
private readonly DbSet<T> _dbset;
protected RepositoryBase(DatabaseFactory<U> databaseFactory)
{
DatabaseFactory = databaseFactory;
_dbset = DataContext.Set<T>();
}
protected virtual DatabaseFactory<U> DatabaseFactory
{
get;
private set;
}
protected virtual U DataContext
{
get { return _dbContext = DatabaseFactory.Get(); }
}
public virtual async Task<T> AddAsync(T dao)
{
EntityEntry<T> entityEntry = _dbset.Add(dao);
var result = await SaveChangesAsync();
if (result > 0 && entityEntry != null && entityEntry.Entity != null)
return entityEntry.Entity;
else
return null;
}
}
public interface IRepositoryBase<T, U>
where T : class
where U : DbContext //, new()
{ }
The issue is caused by the way of registration of DatabaseFactory<>. This type is registered as an interface IDatabaseFactory<>. But it is resolved as itself in lambda argument of method WithParameter() on registration of repositories:
_builder.RegisterAssemblyTypes(_assembly)
.AsClosedTypesOf(typeof(IRepository<>))
.WithParameter(new ResolvedParameter((p, i) => p.Name == "databaseFactory",
// resolving type it self
// while it was registered as interface
(p, i) => i.Resolve<DatabaseFactory<AppDbContext>>()))
Autofac doesn't know how to resolve it, because it doesn't have corresponding registration. To make your code work you can resolve DatabaseFactory as an inteface like this:
.WithParameter(new ResolvedParameter((p, i) => p.Name == "databaseFactory",
(p, i) => i.Resolve<IDatabaseFactory<AppDbContext>>()))
Or add AsSelf() call to registration:
_builder.RegisterGeneric(typeof(DatabaseFactory<>))
.As(typeof(IDatabaseFactory<>))
// Register also as DatabaseFactory<>
.AsSelf()
.InstancePerDependency();

NSubstitute: Arg.Do does not fulfill the list of called parameters

For the code bellow I get this assert failure and do not know why:
Assert.AreEqual failed. Expected:<2>. Actual:<0>.
public interface IA
{
void MethodA(B b);
}
public class A : IA
{
public void MethodA(B b) {/*no matter*/}
}
public class B
{
public string PropertyB { get; set; }
}
public class MyLogic
{
private IA _a;
public MyLogic(IA a)
{
_a = a;
}
public void DoLogic()
{
_a.MethodA(new B { PropertyB = "first" });
_a.MethodA(new B { PropertyB = "second" });
}
}
[TestClass]
public class MyLogicTests
{
[TestMethod]
public void CallTwiceAndCheckTheParams()
{
List<B> args = new List<B>();
IA a = Substitute.For<IA>();
new MyLogic(a).DoLogic();
a.Received(2).MethodA(Arg.Do<B>(x => args.Add(x)));
Assert.AreEqual(2, args.Count);
}
}
The code is setting up an action to perform (Arg.Do) after the calls have already been made. I think this is what you are after:
List<B> args = new List<B>();
IA a = Substitute.For<IA>();
a.MethodA(Arg.Do<B>(x => args.Add(x))); // do this whenever MethodA is called
new MyLogic(a).DoLogic();
a.Received(2).MethodA(Arg.Any<B>());
Assert.AreEqual(2, args.Count);

Cannot extend unmapped class: Entity

I have a base class called Entity:
public class Entity
{
public int Id {get;set;}
}
Let's say I have a class called Customer:
public class Customer : Entity
{
public string Name {get;set;}
}
Now, using convention based mapping by code in NHibernate 3.3.1, I try the following:
public static class DataHelper
{
private static HbmMapping GetMappings()
{
var mapper = new CustomModelMapper(typeof(Entity));
return mapper.CompileMappingFor(
typeof(DataHelper).Assembly.GetExportedTypes()
.Where(x => x.IsSubclassOf(typeof(Entity))));
}
}
When I try to run my app, I get the error "Cannot extend unmapped class: Entity". I don't want to map the Entity class - it's just a base class for inheriting some common properties. How can I tell NHibernate to ignore the unmapped class? For reference, my CustomModelMapper class is listed below.
The code for my CustomModelMapper class is listed below for reference
internal class CustomModelMapper : ConventionModelMapper
{
private const int DEFAULT_STRING_LENGTH = 100;
private Type baseType;
public CustomModelMapper(Type baseType)
{
this.baseType = baseType;
}
public CustomModelMapper()
{
SetupInspectors();
}
protected override void AppendDefaultEvents()
{
base.AppendDefaultEvents();
BeforeMapClass += OnBeforeMapClass;
BeforeMapProperty += OnBeforeMapProperty;
BeforeMapManyToOne += OnBeforeMapManyToOne;
BeforeMapBag += OnBeforeMapBag;
BeforeMapList += OnBeforeMapList;
BeforeMapSet += OnBeforeMapSet;
}
protected void OnBeforeMapClass(IModelInspector modelInspector, Type type, IClassAttributesMapper classCustomizer)
{
classCustomizer.Id(type.GetProperty("Id"), m => m.Generator(Generators.Native));
}
protected void OnBeforeMapProperty(IModelInspector modelInspector, PropertyPath member, IPropertyMapper propertyCustomizer)
{
if (member.LocalMember.GetPropertyOrFieldType().IsEnum)
{
var type = member.LocalMember.GetPropertyOrFieldType();
var genericType = typeof(EnumStringType<>).MakeGenericType(type);
propertyCustomizer.Type(genericType, null);
}
if (member.LocalMember.GetPropertyOrFieldType() == typeof(string))
propertyCustomizer.Length(DEFAULT_STRING_LENGTH);
}
protected void OnBeforeMapManyToOne(IModelInspector modelInspector, PropertyPath member, IManyToOneMapper propertyCustomizer)
{
propertyCustomizer.Cascade(Cascade.All);
propertyCustomizer.Fetch(FetchKind.Join);
propertyCustomizer.Lazy(LazyRelation.NoLazy);
propertyCustomizer.Index(string.Format("IX{0}{1}",
member.GetContainerEntity(modelInspector).Name,
member.LocalMember.Name));
}
protected void OnBeforeMapBag(IModelInspector modelInspector, PropertyPath member, IBagPropertiesMapper propertyCustomizer)
{
propertyCustomizer.Cascade(Cascade.All);
propertyCustomizer.Lazy(CollectionLazy.Extra);
propertyCustomizer.Fetch(CollectionFetchMode.Subselect);
}
protected void OnBeforeMapList(IModelInspector modelInspector, PropertyPath member, IListPropertiesMapper propertyCustomizer)
{
propertyCustomizer.Cascade(Cascade.All);
propertyCustomizer.Lazy(CollectionLazy.Extra);
propertyCustomizer.Fetch(CollectionFetchMode.Subselect);
}
protected void OnBeforeMapSet(IModelInspector modelInspector, PropertyPath member, ISetPropertiesMapper propertyCustomizer)
{
propertyCustomizer.Cascade(Cascade.All);
propertyCustomizer.Lazy(CollectionLazy.Extra);
propertyCustomizer.Fetch(CollectionFetchMode.Subselect);
}
protected void SetupInspectors()
{
IsRootEntity((type, declared) =>
{
return baseType.Equals(type.BaseType);
});
IsEntity((type, declared) =>
{
return baseType.IsAssignableFrom(type) && !type.IsInterface;
});
IsVersion((member, declared) =>
{
return
member.Name == "Version" &&
member.MemberType == MemberTypes.Property &&
member.GetPropertyOrFieldType() == typeof(int);
});
IsBag((member, declared) =>
{
if (member.GetPropertyOrFieldType().IsGenericType)
return IsGenericType(member, typeof(ICollection<>));
return false;
});
IsList((member, declared) =>
{
if (member.GetPropertyOrFieldType().IsGenericType)
return IsGenericType(member, typeof(IList<>));
return false;
});
IsSet((member, declared) =>
{
if (member.GetPropertyOrFieldType().IsGenericType)
return IsGenericType(member, typeof(ICG.ISet<>));
return false;
});
}
protected static bool IsGenericType(MemberInfo member, Type targetType)
{
var type = member.GetPropertyOrFieldType();
var generics = type.GetGenericInterfaceTypeDefinitions();
return generics.Contains(targetType);
}
}
The problem is probably with your IsEntity convention. Currently, it will return true for Entity class itself. Just add another check:
IsEntity((type, declared) =>
{
return baseType.IsAssignableFrom(type) && !type.IsInterface &&
type != typeof(Entity); // <- skip Entity class
});
Edit
Also, you have two constructors in your CustomModelMapper class. One of them accepts base type, the other one is default and calls SetupInspectors(). As I can see, your default constructor will never be called, since you are calling the one that accepts the base type, and it doesn't call the default constructor...
And the consequence of that is... your SetupInspectors() method will also never be called.

Ninject Intercept any method with certain attribute?

How can I get Ninject.Extensions.Interception to basically let me bind a specific interceptor to any method that has an attribute... psudocode:
Kernel.Intercept(context => context.Binding.HasAttribute<TransactionAttribute>())
.With<TransactionInterceptor>
With a class like:
public SomeClass
{
[TransactionAttribute]
public void SomeTransactedMethod()
{ /*do stuff */ }
}
Assuming that you are using Ninject.Extensions.Interception this should do the trick
public class TransactionInterceptor : IInterceptor
{
public void Intercept(IInvocation invocation)
{
// Do something...
}
}
public class TransactionAttribute : InterceptAttribute
{
public override IInterceptor CreateInterceptor(IProxyRequest request)
{
return new TransactionInterceptor();
}
}
public class SomeClass
{
[Transaction]
public virtual void SomeTransactedMethod() { }
}
Make sure that the method that should be intercepted is marked as virtual.
When SomeTransactedMethod() is called it should be intercepted.
var kernel = new StandardKernel();
kernel.Bind<SomeClass>().ToSelf();
var someClass = kernel.Get<SomeClass>();
someClass.SomeTransactedMethod();
UPDATE
You could create a custom planning strategy.
public class CustomPlanningStrategy<TAttribute, TInterceptor> :
NinjectComponent, IPlanningStrategy
where TAttribute : Attribute
where TInterceptor : IInterceptor
{
private readonly IAdviceFactory adviceFactory;
private readonly IAdviceRegistry adviceRegistry;
public CustomPlanningStrategy(
IAdviceFactory adviceFactory, IAdviceRegistry adviceRegistry)
{
this.adviceFactory = adviceFactory;
this.adviceRegistry = adviceRegistry;
}
public void Execute(IPlan plan)
{
var methods = GetCandidateMethods(plan.Type);
foreach (var method in methods)
{
var attributes = method.GetCustomAttributes(
typeof(TAttribute), true) as TAttribute[];
if (attributes.Length == 0)
{
continue;
}
var advice = adviceFactory.Create(method);
advice.Callback = request => request.Kernel.Get<TInterceptor>();
adviceRegistry.Register(advice);
if (!plan.Has<ProxyDirective>())
{
plan.Add(new ProxyDirective());
}
}
}
}
private static IEnumerable<MethodInfo> GetCandidateMethods(Type type)
{
var methods = type.GetMethods(
BindingFlags.Public |
BindingFlags.NonPublic |
BindingFlags.Instance
);
return methods.Where(ShouldIntercept);
}
private static bool ShouldIntercept(MethodInfo methodInfo)
{
return methodInfo.DeclaringType != typeof(object) &&
!methodInfo.IsPrivate &&
!methodInfo.IsFinal;
}
}
This should now work.
var kernel = new StandardKernel();
kernel.Components.Add<IPlanningStrategy,
CustomPlanningStrategy<TransactionAttribute, TransactionInterceptor>>();
kernel.Bind<SomeClass>().ToSelf();
var someClass = kernel.Get<SomeClass>();
someClass.SomeTransactedMethod();
Here is the code that I used for the same purpose
//Code in Bind Module
this.Bind(typeof(ServiceBase<,>))
.ToSelf()
.InRequestScope()
.Intercept()
.With<TransactionInterceptor>();
And
public class TransactionInterceptor : IInterceptor
{
#region Constants and Fields
public ISession session;
private ISessionFactory sessionFactory;
#endregion
#region Constructors and Destructors
public TransactionInterceptor(ISession session, ISessionFactory sessionFactory)
{
this.sessionFactory = sessionFactory;
this.session = session;
}
#endregion
public void Intercept(IInvocation invocation)
{
try
{
if (!session.IsConnected)
session = sessionFactory.OpenSession();
session.BeginTransaction();
invocation.Proceed();
if (this.session == null)
{
return;
}
if (!this.session.Transaction.IsActive)
{
return;
}
else
{
this.session.Transaction.Commit();
}
}
catch (Exception)
{
if (this.session == null)
{
return;
}
if (!this.session.Transaction.IsActive)
{
return;
}
this.session.Transaction.Rollback();
throw;
}
}
}
And code for TransactionAttribute
public class TransactionAttribute : InterceptAttribute
{
#region Public Methods
public override IInterceptor CreateInterceptor(IProxyRequest request)
{
return request.Context.Kernel.Get<TransactionInterceptor>() ;
}
#endregion
}