// Author: Gockner, Simon // Created: 2020-02-10 // Copyright(c) 2020 SimonG. All Rights Reserved. using System.Threading.Tasks; using GBase.Api.Services; using GBase.Client.Factories; using GBase.Client.Interfaces; using GBase.Client.Services.Factories; namespace GBase.Client { /// /// A client for the GBase /// public class GBaseClient : IGBaseClient //TODO: Add logging? { /// /// A client for the GBase /// /// The for this client /// The /// The /// The public GBaseClient(IGBaseClientSettings settings, IGBaseServiceFactory gBaseServiceFactory, IGBaseTableServiceFactory gBaseTableServiceFactory, IGBaseEntryServiceFactory gBaseEntryServiceFactory) { GBase = gBaseServiceFactory.Create(settings.Protocol, settings.ServerProtocolGBaseEndpointAddress); GBaseTable = gBaseTableServiceFactory.Create(settings.Protocol, settings.ServerProtocolGBaseTableEndpointAddress); GBaseEntry = gBaseEntryServiceFactory.Create(settings.Protocol, settings.ServerProtocolGBaseEntryEndpointAddress); } /// /// Functions of the GBase /// public IGBaseService GBase { get; } /// /// Functions of the GBaseTable /// public IGBaseTableService GBaseTable { get; } /// /// Functions of the GBaseEntry /// public IGBaseEntryService GBaseEntry { get; } /// /// Dispose used resources asynchronously /// /// A to await public async ValueTask DisposeAsync() { await GBase.DisposeAsync(); await GBaseTable.DisposeAsync(); await GBaseEntry.DisposeAsync(); } } }