From b770b784812f2384226a6c2bf7deee7f79016dbb Mon Sep 17 00:00:00 2001 From: Simon Gockner Date: Fri, 6 Mar 2020 15:45:25 +0100 Subject: [PATCH] #21: refactor GBaseEntry name --- .vscode/launch.json | 2 +- .../Communication/ICommunicationSettings.cs | 4 +- GBase.Api/GBase.Api.xml | 33 +++- ...EntryService.cs => IGBaseColumnService.cs} | 4 +- GBase.Api/Services/IGBaseTableService.cs | 8 +- .../Factories/IGBaseClientSettingsFactory.cs | 4 +- GBase.Client/GBase.Client.xml | 58 +++---- GBase.Client/GBaseClient.cs | 13 +- GBase.Client/GBaseClientSettings.cs | 14 +- .../Installers/GBaseClientInstaller.cs | 4 +- GBase.Client/Interfaces/IGBaseClient.cs | 4 +- .../Interfaces/IGBaseClientSettings.cs | 4 +- ...ctory.cs => IGBaseColumnServiceFactory.cs} | 10 +- ...eEntryService.cs => GBaseColumnService.cs} | 10 +- GBase.Client/Services/GBaseTableService.cs | 12 +- GBase.Server/GBaseServerSettings.cs | 18 +- GBase.Server/Program.cs | 2 +- ...eEntryService.cs => GBaseColumnService.cs} | 2 +- GBase.Server/Services/GBaseTableService.cs | 4 +- GBase.Server/Startup.cs | 4 +- ...ryAttribute.cs => GBaseColumnAttribute.cs} | 40 ++--- ...nalyzer.cs => GBaseTableColumnAnalyzer.cs} | 33 +++- ...EntryFactory.cs => IGBaseColumnFactory.cs} | 10 +- GBase/GBase.xml | 155 ++++++++++++++---- GBase/{GBaseEntry.cs => GBaseColumn.cs} | 64 ++++---- GBase/GBaseTable.cs | 48 +++--- GBase/Installers/GBaseInstaller.cs | 4 +- .../{IGBaseEntry.cs => IGBaseColumn.cs} | 30 ++-- GBase/Interfaces/IGBaseTable.cs | 16 +- Test.GBase.Client/IntegrationTest.cs | 7 +- Test.GBase/TestClasses/Foo.cs | 2 +- 31 files changed, 372 insertions(+), 251 deletions(-) rename GBase.Api/Services/{IGBaseEntryService.cs => IGBaseColumnService.cs} (67%) rename GBase.Client/Services/Factories/{IGBaseEntryServiceFactory.cs => IGBaseColumnServiceFactory.cs} (63%) rename GBase.Client/Services/{GBaseEntryService.cs => GBaseColumnService.cs} (62%) rename GBase.Server/Services/{GBaseEntryService.cs => GBaseColumnService.cs} (88%) rename GBase/Attributes/{GBaseEntryAttribute.cs => GBaseColumnAttribute.cs} (73%) rename GBase/Diagnosis/{GBaseTableEntryAnalyzer.cs => GBaseTableColumnAnalyzer.cs} (50%) rename GBase/Factories/{IGBaseEntryFactory.cs => IGBaseColumnFactory.cs} (58%) rename GBase/{GBaseEntry.cs => GBaseColumn.cs} (73%) rename GBase/Interfaces/{IGBaseEntry.cs => IGBaseColumn.cs} (51%) diff --git a/.vscode/launch.json b/.vscode/launch.json index d8d7e6c..4ac99e9 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -11,7 +11,7 @@ "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. "program": "${workspaceFolder}/GBase.Server/bin/Debug/netcoreapp3.1/GBase.Server.dll", - "args": ["-pr", "http", "-ip", "127.0.0.1", "-p", "8080", "-e", "/GBase", "-et", "/GBaseTable", "-ee", "/GBaseEntry"], + "args": ["-pr", "http", "-ip", "127.0.0.1", "-p", "8080", "-e", "/GBase", "-et", "/GBaseTable", "-ee", "/GBaseColumn"], "cwd": "${workspaceFolder}/GBase.Server", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console "console": "internalConsole", diff --git a/GBase.Api/Communication/ICommunicationSettings.cs b/GBase.Api/Communication/ICommunicationSettings.cs index a74caaf..c97700d 100644 --- a/GBase.Api/Communication/ICommunicationSettings.cs +++ b/GBase.Api/Communication/ICommunicationSettings.cs @@ -37,8 +37,8 @@ namespace GBase.Api.Communication string GBaseTableEndpoint { get; } /// - /// The used endpoint for the GBaseEntry + /// The used endpoint for the GBaseColumn /// - string GBaseEntryEndpoint { get; } + string GBaseColumnEndpoint { get; } } } \ No newline at end of file diff --git a/GBase.Api/GBase.Api.xml b/GBase.Api/GBase.Api.xml index bb1c58d..8ed0b92 100644 --- a/GBase.Api/GBase.Api.xml +++ b/GBase.Api/GBase.Api.xml @@ -34,9 +34,9 @@ The used endpoint for the GBaseTable - + - The used endpoint for the GBaseEntry + The used endpoint for the GBaseColumn @@ -80,6 +80,11 @@ The for the given Invalid string passed. + + + for the event + + GBase object that allows conversion from @@ -91,12 +96,22 @@ The given - + + + Notify the GBase that an entry has changed + + + + + Notify the GBase that an entry has changed + + + - ServiceContract for the GBaseEntry + ServiceContract for the GBaseColumn - + Dummy OperationContract @@ -123,15 +138,15 @@ ServiceContract for the GBaseTable - + - Add an entry to the GBaseTable + Add a column to the GBaseTable True if successful, false if not - + - Remove an entry from the GBaseTable + Remove a column from the GBaseTable True if successful, false if not diff --git a/GBase.Api/Services/IGBaseEntryService.cs b/GBase.Api/Services/IGBaseColumnService.cs similarity index 67% rename from GBase.Api/Services/IGBaseEntryService.cs rename to GBase.Api/Services/IGBaseColumnService.cs index ce98c98..fd58349 100644 --- a/GBase.Api/Services/IGBaseEntryService.cs +++ b/GBase.Api/Services/IGBaseColumnService.cs @@ -8,10 +8,10 @@ using System.ServiceModel; namespace GBase.Api.Services { /// - /// ServiceContract for the GBaseEntry + /// ServiceContract for the GBaseColumn /// [ServiceContract] - public interface IGBaseEntryService : IAsyncDisposable //TODO: Add OperationContracts for all operations this service has to do + public interface IGBaseColumnService : IAsyncDisposable //TODO: Add OperationContracts for all operations this service has to do { /// /// Dummy OperationContract diff --git a/GBase.Api/Services/IGBaseTableService.cs b/GBase.Api/Services/IGBaseTableService.cs index 82c6b74..669e53a 100644 --- a/GBase.Api/Services/IGBaseTableService.cs +++ b/GBase.Api/Services/IGBaseTableService.cs @@ -14,17 +14,17 @@ namespace GBase.Api.Services public interface IGBaseTableService : IAsyncDisposable //TODO: Add OperationContracts for all operations this service has to do { /// - /// Add an entry to the GBaseTable + /// Add a column to the GBaseTable /// /// True if successful, false if not [OperationContract] - bool AddEntry(); + bool AddColumn(); /// - /// Remove an entry from the GBaseTable + /// Remove a column from the GBaseTable /// /// True if successful, false if not [OperationContract] - bool RemoveEntry(); + bool RemoveColumn(); } } \ No newline at end of file diff --git a/GBase.Client/Factories/IGBaseClientSettingsFactory.cs b/GBase.Client/Factories/IGBaseClientSettingsFactory.cs index 3c032e5..b05bc96 100644 --- a/GBase.Client/Factories/IGBaseClientSettingsFactory.cs +++ b/GBase.Client/Factories/IGBaseClientSettingsFactory.cs @@ -22,8 +22,8 @@ namespace GBase.Client.Factories /// The port /// The GBase endpoint /// The GBaseTable endpoint - /// The GBaseEntry endpoint + /// The GBaseColumn endpoint /// A newly created instance of the implementation for - IGBaseClientSettings Create(ServerProtocol protocol, IPAddress ipAddress, int port, string gBaseEndpoint, string gBaseTableEndpoint, string gBaseEntryEndpoint); + IGBaseClientSettings Create(ServerProtocol protocol, IPAddress ipAddress, int port, string gBaseEndpoint, string gBaseTableEndpoint, string gBaseColumnEndpoint); } } \ No newline at end of file diff --git a/GBase.Client/GBase.Client.xml b/GBase.Client/GBase.Client.xml index ee36f51..f547cce 100644 --- a/GBase.Client/GBase.Client.xml +++ b/GBase.Client/GBase.Client.xml @@ -30,7 +30,7 @@ The port The GBase endpoint The GBaseTable endpoint - The GBaseEntry endpoint + The GBaseEntry endpoint A newly created instance of the implementation for @@ -38,14 +38,14 @@ A client for the GBase - + A client for the GBase The for this client The The - The + The @@ -57,9 +57,9 @@ Functions of the GBaseTable - + - Functions of the GBaseEntry + Functions of the GBaseColumn @@ -82,7 +82,7 @@ The port The GBase endpoint The GBaseTable endpoint - The GBaseEntry endpoint + The GBaseColumn endpoint @@ -109,9 +109,9 @@ GBaseTable endpoint the server listens to - + - GBaseEntry endpoint the server listens to + GBaseColumn endpoint the server listens to @@ -124,9 +124,9 @@ Complete GBaseTable endpoint address based on the - + - Complete GBaseEntry endpoint address based on the + Complete GBaseColumn endpoint address based on the @@ -152,9 +152,9 @@ Functions of the GBaseTable - + - Functions of the GBaseEntry + Functions of the GBaseColumn @@ -172,23 +172,23 @@ Complete GBaseTable endpoint address based on the - + - Complete GBaseEntry endpoint address based on the + Complete GBaseColumn endpoint address based on the - + - Factory for the + Factory for the - + - Creates an + Creates an The The endpoint for the GBase - A newly created instance of the implementation for + A newly created instance of the implementation for @@ -216,19 +216,19 @@ The endpoint for the GBase A newly created instance of the implementation for - + - for the IGBaseEntry + for the IGBaseColumn - + - for the IGBaseEntry + for the IGBaseColumn The - The endpoint for the GBaseEntry + The endpoint for the GBaseColumn - + Dummy method @@ -269,15 +269,15 @@ The The endpoint for the GBaseTable - + - Add an entry to the GBaseTable + Add a column to the GBaseTable True if successful, false if not - + - Remove an entry from the GBaseTable + Remove a column from the GBaseTable True if successful, false if not diff --git a/GBase.Client/GBaseClient.cs b/GBase.Client/GBaseClient.cs index 78f0669..79a3c3a 100644 --- a/GBase.Client/GBaseClient.cs +++ b/GBase.Client/GBaseClient.cs @@ -4,7 +4,6 @@ using System.Threading.Tasks; using GBase.Api.Services; -using GBase.Client.Factories; using GBase.Client.Interfaces; using GBase.Client.Services.Factories; @@ -21,12 +20,12 @@ namespace GBase.Client /// The for this client /// The /// The - /// The - public GBaseClient(IGBaseClientSettings settings, IGBaseServiceFactory gBaseServiceFactory, IGBaseTableServiceFactory gBaseTableServiceFactory, IGBaseEntryServiceFactory gBaseEntryServiceFactory) + /// The + public GBaseClient(IGBaseClientSettings settings, IGBaseServiceFactory gBaseServiceFactory, IGBaseTableServiceFactory gBaseTableServiceFactory, IGBaseColumnServiceFactory gBaseColumnServiceFactory) { GBase = gBaseServiceFactory.Create(settings.Protocol, settings.ServerProtocolGBaseEndpointAddress); GBaseTable = gBaseTableServiceFactory.Create(settings.Protocol, settings.ServerProtocolGBaseTableEndpointAddress); - GBaseEntry = gBaseEntryServiceFactory.Create(settings.Protocol, settings.ServerProtocolGBaseEntryEndpointAddress); + GBaseColumn = gBaseColumnServiceFactory.Create(settings.Protocol, settings.ServerProtocolGBaseColumnEndpointAddress); } /// @@ -40,9 +39,9 @@ namespace GBase.Client public IGBaseTableService GBaseTable { get; } /// - /// Functions of the GBaseEntry + /// Functions of the GBaseColumn /// - public IGBaseEntryService GBaseEntry { get; } + public IGBaseColumnService GBaseColumn { get; } /// /// Dispose used resources asynchronously @@ -52,7 +51,7 @@ namespace GBase.Client { await GBase.DisposeAsync(); await GBaseTable.DisposeAsync(); - await GBaseEntry.DisposeAsync(); + await GBaseColumn.DisposeAsync(); } } } \ No newline at end of file diff --git a/GBase.Client/GBaseClientSettings.cs b/GBase.Client/GBaseClientSettings.cs index 894344c..07b1b25 100644 --- a/GBase.Client/GBaseClientSettings.cs +++ b/GBase.Client/GBaseClientSettings.cs @@ -21,15 +21,15 @@ namespace GBase.Client /// The port /// The GBase endpoint /// The GBaseTable endpoint - /// The GBaseEntry endpoint - public GBaseClientSettings(ServerProtocol protocol, IPAddress ipAddress, int port, string gBaseEndpoint, string gBaseTableEndpoint, string gBaseEntryEndpoint) + /// The GBaseColumn endpoint + public GBaseClientSettings(ServerProtocol protocol, IPAddress ipAddress, int port, string gBaseEndpoint, string gBaseTableEndpoint, string gBaseColumnEndpoint) { Protocol = protocol; IpAddress = ipAddress; Port = port; GBaseEndpoint = gBaseEndpoint; GBaseTableEndpoint = gBaseTableEndpoint; - GBaseEntryEndpoint = gBaseEntryEndpoint; + GBaseColumnEndpoint = gBaseColumnEndpoint; } /// @@ -58,9 +58,9 @@ namespace GBase.Client public string GBaseTableEndpoint { get; } /// - /// GBaseEntry endpoint the server listens to + /// GBaseColumn endpoint the server listens to /// - public string GBaseEntryEndpoint { get; } + public string GBaseColumnEndpoint { get; } /// @@ -74,8 +74,8 @@ namespace GBase.Client public string ServerProtocolGBaseTableEndpointAddress => @$"{Protocol.GetProtocolString()}{IpAddress}:{Port}{GBaseTableEndpoint}"; /// - /// Complete GBaseEntry endpoint address based on the + /// Complete GBaseColumn endpoint address based on the /// - public string ServerProtocolGBaseEntryEndpointAddress => @$"{Protocol.GetProtocolString()}{IpAddress}:{Port}{GBaseEntryEndpoint}"; + public string ServerProtocolGBaseColumnEndpointAddress => @$"{Protocol.GetProtocolString()}{IpAddress}:{Port}{GBaseColumnEndpoint}"; } } \ No newline at end of file diff --git a/GBase.Client/Installers/GBaseClientInstaller.cs b/GBase.Client/Installers/GBaseClientInstaller.cs index 6d2163a..66b504b 100644 --- a/GBase.Client/Installers/GBaseClientInstaller.cs +++ b/GBase.Client/Installers/GBaseClientInstaller.cs @@ -27,7 +27,7 @@ namespace GBase.Client.Installers //services container.Register(); container.Register(); - container.Register(); + container.Register(); //factories container.RegisterFactory(); @@ -36,7 +36,7 @@ namespace GBase.Client.Installers //service factories container.RegisterFactory(); container.RegisterFactory(); - container.RegisterFactory(); + container.RegisterFactory(); } } } \ No newline at end of file diff --git a/GBase.Client/Interfaces/IGBaseClient.cs b/GBase.Client/Interfaces/IGBaseClient.cs index 9c954fe..cf6e6b2 100644 --- a/GBase.Client/Interfaces/IGBaseClient.cs +++ b/GBase.Client/Interfaces/IGBaseClient.cs @@ -23,8 +23,8 @@ namespace GBase.Client.Interfaces IGBaseTableService GBaseTable { get; } /// - /// Functions of the GBaseEntry + /// Functions of the GBaseColumn /// - IGBaseEntryService GBaseEntry { get; } + IGBaseColumnService GBaseColumn { get; } } } \ No newline at end of file diff --git a/GBase.Client/Interfaces/IGBaseClientSettings.cs b/GBase.Client/Interfaces/IGBaseClientSettings.cs index 5a6c708..8d7b379 100644 --- a/GBase.Client/Interfaces/IGBaseClientSettings.cs +++ b/GBase.Client/Interfaces/IGBaseClientSettings.cs @@ -22,8 +22,8 @@ namespace GBase.Client.Interfaces string ServerProtocolGBaseTableEndpointAddress { get; } /// - /// Complete GBaseEntry endpoint address based on the + /// Complete GBaseColumn endpoint address based on the /// - string ServerProtocolGBaseEntryEndpointAddress { get; } + string ServerProtocolGBaseColumnEndpointAddress { get; } } } \ No newline at end of file diff --git a/GBase.Client/Services/Factories/IGBaseEntryServiceFactory.cs b/GBase.Client/Services/Factories/IGBaseColumnServiceFactory.cs similarity index 63% rename from GBase.Client/Services/Factories/IGBaseEntryServiceFactory.cs rename to GBase.Client/Services/Factories/IGBaseColumnServiceFactory.cs index 81167be..a97fb26 100644 --- a/GBase.Client/Services/Factories/IGBaseEntryServiceFactory.cs +++ b/GBase.Client/Services/Factories/IGBaseColumnServiceFactory.cs @@ -9,16 +9,16 @@ using GBase.Api.Services; namespace GBase.Client.Services.Factories { /// - /// Factory for the + /// Factory for the /// - public interface IGBaseEntryServiceFactory + public interface IGBaseColumnServiceFactory { /// - /// Creates an + /// Creates an /// /// The /// The endpoint for the GBase - /// A newly created instance of the implementation for - IGBaseEntryService Create(ServerProtocol serverProtocol, string endpoint); + /// A newly created instance of the implementation for + IGBaseColumnService Create(ServerProtocol serverProtocol, string endpoint); } } \ No newline at end of file diff --git a/GBase.Client/Services/GBaseEntryService.cs b/GBase.Client/Services/GBaseColumnService.cs similarity index 62% rename from GBase.Client/Services/GBaseEntryService.cs rename to GBase.Client/Services/GBaseColumnService.cs index 2b31e8b..4f2ddbe 100644 --- a/GBase.Client/Services/GBaseEntryService.cs +++ b/GBase.Client/Services/GBaseColumnService.cs @@ -8,16 +8,16 @@ using GBase.Api.Services; namespace GBase.Client.Services { /// - /// for the IGBaseEntry + /// for the IGBaseColumn /// - public class GBaseEntryService : Service, IGBaseEntryService + public class GBaseColumnService : Service, IGBaseColumnService { /// - /// for the IGBaseEntry + /// for the IGBaseColumn /// /// The - /// The endpoint for the GBaseEntry - public GBaseEntryService(ServerProtocol serverProtocol, string endpoint) + /// The endpoint for the GBaseColumn + public GBaseColumnService(ServerProtocol serverProtocol, string endpoint) : base(serverProtocol, endpoint) { diff --git a/GBase.Client/Services/GBaseTableService.cs b/GBase.Client/Services/GBaseTableService.cs index 1d8f3e8..350a1bb 100644 --- a/GBase.Client/Services/GBaseTableService.cs +++ b/GBase.Client/Services/GBaseTableService.cs @@ -24,13 +24,13 @@ namespace GBase.Client.Services } /// - /// Add an entry to the GBaseTable + /// Add a column to the GBaseTable /// /// True if successful, false if not - public bool AddEntry() + public bool AddColumn() { IGBaseTableService channel = OpenChannel(); - bool ret = channel.AddEntry(); + bool ret = channel.AddColumn(); CloseChannel(channel); @@ -38,13 +38,13 @@ namespace GBase.Client.Services } /// - /// Remove an entry from the GBaseTable + /// Remove a column from the GBaseTable /// /// True if successful, false if not - public bool RemoveEntry() + public bool RemoveColumn() { IGBaseTableService channel = OpenChannel(); - bool ret = channel.RemoveEntry(); + bool ret = channel.RemoveColumn(); CloseChannel(channel); diff --git a/GBase.Server/GBaseServerSettings.cs b/GBase.Server/GBaseServerSettings.cs index b20dc68..a1d8519 100644 --- a/GBase.Server/GBaseServerSettings.cs +++ b/GBase.Server/GBaseServerSettings.cs @@ -17,14 +17,14 @@ namespace GBase.Server { public const string GBASE_ENDPOINT_STARTUP_CONFIGURATION_PREFIX = "GBaseEndpoint"; public const string GBASE_TABLE_ENDPOINT_STARTUP_CONFIGURATION_PREFIX = "GBaseTableEndpoint"; - public const string GBASE_ENTRY_ENDPOINT_STARTUP_CONFIGURATION_PREFIX = "GBaseEntryEndpoint"; + public const string GBASE_COLUMN_ENDPOINT_STARTUP_CONFIGURATION_PREFIX = "GBaseColumnEndpoint"; private const string PROTOCOL_ARGUMENT_PREFIX = "-pr"; private const string IP_ADDRESS_ARGUMENT_PREFIX = "-ip"; private const string PORT_ARGUMENT_PREFIX = "-p"; private const string ENDPOINT_ARGUMENT_PREFIX = "-e"; private const string TABLE_ENDPOINT_ARGUMENT_PREFIX = "-et"; - private const string ENTRY_ENDPOINT_ARGUMENT_PREFIX = "-ee"; + private const string COLUMN_ENDPOINT_ARGUMENT_PREFIX = "-ee"; private const string LOG_FILE_PATH_ARGUMENT_PREFIX = "-lp"; private const string LOG_FILE_NAME_ARGUMENT_PREFIX = "-ln"; @@ -39,7 +39,7 @@ namespace GBase.Server private bool _portInitialized; private bool _gBaseEndpointInitialized; private bool _gBaseTableEndpointInitialized; - private bool _gBaseEntryEndpointInitialized; + private bool _gBaseColumnEndpointInitialized; private bool _logFilePathInitialized; private bool _logFileNameInitialized; @@ -49,7 +49,7 @@ namespace GBase.Server public int Port { get; private set; } public string GBaseEndpoint { get; private set; } public string GBaseTableEndpoint { get; private set; } - public string GBaseEntryEndpoint { get; private set; } + public string GBaseColumnEndpoint { get; private set; } public string LogFilePath { get; private set; } public string LogFileName { get; private set; } @@ -98,13 +98,13 @@ namespace GBase.Server GBaseTableEndpoint = args[index]; _gBaseTableEndpointInitialized = true; } - else if (args[index] == ENTRY_ENDPOINT_ARGUMENT_PREFIX) + else if (args[index] == COLUMN_ENDPOINT_ARGUMENT_PREFIX) { index++; await VerifyArgsLength(index, args.Length); - GBaseEntryEndpoint = args[index]; - _gBaseEntryEndpointInitialized = true; + GBaseColumnEndpoint = args[index]; + _gBaseColumnEndpointInitialized = true; } else if (args[index] == LOG_FILE_PATH_ARGUMENT_PREFIX) { @@ -152,7 +152,7 @@ namespace GBase.Server LogFileName = _defaultLogFileName; //mandatory settings - if (_protocolInitialized && _ipAddressInitialized && _portInitialized && _gBaseEndpointInitialized && _gBaseTableEndpointInitialized && _gBaseEntryEndpointInitialized) + if (_protocolInitialized && _ipAddressInitialized && _portInitialized && _gBaseEndpointInitialized && _gBaseTableEndpointInitialized && _gBaseColumnEndpointInitialized) return true; await PrintHelp(); @@ -167,7 +167,7 @@ namespace GBase.Server await Log.Write($"{PORT_ARGUMENT_PREFIX}: The used port"); await Log.Write($"{ENDPOINT_ARGUMENT_PREFIX}: The used GBase endpoint"); await Log.Write($"{TABLE_ENDPOINT_ARGUMENT_PREFIX}: The used GBase table endpoint"); - await Log.Write($"{ENTRY_ENDPOINT_ARGUMENT_PREFIX}: The used GBase entry endpoint"); + await Log.Write($"{COLUMN_ENDPOINT_ARGUMENT_PREFIX}: The used GBase column endpoint"); await Log.Write(""); await Log.Write("Optional Arguments:"); await Log.Write($"{LOG_FILE_PATH_ARGUMENT_PREFIX}: The path to the server log file (default: '{_defaultLogFilePath}')"); diff --git a/GBase.Server/Program.cs b/GBase.Server/Program.cs index 96b8a46..ac9a1eb 100644 --- a/GBase.Server/Program.cs +++ b/GBase.Server/Program.cs @@ -68,7 +68,7 @@ namespace GBase.Server { $"--{GBaseServerSettings.GBASE_ENDPOINT_STARTUP_CONFIGURATION_PREFIX}", serverSettings.GBaseEndpoint, $"--{GBaseServerSettings.GBASE_TABLE_ENDPOINT_STARTUP_CONFIGURATION_PREFIX}", serverSettings.GBaseTableEndpoint, - $"--{GBaseServerSettings.GBASE_ENTRY_ENDPOINT_STARTUP_CONFIGURATION_PREFIX}", serverSettings.GBaseEntryEndpoint + $"--{GBaseServerSettings.GBASE_COLUMN_ENDPOINT_STARTUP_CONFIGURATION_PREFIX}", serverSettings.GBaseColumnEndpoint }); }) .UseStartup(); diff --git a/GBase.Server/Services/GBaseEntryService.cs b/GBase.Server/Services/GBaseColumnService.cs similarity index 88% rename from GBase.Server/Services/GBaseEntryService.cs rename to GBase.Server/Services/GBaseColumnService.cs index e1fbb53..5e81c5a 100644 --- a/GBase.Server/Services/GBaseEntryService.cs +++ b/GBase.Server/Services/GBaseColumnService.cs @@ -7,7 +7,7 @@ using GBase.Api.Services; namespace GBase.Server.Services { - public class GBaseEntryService : IGBaseEntryService + public class GBaseColumnService : IGBaseColumnService { public void Dummy() { diff --git a/GBase.Server/Services/GBaseTableService.cs b/GBase.Server/Services/GBaseTableService.cs index 5fb1a43..5cdd64b 100644 --- a/GBase.Server/Services/GBaseTableService.cs +++ b/GBase.Server/Services/GBaseTableService.cs @@ -9,12 +9,12 @@ namespace GBase.Server.Services { public class GBaseTableService : IGBaseTableService { - public bool AddEntry() + public bool AddColumn() { throw new System.NotImplementedException(); } - public bool RemoveEntry() + public bool RemoveColumn() { throw new System.NotImplementedException(); } diff --git a/GBase.Server/Startup.cs b/GBase.Server/Startup.cs index b1166d1..9e73f79 100644 --- a/GBase.Server/Startup.cs +++ b/GBase.Server/Startup.cs @@ -37,8 +37,8 @@ namespace GBase.Server builder.AddService(); builder.AddServiceEndpoint(new BasicHttpBinding(), _configuration[GBaseServerSettings.GBASE_TABLE_ENDPOINT_STARTUP_CONFIGURATION_PREFIX]); - builder.AddService(); - builder.AddServiceEndpoint(new BasicHttpBinding(), _configuration[GBaseServerSettings.GBASE_ENTRY_ENDPOINT_STARTUP_CONFIGURATION_PREFIX]); + builder.AddService(); + builder.AddServiceEndpoint(new BasicHttpBinding(), _configuration[GBaseServerSettings.GBASE_COLUMN_ENDPOINT_STARTUP_CONFIGURATION_PREFIX]); }); } } diff --git a/GBase/Attributes/GBaseEntryAttribute.cs b/GBase/Attributes/GBaseColumnAttribute.cs similarity index 73% rename from GBase/Attributes/GBaseEntryAttribute.cs rename to GBase/Attributes/GBaseColumnAttribute.cs index 3ad1568..bc3c104 100644 --- a/GBase/Attributes/GBaseEntryAttribute.cs +++ b/GBase/Attributes/GBaseColumnAttribute.cs @@ -1,21 +1,21 @@ -// Author: Gockner, Simon -// Created: 2020-01-24 -// Copyright(c) 2020 SimonG. All Rights Reserved. - -using System; -using GBase.Interfaces; - -namespace GBase.Attributes -{ - /// - /// Tags a property as an - /// - [AttributeUsage(AttributeTargets.Property)] - public class GBaseEntryAttribute : Attribute - { - /// - /// The value of the linked property changed - /// - public event EventHandler ValueChanged; //TODO: Automatically fire this event if the value of the linked property changes and subscribe to it in the correct IGBaseEntry - } +// Author: Gockner, Simon +// Created: 2020-01-24 +// Copyright(c) 2020 SimonG. All Rights Reserved. + +using System; +using GBase.Interfaces; + +namespace GBase.Attributes +{ + /// + /// Tags a property as an + /// + [AttributeUsage(AttributeTargets.Property)] + public class GBaseColumnAttribute : Attribute + { + /// + /// The value of the linked property changed + /// + public event EventHandler ValueChanged; //TODO: Automatically fire this event if the value of the linked property changes and subscribe to it in the correct IGBaseColumn (remove?) + } } \ No newline at end of file diff --git a/GBase/Diagnosis/GBaseTableEntryAnalyzer.cs b/GBase/Diagnosis/GBaseTableColumnAnalyzer.cs similarity index 50% rename from GBase/Diagnosis/GBaseTableEntryAnalyzer.cs rename to GBase/Diagnosis/GBaseTableColumnAnalyzer.cs index 96503ca..0fc26eb 100644 --- a/GBase/Diagnosis/GBaseTableEntryAnalyzer.cs +++ b/GBase/Diagnosis/GBaseTableColumnAnalyzer.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; +using GBase.Attributes; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -11,28 +12,42 @@ using Microsoft.CodeAnalysis.Diagnostics; namespace GBase.Diagnosis { [DiagnosticAnalyzer(LanguageNames.CSharp)] - public class GBaseTableEntryAnalyzer : DiagnosticAnalyzer + public class GBaseTableColumnAnalyzer : DiagnosticAnalyzer { - private const string DIAGNOSTIC_ID = "GBaseTableEntryAnalyzer"; - private const string CATEGORY = "GBaseTableEntryAnalyzer Category"; + private const string DIAGNOSTIC_ID = "GBaseTableColumnAnalyzer"; + private const string CATEGORY = "GBaseTableColumnAnalyzer Category"; - private static readonly LocalizableString _title = "Missing GBaseEntries for this GBaseTable"; - private static readonly LocalizableString _messageFormat = "Type '{0}' is marked as GBaseTable but doesn't contain any GBase entries."; + private static readonly LocalizableString _title = "Missing GBaseColumns for this GBaseTable"; + private static readonly LocalizableString _messageFormat = "Type '{0}' is marked as GBaseTable but doesn't contain any GBase columns."; private static readonly DiagnosticDescriptor _rule = new DiagnosticDescriptor(DIAGNOSTIC_ID, _title, _messageFormat, CATEGORY, DiagnosticSeverity.Warning, true); - public override ImmutableArray SupportedDiagnostics { get { return ImmutableArray.Create(_rule); } } + private bool _nodeAnalyzed; + + public override ImmutableArray SupportedDiagnostics => ImmutableArray.Create(_rule); + + private List TableClasses { get; } public override void Initialize(AnalysisContext context) { context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics); context.EnableConcurrentExecution(); - context.RegisterSyntaxNodeAction(AnalyzeNode, SyntaxKind.Attribute); + context.RegisterSyntaxNodeAction(AnalyzeClass, SyntaxKind.ClassDeclaration); + context.RegisterSyntaxNodeAction(AnalyzeMethod, SyntaxKind.MethodDeclaration); } - private void AnalyzeNode(SyntaxNodeAnalysisContext context) + private void AnalyzeClass(SyntaxNodeAnalysisContext context) { - AttributeSyntax attribute = (AttributeSyntax) context.Node; + ClassDeclarationSyntax classDeclaration = (ClassDeclarationSyntax) context.Node; + if (!classDeclaration.AttributeLists.SelectMany(l => l.Attributes).Any(a => a.Name.ToString().Equals(nameof(GBaseTableAttribute)))) + return; + + _nodeAnalyzed = true; + } + + private void AnalyzeMethod(SyntaxNodeAnalysisContext context) + { + } } } diff --git a/GBase/Factories/IGBaseEntryFactory.cs b/GBase/Factories/IGBaseColumnFactory.cs similarity index 58% rename from GBase/Factories/IGBaseEntryFactory.cs rename to GBase/Factories/IGBaseColumnFactory.cs index cff18b9..46f5b4c 100644 --- a/GBase/Factories/IGBaseEntryFactory.cs +++ b/GBase/Factories/IGBaseColumnFactory.cs @@ -8,14 +8,14 @@ using GBase.Interfaces; namespace GBase.Factories { /// - /// Factory for the + /// Factory for the /// - public interface IGBaseEntryFactory + public interface IGBaseColumnFactory { /// - /// Creates an + /// Creates an /// - /// A newly created instance of the implementation for - IGBaseEntry Create(); + /// A newly created instance of the implementation for + IGBaseColumn Create(); } } \ No newline at end of file diff --git a/GBase/GBase.xml b/GBase/GBase.xml index 61527f0..8f207f2 100644 --- a/GBase/GBase.xml +++ b/GBase/GBase.xml @@ -4,12 +4,12 @@ GBase - + - Tags a property as an + Tags a property as an - + The value of the linked property changed @@ -360,16 +360,16 @@ The of the passed interface - + - Factory for the + Factory for the - + - Creates an + Creates an - A newly created instance of the implementation for + A newly created instance of the implementation for @@ -410,6 +410,17 @@ Internal file handler + + + Internal file handler + + Factory for the + + + + The of this + + Initialize this @@ -418,6 +429,44 @@ A to cancel the asynchronous operation True if successful, false if not + + + Set the value for the given property + + The of the property + The of the property + The name of the property + The value to set + A to await + + + + Remove the value for the given property + + The of the property + The of the property + The name of the property + The value to set + A to await + + + + Get the value for the given property, if multiple values are set the first is returned + + The of the property + The of the property + The name of the property + The value for the given property + + + + Get all the values that are set for the given property + + The of the property + The of the property + The name of the property + An with all the values for the property + Dispose used resources asynchronously @@ -485,22 +534,28 @@ A to await - + - An entry of a + A column of a - + - An entry of a + A column of a + + + + + The method + A to await A table - + A table @@ -515,9 +570,9 @@ The name of this - + - The s of this + The s of this @@ -530,18 +585,18 @@ A to cancel the asynchronous operation True if successful, false if not - + - Add a given to this + Add a given to this - The given + The given True if successful, false if not - + - Remove a given from this + Remove a given from this - The given + The given True if successful, false if not @@ -807,6 +862,44 @@ A to cancel the asynchronous operation True if successful, false if not + + + Set the value for the given property + + The of the property + The of the property + The name of the property + The value to set + A to await + + + + Remove the value for the given property + + The of the property + The of the property + The name of the property + The value to set + A to await + + + + Get the value for the given property, if multiple values are set the first is returned + + The of the property + The of the property + The name of the property + The value for the given property + + + + Get all the values that are set for the given property + + The of the property + The of the property + The name of the property + An with all the values for the property + The base class of the GBase database @@ -850,9 +943,9 @@ The given True if successful, false if not - + - An entry of a + A column of a @@ -870,9 +963,9 @@ The name of this - + - The s of this + The s of this @@ -885,18 +978,18 @@ A to cancel the asynchronous operation True if successful, false if not - + - Add a given to this + Add a given to this - The given + The given True if successful, false if not - + - Remove a given from this + Remove a given from this - The given + The given True if successful, false if not diff --git a/GBase/GBaseEntry.cs b/GBase/GBaseColumn.cs similarity index 73% rename from GBase/GBaseEntry.cs rename to GBase/GBaseColumn.cs index 0cbab3b..ee3f45b 100644 --- a/GBase/GBaseEntry.cs +++ b/GBase/GBaseColumn.cs @@ -1,33 +1,33 @@ -// Author: Gockner, Simon -// Created: 2020-01-27 -// Copyright(c) 2020 SimonG. All Rights Reserved. - -using System; -using System.Threading.Tasks; -using GBase.Interfaces; - -namespace GBase -{ - /// - /// An entry of a - /// - public class GBaseEntry : IGBaseEntry - { - /// - /// An entry of a - /// - public GBaseEntry() - { - - } - - /// - /// The method - /// - /// A to await - public async ValueTask DisposeAsync() - { - - } - } +// Author: Gockner, Simon +// Created: 2020-01-27 +// Copyright(c) 2020 SimonG. All Rights Reserved. + +using System; +using System.Threading.Tasks; +using GBase.Interfaces; + +namespace GBase +{ + /// + /// A column of a + /// + public class GBaseColumn : IGBaseColumn + { + /// + /// A column of a + /// + public GBaseColumn() + { + + } + + /// + /// The method + /// + /// A to await + public async ValueTask DisposeAsync() + { + + } + } } \ No newline at end of file diff --git a/GBase/GBaseTable.cs b/GBase/GBaseTable.cs index b9f2751..837808a 100644 --- a/GBase/GBaseTable.cs +++ b/GBase/GBaseTable.cs @@ -22,16 +22,16 @@ namespace GBase public class GBaseTable : IGBaseTable { private readonly IFileHandler _fileHandler; - private readonly IGBaseEntryFactory _gBaseEntryFactory; + private readonly IGBaseColumnFactory _gBaseColumnFactory; /// /// A table /// - public GBaseTable(IFileHandlerFactory fileHandlerFactory, IGBaseEntryFactory gBaseEntryFactory) + public GBaseTable(IFileHandlerFactory fileHandlerFactory, IGBaseColumnFactory gBaseColumnFactory) { _fileHandler = fileHandlerFactory.Create(); - _gBaseEntryFactory = gBaseEntryFactory; - Entries = new List(); + _gBaseColumnFactory = gBaseColumnFactory; + Columns = new List(); } /// @@ -45,9 +45,9 @@ namespace GBase public string Name { get; private set; } /// - /// The s of this + /// The s of this /// - public List Entries { get; } + public List Columns { get; } /// @@ -67,45 +67,45 @@ namespace GBase string path = Path.Combine(databasePath, fileName); await _fileHandler.Init(path, cancellationToken); - //TODO: Init Entries list depending on GBaseEntryAttributes set for this GBaseTable + //TODO: Init columns list depending on GBaseColumnAttributes set for this GBaseTable foreach (var property in type.GetProperties()) { - GBaseEntryAttribute gBaseEntryAttribute = property.GetCustomAttribute(); - if (gBaseEntryAttribute == null) + GBaseColumnAttribute gBaseColumnAttribute = property.GetCustomAttribute(); + if (gBaseColumnAttribute == null) continue; - IGBaseEntry gBaseEntry = _gBaseEntryFactory.Create(); - AddEntry(gBaseEntry); + IGBaseColumn gBaseColumn = _gBaseColumnFactory.Create(); + AddColumn(gBaseColumn); } return true; } /// - /// Add a given to this + /// Add a given to this /// - /// The given + /// The given /// True if successful, false if not - public bool AddEntry(IGBaseEntry entry) + public bool AddColumn(IGBaseColumn column) { - if (Entries.Contains(entry)) + if (Columns.Contains(column)) return false; - Entries.Add(entry); + Columns.Add(column); return true; } /// - /// Remove a given from this + /// Remove a given from this /// - /// The given + /// The given /// True if successful, false if not - public bool RemoveEntry(IGBaseEntry entry) + public bool RemoveColumn(IGBaseColumn column) { - if (!Entries.Contains(entry)) + if (!Columns.Contains(column)) return false; - return Entries.Remove(entry); + return Columns.Remove(column); } /// @@ -116,12 +116,12 @@ namespace GBase { await _fileHandler.DisposeAsync(); - foreach (var entry in Entries) + foreach (var column in Columns) { - await entry.DisposeAsync(); + await column.DisposeAsync(); } - Entries.Clear(); + Columns.Clear(); } } } \ No newline at end of file diff --git a/GBase/Installers/GBaseInstaller.cs b/GBase/Installers/GBaseInstaller.cs index a7258a1..9ace16d 100644 --- a/GBase/Installers/GBaseInstaller.cs +++ b/GBase/Installers/GBaseInstaller.cs @@ -20,12 +20,12 @@ namespace GBase.Installers { container.Register(); container.Register(); - container.Register(); + container.Register(); //factories container.RegisterFactory(); container.RegisterFactory(); - container.RegisterFactory(); + container.RegisterFactory(); } } } \ No newline at end of file diff --git a/GBase/Interfaces/IGBaseEntry.cs b/GBase/Interfaces/IGBaseColumn.cs similarity index 51% rename from GBase/Interfaces/IGBaseEntry.cs rename to GBase/Interfaces/IGBaseColumn.cs index f2de039..d78a691 100644 --- a/GBase/Interfaces/IGBaseEntry.cs +++ b/GBase/Interfaces/IGBaseColumn.cs @@ -1,16 +1,16 @@ -// Author: Gockner, Simon -// Created: 2020-01-24 -// Copyright(c) 2020 SimonG. All Rights Reserved. - -using System; - -namespace GBase.Interfaces -{ - /// - /// An entry of a - /// - public interface IGBaseEntry : IAsyncDisposable //TODO: Make entry generic (generic type is type of the value of the entry?) - { - - } +// Author: Gockner, Simon +// Created: 2020-01-24 +// Copyright(c) 2020 SimonG. All Rights Reserved. + +using System; + +namespace GBase.Interfaces +{ + /// + /// A column of a + /// + public interface IGBaseColumn : IAsyncDisposable //TODO: Make column generic (generic type is type of the value of the column?)? + { + + } } \ No newline at end of file diff --git a/GBase/Interfaces/IGBaseTable.cs b/GBase/Interfaces/IGBaseTable.cs index bb52f3e..1ab6542 100644 --- a/GBase/Interfaces/IGBaseTable.cs +++ b/GBase/Interfaces/IGBaseTable.cs @@ -25,9 +25,9 @@ namespace GBase.Interfaces string Name { get; } /// - /// The s of this + /// The s of this /// - List Entries { get; } + List Columns { get; } /// /// Initialize this @@ -40,18 +40,18 @@ namespace GBase.Interfaces Task Init(Type type, string name, string databasePath, CancellationToken cancellationToken); /// - /// Add a given to this + /// Add a given to this /// - /// The given + /// The given /// True if successful, false if not - bool AddEntry(IGBaseEntry entry); + bool AddColumn(IGBaseColumn column); /// - /// Remove a given from this + /// Remove a given from this /// - /// The given + /// The given /// True if successful, false if not - bool RemoveEntry(IGBaseEntry entry); + bool RemoveColumn(IGBaseColumn column); } } \ No newline at end of file diff --git a/Test.GBase.Client/IntegrationTest.cs b/Test.GBase.Client/IntegrationTest.cs index 37c4d7a..63ca845 100644 --- a/Test.GBase.Client/IntegrationTest.cs +++ b/Test.GBase.Client/IntegrationTest.cs @@ -1,7 +1,6 @@ using System.Net; using GBase.Api.Communication; using GBase.Client; -using GBase.Client.Factories; using GBase.Client.Interfaces; using GBase.Client.Services.Factories; using Moq; @@ -20,11 +19,11 @@ namespace Test.GBase.Client [Test] public void CheckBasicConnectionWithServer() { - Assert.Pass(); //Remove this assert if you want to run the test, not possible to with CI + Assert.Pass(); //Remove this assert if you want to run the test, not possible with CI IGBaseClientSettings settings = - new GBaseClientSettings(ServerProtocol.Http, IPAddress.Parse("127.0.0.1"), 8080, "/GBase", "/GBaseTable", "/GBaseEntry"); - IGBaseClient client = new GBaseClient(settings, new Mock().Object, new Mock().Object, new Mock().Object); + new GBaseClientSettings(ServerProtocol.Http, IPAddress.Parse("127.0.0.1"), 8080, "/GBase", "/GBaseTable", "/GBaseColumn"); + IGBaseClient client = new GBaseClient(settings, new Mock().Object, new Mock().Object, new Mock().Object); bool ret = client.GBase.AddTable(); Assert.True(ret); diff --git a/Test.GBase/TestClasses/Foo.cs b/Test.GBase/TestClasses/Foo.cs index 20dd82e..442b277 100644 --- a/Test.GBase/TestClasses/Foo.cs +++ b/Test.GBase/TestClasses/Foo.cs @@ -12,7 +12,7 @@ namespace Test.GBase.TestClasses { private string _name; - [GBaseEntry] + [GBaseColumn] public string Name { get => _name;