From 81309b9839b112ea8a5cb0b868ba74d1aac40698 Mon Sep 17 00:00:00 2001 From: Simon G Date: Fri, 13 Nov 2020 17:01:17 +0100 Subject: [PATCH] - adapt to changed IGBaseObject --- GBase/GBaseObject.cs | 4 ++-- GBase/Helpers/Enumerables.cs | 2 +- Test.GBase/GBaseIntegrationTest/Group.cs | 19 +++++++++++-------- Test.GBase/GBaseIntegrationTest/IGroup.cs | 3 ++- Test.GBase/GBaseIntegrationTest/IItem.cs | 4 ++-- Test.GBase/GBaseIntegrationTest/Item.cs | 18 +++++++++++------- Test.GBase/TestClasses/Foo.cs | 5 ++++- Test.GBase/TestClasses/IUserType.cs | 1 + Test.GBase/TestClasses/UserType.cs | 4 +++- 9 files changed, 37 insertions(+), 23 deletions(-) diff --git a/GBase/GBaseObject.cs b/GBase/GBaseObject.cs index 57c5401..f4d3939 100644 --- a/GBase/GBaseObject.cs +++ b/GBase/GBaseObject.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using GBase.Api; using GBase.Exceptions; using GBase.Interfaces; @@ -29,6 +28,7 @@ namespace GBase throw new MissingTableException(); } + public GBaseKey Key { get; set; } public abstract string FileName { get; } protected async Task SetValue(T @this, string propertyName, TProperty value, CancellationToken cancellationToken) => @@ -46,6 +46,6 @@ namespace GBase /// The given public abstract void InitializeFromString(string @string); - public abstract void Initialize(List parameters); + public abstract void Initialize(GBaseKey key, List parameters); } } \ No newline at end of file diff --git a/GBase/Helpers/Enumerables.cs b/GBase/Helpers/Enumerables.cs index 4be68df..bcf366c 100644 --- a/GBase/Helpers/Enumerables.cs +++ b/GBase/Helpers/Enumerables.cs @@ -7,8 +7,8 @@ using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; -using GBase.Api; using GBase.Exceptions; +using GBase.Interfaces; namespace GBase.Helpers { diff --git a/Test.GBase/GBaseIntegrationTest/Group.cs b/Test.GBase/GBaseIntegrationTest/Group.cs index 97c7908..970712f 100644 --- a/Test.GBase/GBaseIntegrationTest/Group.cs +++ b/Test.GBase/GBaseIntegrationTest/Group.cs @@ -3,6 +3,7 @@ // Copyright(c) 2020 SimonG. All Rights Reserved. using System.Collections.Generic; +using GBase; using GBase.Attributes; namespace Test.GBase.GBaseIntegrationTest @@ -15,22 +16,24 @@ namespace Test.GBase.GBaseIntegrationTest Items = new List(); } - public Group(int key) + public Group(int number) { - Key = key; + Number = number; Items = new List(); } [GBaseColumn] - public int Key { get; private set; } + public int Number { get; private set; } public List Items { get; } - public string FileName => $"Group{Key}"; + public GBaseKey Key { get; set; } + public string FileName => $"Group{Number}"; - public override string ToString() => $"{Key}"; - public void InitializeFromString(string @string) => Key = int.Parse(@string); - public void Initialize(List parameters) + public override string ToString() => $"{Number}"; + public void InitializeFromString(string @string) => Number = int.Parse(@string); + public void Initialize(GBaseKey key, List parameters) { - Key = (int) parameters[0]; + Key = key; + Number = (int) parameters[0]; } } } \ No newline at end of file diff --git a/Test.GBase/GBaseIntegrationTest/IGroup.cs b/Test.GBase/GBaseIntegrationTest/IGroup.cs index 1957f03..848f881 100644 --- a/Test.GBase/GBaseIntegrationTest/IGroup.cs +++ b/Test.GBase/GBaseIntegrationTest/IGroup.cs @@ -4,12 +4,13 @@ using System.Collections.Generic; using GBase.Api; +using GBase.Interfaces; namespace Test.GBase.GBaseIntegrationTest { public interface IGroup : IGBaseObject //: INotifyGBaseEntryChanged { - int Key { get; } + int Number { get; } List Items { get; } } } \ No newline at end of file diff --git a/Test.GBase/GBaseIntegrationTest/IItem.cs b/Test.GBase/GBaseIntegrationTest/IItem.cs index 8aaea05..8c8533b 100644 --- a/Test.GBase/GBaseIntegrationTest/IItem.cs +++ b/Test.GBase/GBaseIntegrationTest/IItem.cs @@ -2,13 +2,13 @@ // Created: 2020-09-18 // Copyright(c) 2020 SimonG. All Rights Reserved. -using GBase.Api; +using GBase.Interfaces; namespace Test.GBase.GBaseIntegrationTest { public interface IItem : IGBaseObject //: INotifyGBaseEntryChanged { string Name { get; } - int Key { get; } + int Number { get; } } } \ No newline at end of file diff --git a/Test.GBase/GBaseIntegrationTest/Item.cs b/Test.GBase/GBaseIntegrationTest/Item.cs index 19ccdf3..65e372f 100644 --- a/Test.GBase/GBaseIntegrationTest/Item.cs +++ b/Test.GBase/GBaseIntegrationTest/Item.cs @@ -3,6 +3,7 @@ // Copyright(c) 2020 SimonG. All Rights Reserved. using System.Collections.Generic; +using GBase; using GBase.Attributes; namespace Test.GBase.GBaseIntegrationTest @@ -15,33 +16,36 @@ namespace Test.GBase.GBaseIntegrationTest } - public Item(string name, int key) + public Item(string name, int number) { Name = name; - Key = key; + Number = number; } [GBaseColumn] public string Name { get; private set; } [GBaseColumn] - public int Key { get; private set; } + public int Number { get; private set; } + + public GBaseKey Key { get; set; } public string FileName => Name; - public override string ToString() => $"{Key}/{Name}"; + public override string ToString() => $"{Number}/{Name}"; public void InitializeFromString(string @string) { string[] properties = @string.Split('/'); - Key = int.Parse(properties[0]); + Number = int.Parse(properties[0]); Name = properties[1]; } - public void Initialize(List parameters) + public void Initialize(GBaseKey key, List parameters) { + Key = key; Name = (string) parameters[0]; - Key = (int) parameters[1]; + Number = (int) parameters[1]; } } } \ No newline at end of file diff --git a/Test.GBase/TestClasses/Foo.cs b/Test.GBase/TestClasses/Foo.cs index 1ebc020..2aacb47 100644 --- a/Test.GBase/TestClasses/Foo.cs +++ b/Test.GBase/TestClasses/Foo.cs @@ -4,8 +4,10 @@ using System; using System.Collections.Generic; +using GBase; using GBase.Api; using GBase.Attributes; +using GBase.Interfaces; namespace Test.GBase.TestClasses { @@ -35,6 +37,7 @@ namespace Test.GBase.TestClasses } } + public GBaseKey Key { get; set; } public string FileName => Name; public void InitializeFromString(string @string) @@ -42,7 +45,7 @@ namespace Test.GBase.TestClasses throw new NotImplementedException(); } - public void Initialize(List parameters) + public void Initialize(GBaseKey key, List parameters) { throw new NotImplementedException(); } diff --git a/Test.GBase/TestClasses/IUserType.cs b/Test.GBase/TestClasses/IUserType.cs index 20b9f7c..cfc7211 100644 --- a/Test.GBase/TestClasses/IUserType.cs +++ b/Test.GBase/TestClasses/IUserType.cs @@ -3,6 +3,7 @@ // Copyright(c) 2020 SimonG. All Rights Reserved. using GBase.Api; +using GBase.Interfaces; namespace Test.GBase.TestClasses { diff --git a/Test.GBase/TestClasses/UserType.cs b/Test.GBase/TestClasses/UserType.cs index f5173c2..afbbad6 100644 --- a/Test.GBase/TestClasses/UserType.cs +++ b/Test.GBase/TestClasses/UserType.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; +using GBase; namespace Test.GBase.TestClasses { @@ -22,6 +23,7 @@ namespace Test.GBase.TestClasses private int Number { get; set; } + public GBaseKey Key { get; set; } public string FileName { get; } public void InitializeFromString(string @string) @@ -30,7 +32,7 @@ namespace Test.GBase.TestClasses Number = Convert.ToInt32(numberString); } - public void Initialize(List parameters) + public void Initialize(GBaseKey key, List parameters) { throw new NotImplementedException(); }