File tree Expand file tree Collapse file tree 2 files changed +49
-1
lines changed
src/AspectCore.Extensions.Autofac
tests/AspectCore.Extensions.Autofac.Test/Issues Expand file tree Collapse file tree 2 files changed +49
-1
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ public static ContainerBuilder RegisterDynamicProxy(this ContainerBuilder contai
6767 // middleware can be added inside it.
6868 args . ComponentRegistration . PipelineBuilding += ( _ , pipeline ) =>
6969 {
70- pipeline . Use ( ActivationResolveMiddleware . Instance , MiddlewareInsertionMode . StartOfPhase ) ;
70+ pipeline . Use ( ActivationResolveMiddleware . Instance ) ;
7171 } ;
7272 } ;
7373
Original file line number Diff line number Diff line change 1+ using AspectCore . Configuration ;
2+ using AspectCore . Extensions . Autofac ;
3+ using AspectCore . Extensions . Test . Fakes ;
4+ using Autofac ;
5+ using Xunit ;
6+
7+ namespace AspectCoreTest . Autofac . Issues
8+ {
9+ // https://github.com/dotnetcore/AspectCore-Framework/issues/261
10+ public class PropertyInjectorProxyWithVirtualTests
11+ {
12+ public class Foo
13+ {
14+ public Bar Bar { get ; set ; }
15+ [ CacheInterceptor ]
16+ public virtual void Do ( )
17+ {
18+ Bar . Do ( ) ;
19+ }
20+ }
21+
22+ public class Bar
23+ {
24+ public void Do ( )
25+ {
26+ }
27+ }
28+
29+ private ContainerBuilder CreateBuilder ( )
30+ {
31+ return new ContainerBuilder ( ) . RegisterDynamicProxy ( config =>
32+ {
33+ config . Interceptors . AddDelegate ( next => ctx => next ( ctx ) , Predicates . ForNameSpace ( "AspectCore.Extensions.Test.Issues" ) ) ;
34+ } ) ;
35+ }
36+
37+ [ Fact ]
38+ public void PropertyInjectorProxyWithVirtual_Test ( )
39+ {
40+ var builder = CreateBuilder ( ) ;
41+ builder . RegisterType < Bar > ( ) . AsSelf ( ) ;
42+ builder . RegisterType < Foo > ( ) . AsSelf ( ) . PropertiesAutowired ( ) ;
43+ var container = builder . Build ( ) ;
44+ var foo = container . Resolve < Foo > ( ) ;
45+ foo . Do ( ) ;
46+ }
47+ }
48+ }
You can’t perform that action at this time.
0 commit comments