public override IFactory Boot(IRegister register) { register.Register(this.reader); register.Register(this.writer); register.Register <IHttpContextAccessor, NullHttpContextAccessor>(); return(base.Boot(register)); }
private static void RegisterControllers(IRegister composition) { composition.Register <CriteriaController>(); composition.Register <MemberController>(); composition.Register <GeoLocationController>(); composition.Register <ResourceController>(); }
public static void RegisterNetworkServices(this IRegister r) { r.Register <IServiceClient, SoapServiceClientV11>(ServiceClientType.SoapV11.ToString(), DILifeTime.Trasient); r.Register <IServiceClient, SoapServiceClientV11>(ServiceClientType.SoapV12.ToString(), DILifeTime.Trasient); r.Register <IServiceClient, RestClient>(ServiceClientType.Rest.ToString(), DILifeTime.Trasient); r.Register <IServiceClient, SoapServiceClientV11>(DILifeTime.Trasient); r.Register <IServiceClientFactory, ServiceClientFactory>(); }
public void Load(Assembly assembly) { this.events = new Dictionary <Opcode, Func <byte[], byte[]> >(); this.eventsAsync = new Dictionary <Opcode, Func <byte[], Task <byte[]> > >(); ServerType serverType = World.Instance.Options.ServerType; Type[] types = assembly.GetTypes(); foreach (Type t in types) { object[] attrs = t.GetCustomAttributes(typeof(MessageAttribute), false); if (attrs.Length == 0) { continue; } MessageAttribute messageAttribute = (MessageAttribute)attrs[0]; if (!messageAttribute.Contains(serverType)) { continue; } object obj = Activator.CreateInstance(t); IRegister iRegister = obj as IRegister; iRegister?.Register(); throw new Exception($"message handler not inherit IRegister interface: {obj.GetType().FullName}"); } }
private void RegisterTypes(IRegister register) { lock (_locker) { if (_registeredTypes != null) { return; } var types = GetRegisteringTypes(_types).ToArray(); // ensure they are safe foreach (var type in types) { EnsureType(type, "register"); } // register them - ensuring that each item is registered with the same lifetime as the collection. // NOTE: Previously each one was not registered with the same lifetime which would mean that if there // was a dependency on an individual item, it would resolve a brand new transient instance which isn't what // we would expect to happen. The same item should be resolved from the container as the collection. foreach (var type in types) { register.Register(type, CollectionLifetime); } _registeredTypes = types; } }
private void RegisterTypes(IRegister register) { lock (_locker) { if (_registeredTypes != null) { return; } var types = GetRegisteringTypes(_types).ToArray(); // ensure they are safe foreach (var type in types) { EnsureType(type, "register"); } // register them foreach (var type in types) { register.Register(type); } _registeredTypes = types; } }
public static void AddNetXPNetFrameworkRegisters(this IRegister cfg, IContainer container, string appSettingFile = null) { cfg.RegisterNetXPStandard(container, appSettingFile); cfg.RegisterSerialization(); cfg.RegisterCryptography(); cfg.RegisterNetwork(container, appSettingFile); cfg.RegisterAuditory(); //Cryptography cfg.Register <NetStandard.Cryptography.ISymetricCrypt, Symetric>(); cfg.Register <NetStandard.Cryptography.IAsymetricCrypt, AsymetricCryptWithRSACng>(); //SystemInfo cfg.Register <NetStandard.SystemInformation.ISystemInformation, NetStandard.SystemInformation.Implementations.SysInfo>(); cfg.Register <NetStandard.SystemInformation.IServiceInformer, ServiceInformerWindowsOnly>(); }
public void ForAll(IRegister r) { var rpyProcess = new LiveProcess($"{PluginContext.Dir}/rwy/rwy.py"); r.RegisterInstance <IPyProcess>(rpyProcess, DILifeTime.Singleton); r.Register <IInitializer, Initializer>(DILifeTime.Singleton); }
public async Task <IActionResult> Register(LoginModel vm) { if (ModelState.IsValid) { _register.Register(vm.Email, vm.Password); } return(RedirectToAction("Index")); }
public void RegisterComponent(Type component, ComponentAttribute attr = null) { var selectors = GetServiceSelectors(component, attr); var services = GetServices(component, selectors); foreach (var aService in services) { _register.Register(component, aService, attr); } }
public override void RegisterWith(IRegister register) { base.RegisterWith(register); // default initializer registers // - service MapperCollectionBuilder, returns MapperCollectionBuilder // - service MapperCollection, returns MapperCollectionBuilder's collection // we want to register extra // - service IMapperCollection, returns MappersCollectionBuilder's collection register.Register <IMapperCollection>(factory => factory.GetInstance <MapperCollection>()); }
/// <inheritdoc /> public virtual void RegisterWith(IRegister register) { if (_registeredTypes != null) { throw new InvalidOperationException("This builder has already been registered."); } // register the collection register.Register(CreateCollection, CollectionLifetime); // register the types RegisterTypes(register); }
private void RegisterApiControllers(IRegister container) { var controllerTypes = GetType().Assembly .GetTypes() .Where(t => !t.IsAbstract) .Where(t => typeof(IHttpController).IsAssignableFrom(t)) .ToList(); foreach (var controllerType in controllerTypes) { container.Register(controllerType, Lifetime.Request); } }
public static void RegisterSerialization(this IRegister register) { register.Register <ISerializerFactory, SerializeTFactory>(DILifeTime.Singleton); register.Register <ISerializer, Serialize2Xml>(SerializerType.Xml.ToString(), DILifeTime.Singleton); register.Register <ISerializer, Serialize2Json>(SerializerType.Json.ToString(), DILifeTime.Singleton); register.Register <ISerializer, JsonConverterSerializer>(SerializerType.JsonConvert.ToString(), DILifeTime.Singleton); register.Register <ISerializer, Serializer2XmlWithXmlSerializer>(SerializerType.XmlSerializer.ToString(), DILifeTime.Singleton); register.Register <ISerializer, Serialize2Json>(DILifeTime.Singleton); }
public static void RegisterCryptography(this IRegister uc) { uc.Register <INameResolverFactory <IAsymetricCrypt>, AsymetricFactory>(DILifeTime.Singleton); uc.Register <IHash, HashMD5>(HashType.MD5.ToString(), DILifeTime.Trasient); uc.Register <IHash, HashSHA256>(DILifeTime.Trasient); uc.Register <IHashFactory, HashFactory>(DILifeTime.Singleton); uc.Register <ISymetricCrypt, SymetricAes>(DILifeTime.Trasient); uc.Register <IAsymetricCrypt, AsymetricCryptWithMSRSA>(DILifeTime.Trasient); }
public static void RegisterAllNetXP(this IRegister cfg) { cfg.RegisterInstance(Options.Create(new PersistenPrivateKeyConfiguration())); cfg.RegisterInstance(Options.Create(new TCPOption())); cfg.RegisterNetXPStandard(); cfg.RegisterSerialization(); cfg.RegisterCryptography(); cfg.RegisterAuditory(); cfg.RegisterNetwork(); cfg.RegisterNetworkServices(); //Process cfg.Register <SystemInformation.ISystemInformation, SystemInformation.Implementations.SysInfo>(); }
public async Task <IActionResult> Create(RegisterModel model) { if (!ModelState.IsValid) { } else { var result = await registerService.Register(model); if (result.Status) { } else { } } return(View()); }
/// <summary> /// Registers configurations in a register. /// </summary> public void RegisterWith(IRegister register) { // do it only once if (_registerings == null) { throw new InvalidOperationException("Configurations have already been registered."); } register.Register(this); foreach (var registering in _registerings.Values) { registering(register); } // no need to keep them around _registerings = null; }
public static void LoadContainers(ContainerBuilder container) { string codeBase = Assembly.GetExecutingAssembly().CodeBase; var uriBuilder = new UriBuilder(codeBase); var path = Path.GetDirectoryName(Uri.UnescapeDataString(uriBuilder.Path)); string[] assemblies = Directory.GetFiles(path, "Scout.*.dll"); //Assembly assembly = Assembly. Type registerType = typeof(IRegister); Type containerType = null; IRegister register = null; foreach (string file in assemblies) { Assembly assembly = Assembly.LoadFile(file); //Find the class that implements IRegister foreach (var type in assembly.ExportedTypes) { if (registerType.IsAssignableFrom(type)) { containerType = type; break; } } //Assembly doesn't have any registering classes, exit if (containerType == null) { continue; } register = Activator.CreateInstance(containerType) as IRegister; register.Register(container); containerType = null; } }
public static void LoadContainers(ContainerBuilder builder) { string dirPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase); dirPath = dirPath.Substring(6); string[] assemblies = Directory.GetFiles(dirPath, "MyQuiver.*.dll"); //Assembly assembly = Assembly. Type registerType = typeof(IRegister); Type containerType = null; IRegister register = null; foreach (string file in assemblies) { Assembly assembly = Assembly.LoadFile(file); //Find the class that implements IRegister foreach (var type in assembly.ExportedTypes) { if (registerType.IsAssignableFrom(type)) { containerType = type; break; } } //Assembly doesn't have any registering classes, exit if (containerType == null) { continue; } register = Activator.CreateInstance(containerType) as IRegister; register.Register(builder); containerType = null; } }
public void RegisterAll() { register.Register(Command.S_PLAYER_ENTER, OnRecvPlayerEnter); register.Register(Command.S_SPAWN, OnRecvSpawn); register.Register(Command.S_ATTACK, OnRecvAttack); register.Register(Command.S_JUMP, OnRecvJump); register.Register(Command.S_PLAYER_MOVE, OnRecvPlayerMove); register.Register(Command.S_SPRITE_MOVE, OnRecvSpriteMove); register.Register(Command.S_ENTITY_DESTROY, OnRecvEntityDestory); register.Register(Command.S_EQUIP_WEAPON, OnRecvEquipWeapon); register.Register(Command.S_TAKE_ITEM, OnRecvTakeItem); register.Register(Command.S_HIT, OnRecvHit); register.Register(Command.S_SPRITE_DIE, OnRecvDie); register.Register(Command.S_TIP_INFO, OnRecvTipInfo); register.Register(Command.S_PLAYER_DIE, OnRecvPlayerDie); register.Register(Command.S_PLAYER_RESPAWN, OnRecvPlayerReSpawn); // DEBUG ... register.Register(Command.S_FIND_PATH, OnRecvFindPath); }
public static void RegisterAuditory(this IRegister uc) { //Auditory uc.Register<ILogger, Log4NetLogger>(DILifeTime.Singleton); }
/// <summary> /// Registers a service with an implementing instance. /// </summary> public static void Register <TService>(this IRegister register, TService instance) where TService : class => register.Register(typeof(TService), instance);
public void ForWindows(IRegister r) { ForAll(r); r.Register <IGPIO, Implementations.GPIOInvokerNotImplemented>(DILifeTime.Singleton); }
public void Without_Registering_Service_Leaves_Zero() { register.Register(typeof(Concrete)); register.Register(typeof(AnotherConcrete)); VerifyRegisteredCount(0); }
private void RegisterAll() { register.Register(Command.C_LOGIN, OnRecvLogin); register.Register(Command.C_REGISTER, OnRecvRegister); register.Register(Command.C_PLAYER_ENTER, OnRecvPlayerEnter); register.Register(Command.C_PLAYER_MOVE, OnRecvPlayerMove); register.Register(Command.C_PLAYER_JUMP, OnRecvPlayerJump); register.Register(Command.C_PLAYER_ATTACK, OnRecvPlayerAttack); register.Register(Command.C_PLAYER_TAKE, OnRecvPlayerTake); register.Register(Command.C_POSITION_REVISE, OnRecvPositionRevise); register.Register(Command.C_ENEMY_CLOSING, OnRecvEnemyClosing); register.Register(Command.C_DAMAGE, OnRecvDamage); // DEBUG .. register.Register(Command.C_FIND_PATH, OnRecvFindPath); }
public void RegisterAll() { register.Register(Command.S_PLAYER_ENTER, OnRecvPlayerEnter); register.Register(Command.S_MARKET_ATTRIBUTE, OnRecvMarketAttribute); register.Register(Command.S_WORLD_MARKET_ATTRIBUTE, OnRecvWorldMarketAttribute); register.Register(Command.S_PLAYER_ATTRIBUTE, OnRecvPlayerAttribute); register.Register(Command.S_GET_INVENTORY, OnRecvInventory); register.Register(Command.S_GET_SELLING_INVENTORY, OnRecvSellingInventory); register.Register(Command.S_SPAWN, OnRecvSpawn); register.Register(Command.S_ATTACK, OnRecvAttack); register.Register(Command.S_JUMP, OnRecvJump); register.Register(Command.S_PLAYER_MOVE, OnRecvPlayerMove); register.Register(Command.S_SPRITE_MOVE, OnRecvSpriteMove); register.Register(Command.S_ENTITY_DESTROY, OnRecvEntityDestory); register.Register(Command.S_EQUIP_WEAPON, OnRecvEquipWeapon); register.Register(Command.S_TAKE_ITEM, OnRecvTakeItem); register.Register(Command.S_HIT, OnRecvHit); register.Register(Command.S_SPRITE_DIE, OnRecvDie); register.Register(Command.S_TIP_INFO, OnRecvTipInfo); register.Register(Command.S_PLAYER_DIE, OnRecvPlayerDie); register.Register(Command.S_PLAYER_RESPAWN, OnRecvPlayerReSpawn); // DEBUG ... register.Register(Command.S_FIND_PATH, OnRecvFindPath); }
/// <inheritdoc /> public void Register(Type serviceType, Lifetime lifetime = Lifetime.Transient) => _register.Register(serviceType, lifetime);
public static void RegisterNetXPStandard(this IRegister uc) { //cnf uc.Register <IConfigFactory, ConfigFactory>(); //cmpr uc.Register <ICompression, DeflateCompress>(DILifeTime.Singleton); #region Processes //Process uc.Register <NetStandard.Processes.IIOTerminal, IOTerminal>(); #endregion //Reflect uc.Register <IReflector, Reflector>(DILifeTime.Singleton); //System Information //ISysInfo need to be implemented in their os system. uc.Register <NetStandard.SystemInformation.IStorageInfo, SystemInformation.Implementations.SysInfo>(); var customDateTime = new CustomDateTime(0); uc.RegisterInstance <ICustomDateTime>(customDateTime); uc.Register <IServiceInformer, ServiceInformer>(DILifeTime.Singleton); //System Managers uc.Register <IServiceManager, ServiceManagerForWindows>(OSPlatformType.Windows.ToString(), DILifeTime.Singleton); uc.Register <IServiceManager, ServiceManagerForLinux>(OSPlatformType.Linux.ToString(), DILifeTime.Singleton); uc.Register <IServiceManager, ServiceManager>(DILifeTime.Singleton); uc.Register <IServiceManagerFactory, ServiceManagerFactory>(DILifeTime.Singleton); //Operative System uc.Register <IOperativeSystem, OperativeSystem>(DILifeTime.Singleton); }
public void ForRaspberry(IRegister r) { ForAll(r); r.Register <IGPIO, Implementations.RaspberryRNetInvoker>(DILifeTime.Singleton); }