public static void RegisterHttpClientWithSingleSource(this IBindableIocService ioc)
 {
     ioc.Bind <HttpMessageHandler>().To <HttpClientHandler>()
     .DoNotDispose()
     .WhenConstructingType <DoNotDisposeHttpMessageHandler>();
     ioc.Bind <HttpMessageHandler>().To <DoNotDisposeHttpMessageHandler>()
     .AsSingleton()
     .DisposeIfInsideScope()
     .BlockSelfInjection();
     ioc.Bind <HttpClient>().ToSelf().WithParameters(false);
 }
예제 #2
0
 private void RegisterTabletServer(IBindableIocService service)
 {
     service.Bind <BinaryObjectDictionary>().To <SimObjectDictionary>().AsSingleton();
     service.Bind <IBinaryObjectPipeReader>().To <BinaryObjectPipeReader>(
         i => i.WithArgumentTypes <PipeReader, BinaryObjectDictionary>());
     service.Bind <IBinaryObjectPipeWriter>().To <BinaryObjectPipeWriter>(
         i => i.WithArgumentTypes <PipeWriter, BinaryObjectDictionary>());
     service.Bind <Func <PipeReader, PipeWriter, INetworkVariableServer> >()
     .ToMethod(CreateNetworkVariableServer);
     service.Bind <IDirectory>().ToConstant(
         new FileSystemDirectory($@"{AppDomain.CurrentDomain.BaseDirectory}\WASM\wwwroot"))
     .WhenConstructingType <LocalFileMapper>();
 }
예제 #3
0
        protected override void RegisterWithIocContainer(IBindableIocService service)
        {
            service.AddLogging();
            // window selectors
            service.Bind <IFileViewerFactory>().To <NugetManagerViewModelFactory>();
            service.Bind <IFileViewerFactory>().To <SecretManagerViewModelFactory>();

            // Root Window
            service.Bind <INavigationWindow>().To <NavigationWindow>().AsSingleton();
            service.Bind <RootNavigationWindow>().And <Window>().And <IRootNavigationWindow>()
            .ToSelf().FixResult(SetIcon).AsSingleton();
            service.RegisterHomeViewModel <FileLoadViewModel>();

            // System Services
            service.Bind <IStartupData>().To <StartupData>()
            .WithParameters(new object[] { CommandLineParameters })
            .AsSingleton();
            service.Bind <IOpenSaveFile>().To <OpenSaveFileAdapter>();
        }
예제 #4
0
        protected override void RegisterWithIocContainer(IBindableIocService service)
        {
            service.AddLogging();
            service.Bind <SamplesTreeViewModel>().ToSelf().AsSingleton();
            service.RegisterHomeViewModel <SamplesTreeViewModel>();
            service.Bind <IRootNavigationWindow>()
            .And <Window>()
            .To <RootNavigationWindow>()
            .AsSingleton();
            service.Bind <DisposableDependency>().ToSelf().AsScoped();
            service.Bind <IWindowMessageSource>().To <WindowMessageSource>().AsSingleton();

            // pedal reader
            service.Bind <IMonitorForDeviceArrival>().To <MonitorForDeviceArrival>()
            .AsSingleton().DoNotDispose();
            service.Bind <ITranscriptonPedal>().To <TranscriptonPedal>()
            .DoNotDispose();
            service.Bind <IDetectThumbDrive>().To <DetectThumbDrive>().AsSingleton().DoNotDispose();
        }
예제 #5
0
 public static void Intercept <T>(this IBindableIocService service, Func <T, T> conversion) =>
 service.Intercept(new InterceptFromFunc <T, T>(conversion));
예제 #6
0
        public ChildContainer(IBindableIocService parent)
        {
            var paretCache = parent.ConfigurePolicy <CachedResolutionPolicy>();

            ConfigurePolicy <ISetBackupCache>().SetBackupCache(paretCache);
        }
예제 #7
0
 public static void Intercept(this IBindableIocService service, IInterceptionRule rule) =>
 service.InterceptionPolicy.Add(rule);
예제 #8
0
        public static IActivationOptions <IConfigurationRoot> AddConfigurationSources(this IBindableIocService service, Action <IConfigurationBuilder> build)
        {
            var builder = new ConfigurationBuilder();

            build(builder);
            return(service.Bind <IConfigurationRoot>().ToConstant(builder.Build()).DisposeIfInsideScope());
        }
예제 #9
0
 private static void BindOpenGeneric(IBindableIocService container, ServiceDescriptor service)
 {
     container.BindGeneric(service.ServiceType,
                           service.ImplementationType, ConstructorSelectors.EmulateDotNet, i => SetLifetime(i, service));
 }
 public static void Intercept <TSource, TDest>(this IBindableIocService service,
                                               params IInterceptor[] interceptors) where TSource : TDest =>
 service.Intercept(new SingletonInterceptorRule <TSource, TDest>(interceptors));
예제 #11
0
 protected override void RegisterWithIocContainer(IBindableIocService service)
 {
     SetupConfiguration(service);
     SetupPipeListener(service);
     SetupMainWindowContent(service);
 }
예제 #12
0
 public static void InterceptSpecificType <TTypeToIntercept, TRequestedType>(this IBindableIocService service,
                                                                             Func <TTypeToIntercept, TRequestedType> conversion) where TTypeToIntercept : TRequestedType =>
 service.Intercept(new InterceptFromFunc <TTypeToIntercept, TRequestedType>(conversion));
 public static void Intercept <T>(this IBindableIocService service,
                                  params IInterceptor[] interceptors) =>
 service.Intercept(new SingletonInterceptorRule <T, T>(interceptors));
 public static IActivationOptions <IHomeViewModelFactory> RegisterHomeViewModel(
     this IBindableIocService ioc, Func <IIocService, object?> creator)
 {
     return(ioc.Bind <IHomeViewModelFactory>()
            .ToConstant(new HomeViewModelFactoryNonDefaultImplementation(creator)));
 }
 public static IActivationOptions <IHomeViewModelFactory> RegisterHomeViewModel <T>(
     this IBindableIocService ioc) => ioc.RegisterHomeViewModel(i => i.Get <T>());
예제 #16
0
 public Startup(IBindableIocService ioc, IWebAssemblyHostEnvironment hostEnvironment)
 {
     this.ioc             = ioc;
     this.hostEnvironment = hostEnvironment;
 }
예제 #17
0
 private static void RegisterAirportDatabase(IBindableIocService service)
 {
     service.Bind <Func <AirportDbContext> >().ToConstant(AirportContext());
     service.Bind <IAirportRepository>().To <AirportSqlRepository>();
 }
예제 #18
0
 private static void RegisterHardware(IBindableIocService service)
 {
     service.Bind <IYokeConnection>().To <YokeConnection>().AsSingleton();
     service.Bind <IMonitorForDeviceArrival>().To <MonitorForDeviceArrival>().DisposeIfInsideScope();
 }
예제 #19
0
 public DisposableChildContainer(IBindableIocService parent) : base(parent)
 {
 }
 public static IActivationOptions <AsyncFunctionFactoryImplementation <T> > BindAsyncFactory <T>(this IBindableIocService service) =>
 service.Bind <AsyncFunctionFactoryImplementation <T> >().ToSelf();
 public static void Intercept <T>(this IBindableIocService service,
                                  Action <IInterceptorTypeDeclaration> types) =>
 service.Intercept(new TypedInterceptionRule <T, T>(types));
예제 #22
0
 private static IPickBindingTargetSource ClosedTypeBindings <T>(IBindableIocService service) =>
 service.ConfigurePolicy <IPickBindingTargetSource>();
 public static void Intercept <TSource, TDest>(this IBindableIocService service,
                                               Action <IInterceptorTypeDeclaration> types) where TSource : TDest =>
 service.Intercept(new TypedInterceptionRule <TSource, TDest>(types));
예제 #24
0
 public static IPickBindingTarget <T> BindIfMNeeded <T>(this IBindableIocService service) =>
 ClosedTypeBindings <T>(service).Bind <T>(true);
예제 #25
0
 protected abstract void RegisterWithIocContainer(IBindableIocService service);
예제 #26
0
 public static void BindGenericIfNeeded(this IBindableIocService services, Type source, Type destination,
                                        Action <ITypesafeActivationOptions <object> >?options = null) =>
 BindGenericIfNeeded(services, source, destination, ConstructorSelectors.MaximumArgumentCount, options);
예제 #27
0
 protected override void RegisterWithIocContainer(IBindableIocService service)
 {
     service.RegisterHomeViewModel <HomeViewModel>();
 }
예제 #28
0
 public static void BindGenericIfNeeded(this IBindableIocService services, Type source, Type destination,
                                        Func <IList <ConstructorInfo>, ConstructorInfo> constructorSelector,
                                        Action <ITypesafeActivationOptions <object> >?options = null) =>
 BindGenericIfNeeded(services, source, destination, i => constructorSelector(i).AsActivationStrategy(), options);
예제 #29
0
 private static IPickBindingTarget <object> CreateBindingTarget(IBindableIocService container, ServiceDescriptor service)
 {
     return(container.ConfigurePolicy <IPickBindingTargetSource>()
            .Bind(service.ServiceType, false));
 }
예제 #30
0
 public static void BindGenericIfNeeded(this IBindableIocService services, Type source, Type destination,
                                        Func <IList <ConstructorInfo>, IActivationStrategy> constructorSelector,
                                        Action <ITypesafeActivationOptions <object> >?options = null) =>
 services.ConfigurePolicy <IRegisterGeneric>().RegisterIfNeeded(source, destination, constructorSelector, options);