예제 #1
0
        public void Register(IDIContainer container)
        {
            container.RegisterInstance(container, typeof(IDIContainer));
            container.RegisterInstance(container, typeof(IRegister));
            container.RegisterInstance(container, typeof(IResolve));

            container.Register <ISerializerFactory, SerializerFactory>();

            container.Register <ISerialize, JsonSerializer>();
            container.Register <ISerializer, JsonSerializer>();
            container.Register <IDeserialize, JsonSerializer>();

            JsonConvert.DefaultSettings = () =>
            {
                var settings = new JsonSerializerSettings();
                settings.ContractResolver = new ContractResolver(container);
                // do something with settings
                return(settings);
            };

            container.Register <ISerialize, JsonSerializer>(KnownSerializerFormats.JSON.ToString());
            container.Register <ISerializer, JsonSerializer>(KnownSerializerFormats.JSON.ToString());
            container.Register <IDeserialize, JsonSerializer>(KnownSerializerFormats.JSON.ToString());

            container.Register <ISerialize, JsonSerializer>(KnownSerializerIntents.Logging.ToString());
            container.Register <ISerializer, JsonSerializer>(KnownSerializerIntents.Logging.ToString());
            container.Register <IDeserialize, JsonSerializer>(KnownSerializerIntents.Logging.ToString());

            container.Register <IEncryptionFactory, BasicEncryptionFactory>();
            container.Register <IEncryption, BasicEncryption>();
            container.Register <IEncrypter, BasicEncryption>();
            container.RegisterInstance(EncryptionAlgorithm.Rijndael, typeof(EncryptionAlgorithm));
            container.Register <IDecrypter, BasicEncryption>();
            container.Register <IEncryptionKeyReadProvider, ConfigurationBasedEncryptionKeyProvider>();
            container.Register <IEncryptionKey, EncryptionKey>();
            container.Register <IValidateEncryptionKeys, ValidateEncryptionKeys>();

            container.RegisterSingleton <IVersionProvider, AssemblyInfoVersionProvider>();
            container.Register <IContractResolver, ContractResolver>();

            container.Register <ICompressionFactory, CompressionFactory>();
            container.Register <ICompression, Compression>();

            container.Register <ICharacterEncodingConverter, CharacterEncodingConverter>();

            container.Register(typeof(IProgress <>), typeof(Progress <>));

            container.Register(typeof(ITimedBufferBatch <>), typeof(TimedBufferBatch <>));
            container.Register(typeof(ITimedBufferBatchWithErrorRetries <>), typeof(TimedBufferBatchWithErrorRetries <>));

            container.Register <IFeatureFlagProvider, ConfigurationBasedFeatureFlagProvider>();

            container.Register <IDomainDataLoader, DomainDataLoader>();
            container.Register <IUser, User>();

            RegisterActorMessageTypes(container);
        }
 public void Register(IDIContainer container)
 {
     container.Register <IUserActor, UserActor>();
     container.Register <IUserManager, AkkaUserManager>();
     container.RegisterSingleton <IUserManagerActor, UserManagerActor>();
 }