Fixed Fluent NHibernate for newer MariaDB versions
parent
4b2a01fe58
commit
f4690c2dd3
|
@ -4,7 +4,6 @@ public class Habbo
|
|||
{
|
||||
public virtual uint Id { get; set; }
|
||||
public virtual string Username { get; set; } = null!;
|
||||
public virtual string Password { get; set; } = null!;
|
||||
public virtual string Email { get; set; } = null!;
|
||||
public virtual DateTime AccountCreated { get; set; }
|
||||
public virtual DateTime? LastLogin { get; set; }
|
||||
|
|
|
@ -10,7 +10,6 @@ public class HabboMap : ClassMap<Habbo>
|
|||
LazyLoad();
|
||||
Id(h => h.Id).Column("id").GeneratedBy.Identity();
|
||||
Map(h => h.Username).Column("username").Not.Nullable();
|
||||
Map(h => h.Password).Column("password").Not.Nullable();
|
||||
Map(h => h.Email).Column("email").Not.Nullable();
|
||||
Map(h => h.AccountCreated).Column("account_created").Not.Nullable();
|
||||
Map(h => h.LastLogin).Column("last_login").Nullable();
|
||||
|
|
|
@ -2,6 +2,6 @@ namespace Tiger.Game.Settings;
|
|||
|
||||
public class Setting
|
||||
{
|
||||
public virtual string Key { get; set; } = string.Empty;
|
||||
public virtual string Value { get; set; } = string.Empty;
|
||||
public virtual string Key { get; set; } = null!;
|
||||
public virtual string Value { get; set; } = null!;
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
// using FluentNHibernate.Mapping;
|
||||
//
|
||||
// namespace Tiger.Game.Settings;
|
||||
//
|
||||
// public class SettingMap : ClassMap<Setting>
|
||||
// {
|
||||
// public SettingMap()
|
||||
// {
|
||||
// Table("settings");
|
||||
// Id(s => s.Key).Column("skey").Not.Nullable();
|
||||
// Map(s => s.Value).Column("value").Not.Nullable();
|
||||
// }
|
||||
// }
|
||||
using FluentNHibernate.Mapping;
|
||||
|
||||
namespace Tiger.Game.Settings;
|
||||
|
||||
public class SettingMap : ClassMap<Setting>
|
||||
{
|
||||
public SettingMap()
|
||||
{
|
||||
Table("settings");
|
||||
Id(s => s.Key).Column("skey").Not.Nullable();
|
||||
Map(s => s.Value).Column("value").Not.Nullable();
|
||||
}
|
||||
}
|
|
@ -2,8 +2,9 @@ using System.Reflection;
|
|||
using FluentNHibernate.Cfg;
|
||||
using FluentNHibernate.Cfg.Db;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MySql.Data.MySqlClient;
|
||||
using MySqlConnector;
|
||||
using NHibernate;
|
||||
using NHibernate.Driver.MySqlConnector;
|
||||
|
||||
namespace Tiger.Storage;
|
||||
|
||||
|
@ -26,7 +27,7 @@ public class NhSessionFactory : INhSessionFactory
|
|||
};
|
||||
|
||||
_sessionFactory = Fluently.Configure()
|
||||
.Database(MySQLConfiguration.Standard.ConnectionString(stringBuilder.ToString()).ShowSql())
|
||||
.Database(MySQLConfiguration.Standard.ConnectionString(stringBuilder.ToString()).Driver<MySqlConnectorDriver>())
|
||||
.Mappings(m => m.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly()))
|
||||
.BuildSessionFactory();
|
||||
}
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
<PackageReference Include="Microsoft.Extensions.Configuration.Yaml" Version="2.0.0-preview2" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0-rc.1.23419.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0-rc.1.23419.4" />
|
||||
<PackageReference Include="MySql.Data" Version="8.1.0" />
|
||||
<PackageReference Include="MySqlConnector" Version="2.3.0-beta.3" />
|
||||
<PackageReference Include="NHibernate.Driver.MySqlConnector" Version="2.0.5-ci.4" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="appsettings.yaml">
|
||||
|
|
Loading…
Reference in New Issue