예제 #1
0
        public static IDisposable ConfigScope(ObjectExtensionsConfiguration configuration)
        {
            configuration  = configuration ?? throw new ArgumentNullException(nameof(configuration));
            _configuration = _configuration ?? new Stack <ObjectExtensionsConfiguration>();

            _configuration.Push(configuration);

            return(new CustomDisposable(() => _configuration.Pop()));
        }
예제 #2
0
        public static object Scope <T>(this T ext, ObjectExtensionsConfiguration configuration, Func <T, object> action)
            where T : class
        {
            ext           = ext ?? throw new ArgumentNullException(nameof(ext));
            configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
            action        = action ?? throw new ArgumentNullException(nameof(action));

            using (ConfigScope(configuration))
            {
                return(action(ext));
            }
        }
예제 #3
0
 public N4pperManager(
     N4pperOptions options,
     IQueryProfiler profiler,
     IQueryParamentersMangler paramMangler,
     IRecordHandler recordHandler,
     OMnG.ObjectExtensionsConfiguration objExtConf,
     OMnG.TypeExtensionsConfiguration typeExtConf)
 {
     Options                       = options ?? new N4pperOptions();
     Profiler                      = profiler;
     ParamentersMangler            = paramMangler ?? new DefaultParameterMangler();
     RecordHandler                 = recordHandler ?? new DefaultRecordHanlder();
     ObjectExtensionsConfiguration = objExtConf ?? new N4pper.ObjectExtensionsConfiguration();
     TypeExtensionsConfiguration   = typeExtConf ?? new N4pper.TypeExtensionsConfiguration();
 }