A database based on .net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.2 KiB

// 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.Interfaces;
using GBase.Client.Services.Factories;
namespace GBase.Client
{
/// <summary>
/// A client for the GBase
/// </summary>
public class GBaseClient : IGBaseClient //TODO: Add logging?
{
/// <summary>
/// A client for the GBase
/// </summary>
/// <param name="settings">The <see cref="IGBaseClientSettings"/> for this client</param>
/// <param name="gBaseServiceFactory">The <see cref="IGBaseServiceFactory"/></param>
/// <param name="gBaseTableServiceFactory">The <see cref="IGBaseTableServiceFactory"/></param>
/// <param name="gBaseColumnServiceFactory">The <see cref="IGBaseColumnServiceFactory"/></param>
public GBaseClient(IGBaseClientSettings settings, IGBaseServiceFactory gBaseServiceFactory, IGBaseTableServiceFactory gBaseTableServiceFactory, IGBaseColumnServiceFactory gBaseColumnServiceFactory)
{
GBase = gBaseServiceFactory.Create(settings.Protocol, settings.ServerProtocolGBaseEndpointAddress);
GBaseTable = gBaseTableServiceFactory.Create(settings.Protocol, settings.ServerProtocolGBaseTableEndpointAddress);
GBaseColumn = gBaseColumnServiceFactory.Create(settings.Protocol, settings.ServerProtocolGBaseColumnEndpointAddress);
}
/// <summary>
/// Functions of the GBase
/// </summary>
public IGBaseService GBase { get; }
/// <summary>
/// Functions of the GBaseTable
/// </summary>
public IGBaseTableService GBaseTable { get; }
/// <summary>
/// Functions of the GBaseColumn
/// </summary>
public IGBaseColumnService GBaseColumn { get; }
/// <summary>
/// Dispose used resources asynchronously
/// </summary>
/// <returns>A <see cref="ValueTask"/> to await</returns>
public async ValueTask DisposeAsync()
{
await GBase.DisposeAsync();
await GBaseTable.DisposeAsync();
await GBaseColumn.DisposeAsync();
}
}
}