/// <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); } }
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; }
public VeeamLink(VeeamO365Client client) { _client = client; }
public OneDriveClient(VeeamO365Client baseClient) { _baseClient = baseClient; }
public SharePointClient(VeeamO365Client baseClient) { _baseClient = baseClient; }
public OrganizationGroupClient(VeeamO365Client baseClient) { _baseClient = baseClient; }
public RestoreSessionClient(VeeamO365Client baseClient) { _baseClient = baseClient; }
public Job(VeeamO365Client client) { _client = client; }
public BackupRepositoryClient(VeeamO365Client baseClient) { _baseClient = baseClient; }
public LicensedUserClient(VeeamO365Client baseClient) { _baseClient = baseClient; }
public JobClient(VeeamO365Client baseClient) { _baseClient = baseClient; }
public RestoreSession(VeeamO365Client client) { _client = client; }
public OrganizationUserClient(VeeamO365Client baseClient) { _baseClient = baseClient; }