I agree, I'll keep continuing this as I definitely enjoy it.
A few updates. It doesn't look spectacular, but in theory the navigator node packet took me hours to figure out as it works slightly different than v9 would. For people who are interested, I played around in Ion trying to get it working and I documented my foundings on the packet, this is 100% my discovery (with thanks to the people who made it possible for me to look into the Lingo scripts):
You must be registered to see links
The "my rooms" section is as easy as v9 but still a nice thing. All data is fetched from the database and thus not static placeholder data. My plan for today is to get room entry working - both public rooms and private rooms - and maybe a start on walking and talking.
Also due to how extremely "buggy" EF Core is (EF Core won't work with async method and I had to make everything sync in order for it to work properly, don't take buggy too serious but this is definitely something that annoyed me), I decided to switch back to Fluent NHibernate. This doesn't mean getting data is harder, it only means database seeding is a bit... different.
Basically, I got an interface which is the contract for the seeder classes:
PHP:
public interface IDataSeeder
{
IEnumerable<object> Data { get; }
void Seed();
}
(I still have to port this to C# 8.0 since C# 8.0 allows default implementation in interfaces)
This is an example of a DataSeeder class:
PHP:
public class RoleDataSeeder : IDataSeeder
{
public IEnumerable<object> Data => new[]
{
new Role() {Id = 1, Name = "Player"},
};
private readonly DbSessionFactory _dbSessionFactory;
public RoleDataSeeder(DbSessionFactory dbSessionFactory)
{
_dbSessionFactory = dbSessionFactory;
}
public void Seed()
{
var session = _dbSessionFactory.OpenSession();
if (!session.Query<Role>().IsEmpty()) return;
foreach (var obj in Data)
{
session.Save(obj);
}
}
}
When starting the server, after NHibernate is configured (and the database is created/updated if necessary), it executes the following code:
PHP:
foreach (var service in _serviceProvider.GetServices<IDataSeeder>())
{
service.Seed();
}
For every implementation of IDataSeeder it'll call the Seed function (and execute whatever code is in it). There are no migrations, but NHibernate will keep the database up to date with the code, meaning whenever a new column is added, it'll automatically add it on boot. Boot time will be a bit longer but it shouldn't be too bad.