File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
src/EntityFrameworkCore.Triggered/Internal Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 11using System ;
2+ using System . Collections . Concurrent ;
23using System . Collections . Generic ;
34using System . Linq ;
45using System . Text ;
@@ -21,6 +22,8 @@ public interface ITriggerInstanceFactory<out TTriggerType> : ITriggerInstanceFac
2122
2223 public sealed class TriggerInstanceFactory < TTriggerType > : ITriggerInstanceFactory < TTriggerType >
2324 {
25+ static ObjectFactory ? _internalFactory ;
26+
2427 object ? _instance ;
2528
2629 public TriggerInstanceFactory ( object ? instance )
@@ -35,9 +38,12 @@ public object Create(IServiceProvider serviceProvider)
3538 return _instance ;
3639 }
3740
38- // todo: create object factory and cache
39- _instance = ActivatorUtilities . CreateInstance ( serviceProvider , typeof ( TTriggerType ) ) ;
41+ if ( _internalFactory is null )
42+ {
43+ _internalFactory = ActivatorUtilities . CreateFactory ( typeof ( TTriggerType ) , Array . Empty < Type > ( ) ) ;
44+ }
4045
46+ _instance = _internalFactory ( serviceProvider , null ) ;
4147 return _instance ;
4248 }
4349 }
You can’t perform that action at this time.
0 commit comments