- adapt to changed IGBaseObject

master
Simon G 5 years ago
parent 5929e13dca
commit 81309b9839
  1. 4
      GBase/GBaseObject.cs
  2. 2
      GBase/Helpers/Enumerables.cs
  3. 19
      Test.GBase/GBaseIntegrationTest/Group.cs
  4. 3
      Test.GBase/GBaseIntegrationTest/IGroup.cs
  5. 4
      Test.GBase/GBaseIntegrationTest/IItem.cs
  6. 18
      Test.GBase/GBaseIntegrationTest/Item.cs
  7. 5
      Test.GBase/TestClasses/Foo.cs
  8. 1
      Test.GBase/TestClasses/IUserType.cs
  9. 4
      Test.GBase/TestClasses/UserType.cs

@ -5,7 +5,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using GBase.Api;
using GBase.Exceptions; using GBase.Exceptions;
using GBase.Interfaces; using GBase.Interfaces;
@ -29,6 +28,7 @@ namespace GBase
throw new MissingTableException<T>(); throw new MissingTableException<T>();
} }
public GBaseKey Key { get; set; }
public abstract string FileName { get; } public abstract string FileName { get; }
protected async Task SetValue<TProperty>(T @this, string propertyName, TProperty value, CancellationToken cancellationToken) => protected async Task SetValue<TProperty>(T @this, string propertyName, TProperty value, CancellationToken cancellationToken) =>
@ -46,6 +46,6 @@ namespace GBase
/// <param name="string">The given <see cref="string"/></param> /// <param name="string">The given <see cref="string"/></param>
public abstract void InitializeFromString(string @string); public abstract void InitializeFromString(string @string);
public abstract void Initialize(List<object> parameters); public abstract void Initialize(GBaseKey key, List<object> parameters);
} }
} }

@ -7,8 +7,8 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using GBase.Api;
using GBase.Exceptions; using GBase.Exceptions;
using GBase.Interfaces;
namespace GBase.Helpers namespace GBase.Helpers
{ {

@ -3,6 +3,7 @@
// Copyright(c) 2020 SimonG. All Rights Reserved. // Copyright(c) 2020 SimonG. All Rights Reserved.
using System.Collections.Generic; using System.Collections.Generic;
using GBase;
using GBase.Attributes; using GBase.Attributes;
namespace Test.GBase.GBaseIntegrationTest namespace Test.GBase.GBaseIntegrationTest
@ -15,22 +16,24 @@ namespace Test.GBase.GBaseIntegrationTest
Items = new List<IItem>(); Items = new List<IItem>();
} }
public Group(int key) public Group(int number)
{ {
Key = key; Number = number;
Items = new List<IItem>(); Items = new List<IItem>();
} }
[GBaseColumn] [GBaseColumn]
public int Key { get; private set; } public int Number { get; private set; }
public List<IItem> Items { get; } public List<IItem> Items { get; }
public string FileName => $"Group{Key}"; public GBaseKey Key { get; set; }
public string FileName => $"Group{Number}";
public override string ToString() => $"{Key}"; public override string ToString() => $"{Number}";
public void InitializeFromString(string @string) => Key = int.Parse(@string); public void InitializeFromString(string @string) => Number = int.Parse(@string);
public void Initialize(List<object> parameters) public void Initialize(GBaseKey key, List<object> parameters)
{ {
Key = (int) parameters[0]; Key = key;
Number = (int) parameters[0];
} }
} }
} }

@ -4,12 +4,13 @@
using System.Collections.Generic; using System.Collections.Generic;
using GBase.Api; using GBase.Api;
using GBase.Interfaces;
namespace Test.GBase.GBaseIntegrationTest namespace Test.GBase.GBaseIntegrationTest
{ {
public interface IGroup : IGBaseObject //: INotifyGBaseEntryChanged public interface IGroup : IGBaseObject //: INotifyGBaseEntryChanged
{ {
int Key { get; } int Number { get; }
List<IItem> Items { get; } List<IItem> Items { get; }
} }
} }

@ -2,13 +2,13 @@
// Created: 2020-09-18 // Created: 2020-09-18
// Copyright(c) 2020 SimonG. All Rights Reserved. // Copyright(c) 2020 SimonG. All Rights Reserved.
using GBase.Api; using GBase.Interfaces;
namespace Test.GBase.GBaseIntegrationTest namespace Test.GBase.GBaseIntegrationTest
{ {
public interface IItem : IGBaseObject //: INotifyGBaseEntryChanged public interface IItem : IGBaseObject //: INotifyGBaseEntryChanged
{ {
string Name { get; } string Name { get; }
int Key { get; } int Number { get; }
} }
} }

@ -3,6 +3,7 @@
// Copyright(c) 2020 SimonG. All Rights Reserved. // Copyright(c) 2020 SimonG. All Rights Reserved.
using System.Collections.Generic; using System.Collections.Generic;
using GBase;
using GBase.Attributes; using GBase.Attributes;
namespace Test.GBase.GBaseIntegrationTest 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; Name = name;
Key = key; Number = number;
} }
[GBaseColumn] [GBaseColumn]
public string Name { get; private set; } public string Name { get; private set; }
[GBaseColumn] [GBaseColumn]
public int Key { get; private set; } public int Number { get; private set; }
public GBaseKey Key { get; set; }
public string FileName => Name; public string FileName => Name;
public override string ToString() => $"{Key}/{Name}"; public override string ToString() => $"{Number}/{Name}";
public void InitializeFromString(string @string) public void InitializeFromString(string @string)
{ {
string[] properties = @string.Split('/'); string[] properties = @string.Split('/');
Key = int.Parse(properties[0]); Number = int.Parse(properties[0]);
Name = properties[1]; Name = properties[1];
} }
public void Initialize(List<object> parameters) public void Initialize(GBaseKey key, List<object> parameters)
{ {
Key = key;
Name = (string) parameters[0]; Name = (string) parameters[0];
Key = (int) parameters[1]; Number = (int) parameters[1];
} }
} }
} }

@ -4,8 +4,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using GBase;
using GBase.Api; using GBase.Api;
using GBase.Attributes; using GBase.Attributes;
using GBase.Interfaces;
namespace Test.GBase.TestClasses namespace Test.GBase.TestClasses
{ {
@ -35,6 +37,7 @@ namespace Test.GBase.TestClasses
} }
} }
public GBaseKey Key { get; set; }
public string FileName => Name; public string FileName => Name;
public void InitializeFromString(string @string) public void InitializeFromString(string @string)
@ -42,7 +45,7 @@ namespace Test.GBase.TestClasses
throw new NotImplementedException(); throw new NotImplementedException();
} }
public void Initialize(List<object> parameters) public void Initialize(GBaseKey key, List<object> parameters)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

@ -3,6 +3,7 @@
// Copyright(c) 2020 SimonG. All Rights Reserved. // Copyright(c) 2020 SimonG. All Rights Reserved.
using GBase.Api; using GBase.Api;
using GBase.Interfaces;
namespace Test.GBase.TestClasses namespace Test.GBase.TestClasses
{ {

@ -5,6 +5,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using GBase;
namespace Test.GBase.TestClasses namespace Test.GBase.TestClasses
{ {
@ -22,6 +23,7 @@ namespace Test.GBase.TestClasses
private int Number { get; set; } private int Number { get; set; }
public GBaseKey Key { get; set; }
public string FileName { get; } public string FileName { get; }
public void InitializeFromString(string @string) public void InitializeFromString(string @string)
@ -30,7 +32,7 @@ namespace Test.GBase.TestClasses
Number = Convert.ToInt32(numberString); Number = Convert.ToInt32(numberString);
} }
public void Initialize(List<object> parameters) public void Initialize(GBaseKey key, List<object> parameters)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

Loading…
Cancel
Save