- start adding complete GBase integration

pull/27/head
Simon G 5 years ago
parent 488fad44a1
commit 2e2c0f74c2
  1. 21
      Test.GBase/GBaseIntegrationTest/Group.cs
  2. 14
      Test.GBase/GBaseIntegrationTest/IGroup.cs
  3. 13
      Test.GBase/GBaseIntegrationTest/IItem.cs
  4. 15
      Test.GBase/GBaseIntegrationTest/Item.cs
  5. 51
      Test.GBase/GBaseIntegrationTest/Model.cs
  6. 13
      Test.GBase/GBaseIntegrationTest/Settings.cs

@ -0,0 +1,21 @@
// Author: Gockner, Simon
// Created: 2020-09-18
// Copyright(c) 2020 SimonG. All Rights Reserved.
using System.Collections.Generic;
using GBase.Api;
using GBase.Attributes;
namespace Test.GBase.GBaseIntegrationTest
{
[GBaseTable]
public class Group : NotifyGBaseEntryChanged, IGroup
{
public Group()
{
Items = new List<IItem>();
}
public List<IItem> Items { get; }
}
}

@ -0,0 +1,14 @@
// Author: Gockner, Simon
// Created: 2020-09-18
// Copyright(c) 2020 SimonG. All Rights Reserved.
using System.Collections.Generic;
using GBase.Api;
namespace Test.GBase.GBaseIntegrationTest
{
public interface IGroup : INotifyGBaseEntryChanged
{
List<IItem> Items { get; }
}
}

@ -0,0 +1,13 @@
// Author: Gockner, Simon
// Created: 2020-09-18
// Copyright(c) 2020 SimonG. All Rights Reserved.
using GBase.Api;
namespace Test.GBase.GBaseIntegrationTest
{
public interface IItem : INotifyGBaseEntryChanged
{
}
}

@ -0,0 +1,15 @@
// Author: Gockner, Simon
// Created: 2020-09-18
// Copyright(c) 2020 SimonG. All Rights Reserved.
using GBase.Api;
using GBase.Attributes;
namespace Test.GBase.GBaseIntegrationTest
{
[GBaseTable]
public class Item : NotifyGBaseEntryChanged, IItem
{
}
}

@ -0,0 +1,51 @@
// Author: Gockner, Simon
// Created: 2020-09-18
// Copyright(c) 2020 SimonG. All Rights Reserved.
using System.Collections.Generic;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using GBase.Factories;
using GBase.Interfaces;
namespace Test.GBase.GBaseIntegrationTest
{
public class Model
{
private readonly IGBase _gBase;
public Model(IGBaseFactory gBaseFactory)
{
_gBase = gBaseFactory.Create(new Settings());
Items = new List<IItem>();
Groups = new List<IGroup>();
}
public List<IItem> Items { get; private set; }
public List<IGroup> Groups { get; private set; }
public async Task Initialize(CancellationToken cancellationToken)
{
await _gBase.Init("DB", Assembly.GetExecutingAssembly(), cancellationToken);
IGBaseTable<IItem> itemsTable = _gBase.GetTable<IItem>();
Items = itemsTable.Entries;
IGBaseTable<IGroup> groupsTable = _gBase.GetTable<IGroup>();
Groups = groupsTable.Entries;
}
public void AddItem(IItem item)
{
Items.Add(item);
_gBase.AddEntry(item);
}
public void AddGroup(IGroup group)
{
Groups.Add(group);
_gBase.AddEntry(@group);
}
}
}

@ -0,0 +1,13 @@
// Author: Gockner, Simon
// Created: 2020-09-18
// Copyright(c) 2020 SimonG. All Rights Reserved.
using GBase.Interfaces.Settings;
namespace Test.GBase.GBaseIntegrationTest
{
public class Settings : IGBaseSettings
{
public string DatabasePath => "";
}
}
Loading…
Cancel
Save