예제 #1
0
        /// <summary>
        /// Initialize dependency injection container.
        /// </summary>
        /// <param name="client">Parent <see cref="VeeamO365Client"/> client.</param>
        /// <param name="dtoResolver">Resolver, that finds classes with specific attribute.</param>
        /// <returns>Dependency injection container.</returns>
        /// <exception cref="InvalidOperationException">Thrown, when container was already initialized.</exception>
        public static IContainer Create(VeeamO365Client client, IDataTransferObjectResolver dtoResolver)
        {
            lock (Lock)
            {
                if (_container != null)
                {
                    throw new InvalidOperationException("Container was already created.");
                }

                _container = CreateContainer(client, dtoResolver);
                return(_container);
            }
        }
예제 #2
0
        private static IContainer CreateContainer(VeeamO365Client client, IDataTransferObjectResolver dtoResolver)
        {
            var builder = new ContainerBuilder();

            builder.RegisterInstance(client);
            builder.RegisterInstance <IVeeamO365Client>(client);

            builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly())
            .Except <VeeamO365Client>()
            .PublicOnly();

            var genericTypes = Assembly.GetExecutingAssembly().GetTypes().Where(x => x.IsGenericType);

            foreach (var genericType in genericTypes)
            {
                builder.RegisterGeneric(genericType);
            }

            return(builder.Build());
        }
 public MailboxClient(VeeamO365Client baseClient)
 {
     _baseClient = baseClient;
 }
예제 #4
0
 public VeeamLink(VeeamO365Client client)
 {
     _client = client;
 }
 public OneDriveClient(VeeamO365Client baseClient)
 {
     _baseClient = baseClient;
 }
예제 #6
0
 public SharePointClient(VeeamO365Client baseClient)
 {
     _baseClient = baseClient;
 }
예제 #7
0
 public OrganizationGroupClient(VeeamO365Client baseClient)
 {
     _baseClient = baseClient;
 }
예제 #8
0
 public RestoreSessionClient(VeeamO365Client baseClient)
 {
     _baseClient = baseClient;
 }
예제 #9
0
 public Job(VeeamO365Client client)
 {
     _client = client;
 }
 public BackupRepositoryClient(VeeamO365Client baseClient)
 {
     _baseClient = baseClient;
 }
예제 #11
0
 public LicensedUserClient(VeeamO365Client baseClient)
 {
     _baseClient = baseClient;
 }
예제 #12
0
 public JobClient(VeeamO365Client baseClient)
 {
     _baseClient = baseClient;
 }
예제 #13
0
 public RestoreSession(VeeamO365Client client)
 {
     _client = client;
 }
예제 #14
0
 public OrganizationUserClient(VeeamO365Client baseClient)
 {
     _baseClient = baseClient;
 }