diff --git a/_my_sql_database_context_8cs_source.html b/_my_sql_database_context_8cs_source.html index efb9961aa7..12410fc6f0 100644 --- a/_my_sql_database_context_8cs_source.html +++ b/_my_sql_database_context_8cs_source.html @@ -132,58 +132,59 @@ $(document).ready(function() { init_codefold(0); });
57 serverVersion,
58 mySqlOptions =>
59 {
-
60 mySqlOptions.EnableRetryOnFailure();
-
61 mySqlOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery);
-
62 });
-
63 }
+
60 mySqlOptions.TranslateParameterizedCollectionsToConstants();
+
61 mySqlOptions.EnableRetryOnFailure();
+
62 mySqlOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery);
+
63 });
+
64 }
-
64
-
-
66 protected override void OnModelCreating(ModelBuilder modelBuilder)
-
67 {
-
68 base.OnModelCreating(modelBuilder);
-
69
-
70 // Added to prevent a column type change after upgrading Pomelo.Mysql
-
71 // Related: https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/1606
-
72 modelBuilder
-
73 .MapMySqlTextField<ChatBot>(x => x.ConnectionString)
-
74 .MapMySqlTextField<ChatChannel>(x => x.Tag)
-
75 .MapMySqlTextField<ChatChannel>(x => x.IrcChannel)
-
76 .MapMySqlTextField<CompileJob>(x => x.EngineVersion)
-
77 .MapMySqlTextField<CompileJob>(x => x.DmeName)
-
78 .MapMySqlTextField<CompileJob>(x => x.Output)
-
79 .MapMySqlTextField<CompileJob>(x => x.RepositoryOrigin)
-
80 .MapMySqlTextField<DreamDaemonSettings>(x => x.AdditionalParameters)
-
81 .MapMySqlTextField<DreamMakerSettings>(x => x.ProjectName)
-
82 .MapMySqlTextField<Instance>(x => x.Name)
-
83 .MapMySqlTextField<Instance>(x => x.Path)
-
84 .MapMySqlTextField<Instance>(x => x.SwarmIdentifer)
-
85 .MapMySqlTextField<Job>(x => x.Description)
-
86 .MapMySqlTextField<Job>(x => x.ExceptionDetails)
-
87 .MapMySqlTextField<OAuthConnection>(x => x.ExternalUserId)
-
88 .MapMySqlTextField<ReattachInformation>(x => x.AccessIdentifier)
-
89 .MapMySqlTextField<RepositorySettings>(x => x.AccessToken)
-
90 .MapMySqlTextField<RepositorySettings>(x => x.AccessUser)
-
91 .MapMySqlTextField<RepositorySettings>(x => x.CommitterEmail)
-
92 .MapMySqlTextField<RepositorySettings>(x => x.CommitterName)
-
93 .MapMySqlTextField<RevisionInformation>(x => x.CommitSha)
-
94 .MapMySqlTextField<RevisionInformation>(x => x.OriginCommitSha)
-
95 .MapMySqlTextField<TestMerge>(x => x.Author)
-
96 .MapMySqlTextField<TestMerge>(x => x.BodyAtMerge)
-
97 .MapMySqlTextField<TestMerge>(x => x.Comment)
-
98 .MapMySqlTextField<TestMerge>(x => x.TargetCommitSha)
-
99 .MapMySqlTextField<TestMerge>(x => x.TitleAtMerge)
-
100 .MapMySqlTextField<TestMerge>(x => x.Url)
-
101 .MapMySqlTextField<User>(x => x.CanonicalName)
-
102 .MapMySqlTextField<User>(x => x.Name)
-
103 .MapMySqlTextField<User>(x => x.PasswordHash)
-
104 .MapMySqlTextField<User>(x => x.SystemIdentifier)
-
105 .MapMySqlTextField<UserGroup>(x => x.Name);
-
106 }
+
65
+
+
67 protected override void OnModelCreating(ModelBuilder modelBuilder)
+
68 {
+
69 base.OnModelCreating(modelBuilder);
+
70
+
71 // Added to prevent a column type change after upgrading Pomelo.Mysql
+
72 // Related: https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/1606
+
73 modelBuilder
+
74 .MapMySqlTextField<ChatBot>(x => x.ConnectionString)
+
75 .MapMySqlTextField<ChatChannel>(x => x.Tag)
+
76 .MapMySqlTextField<ChatChannel>(x => x.IrcChannel)
+
77 .MapMySqlTextField<CompileJob>(x => x.EngineVersion)
+
78 .MapMySqlTextField<CompileJob>(x => x.DmeName)
+
79 .MapMySqlTextField<CompileJob>(x => x.Output)
+
80 .MapMySqlTextField<CompileJob>(x => x.RepositoryOrigin)
+
81 .MapMySqlTextField<DreamDaemonSettings>(x => x.AdditionalParameters)
+
82 .MapMySqlTextField<DreamMakerSettings>(x => x.ProjectName)
+
83 .MapMySqlTextField<Instance>(x => x.Name)
+
84 .MapMySqlTextField<Instance>(x => x.Path)
+
85 .MapMySqlTextField<Instance>(x => x.SwarmIdentifer)
+
86 .MapMySqlTextField<Job>(x => x.Description)
+
87 .MapMySqlTextField<Job>(x => x.ExceptionDetails)
+
88 .MapMySqlTextField<OAuthConnection>(x => x.ExternalUserId)
+
89 .MapMySqlTextField<ReattachInformation>(x => x.AccessIdentifier)
+
90 .MapMySqlTextField<RepositorySettings>(x => x.AccessToken)
+
91 .MapMySqlTextField<RepositorySettings>(x => x.AccessUser)
+
92 .MapMySqlTextField<RepositorySettings>(x => x.CommitterEmail)
+
93 .MapMySqlTextField<RepositorySettings>(x => x.CommitterName)
+
94 .MapMySqlTextField<RevisionInformation>(x => x.CommitSha)
+
95 .MapMySqlTextField<RevisionInformation>(x => x.OriginCommitSha)
+
96 .MapMySqlTextField<TestMerge>(x => x.Author)
+
97 .MapMySqlTextField<TestMerge>(x => x.BodyAtMerge)
+
98 .MapMySqlTextField<TestMerge>(x => x.Comment)
+
99 .MapMySqlTextField<TestMerge>(x => x.TargetCommitSha)
+
100 .MapMySqlTextField<TestMerge>(x => x.TitleAtMerge)
+
101 .MapMySqlTextField<TestMerge>(x => x.Url)
+
102 .MapMySqlTextField<User>(x => x.CanonicalName)
+
103 .MapMySqlTextField<User>(x => x.Name)
+
104 .MapMySqlTextField<User>(x => x.PasswordHash)
+
105 .MapMySqlTextField<User>(x => x.SystemIdentifier)
+
106 .MapMySqlTextField<UserGroup>(x => x.Name);
+
107 }
-
107 }
+
108 }
-
108}
+
109}
Tgstation.Server.Api.Models.Internal.ChatBotSettings.ConnectionString
string? ConnectionString
The information used to connect to the Provider.
Definition ChatBotSettings.cs:46
Tgstation.Server.Api.Models.NamedEntity.Name
virtual ? string Name
The name of the entity represented by the NamedEntity.
Definition NamedEntity.cs:17
Tgstation.Server.Host.Configuration.DatabaseConfiguration
Configuration options for the Database.DatabaseContext.
Definition DatabaseConfiguration.cs:10
@@ -193,7 +194,7 @@ $(document).ready(function() { init_codefold(0); });
Tgstation.Server.Host.Database.DatabaseContext
Backend abstract implementation of IDatabaseContext.
Definition DatabaseContext.cs:25
Tgstation.Server.Host.Database.MySqlDatabaseContext
DatabaseContext for MySQL.
Definition MySqlDatabaseContext.cs:17
Tgstation.Server.Host.Database.MySqlDatabaseContext.RevInfoCompileJobDeleteBehavior
override DeleteBehavior RevInfoCompileJobDeleteBehavior
Definition MySqlDatabaseContext.cs:19
-
Tgstation.Server.Host.Database.MySqlDatabaseContext.OnModelCreating
override void OnModelCreating(ModelBuilder modelBuilder)
Definition MySqlDatabaseContext.cs:66
+
Tgstation.Server.Host.Database.MySqlDatabaseContext.OnModelCreating
override void OnModelCreating(ModelBuilder modelBuilder)
Definition MySqlDatabaseContext.cs:67
Tgstation.Server.Host.Database.MySqlDatabaseContext.ConfigureWith
static void ConfigureWith(DbContextOptionsBuilder options, DatabaseConfiguration databaseConfiguration)
Configure the MySqlDatabaseContext.
Definition MySqlDatabaseContext.cs:35
Tgstation.Server.Host.Database.MySqlDatabaseContext.MySqlDatabaseContext
MySqlDatabaseContext(DbContextOptions< MySqlDatabaseContext > dbContextOptions)
Initializes a new instance of the MySqlDatabaseContext class.
Definition MySqlDatabaseContext.cs:25
Tgstation.Server.Host.Models.ChatBot
Definition ChatBot.cs:12
diff --git a/_my_sql_design_time_db_context_factory_8cs_source.html b/_my_sql_design_time_db_context_factory_8cs_source.html index 5d7e0c2727..ecff9ca610 100644 --- a/_my_sql_design_time_db_context_factory_8cs_source.html +++ b/_my_sql_design_time_db_context_factory_8cs_source.html @@ -92,7 +92,7 @@ $(document).ready(function() { init_codefold(0); });
10 sealed class MySqlDesignTimeDbContextFactory : IDesignTimeDbContextFactory<MySqlDatabaseContext>
11 {
13 public MySqlDatabaseContext CreateDbContext(string[] args)
-
14 => new MySqlDatabaseContext(
+
14 => new(
15 DesignTimeDbContextFactoryHelpers.CreateDatabaseContextOptions<MySqlDatabaseContext>(
16 DatabaseType.MariaDB,
17 "Server=127.0.0.1;User Id=root;Password=zdxfOOTlQFnklwzytzCj;Database=TGS_Design"));
diff --git a/_postgres_sql_database_context_8cs_source.html b/_postgres_sql_database_context_8cs_source.html index 74151e2a26..f90e605964 100644 --- a/_postgres_sql_database_context_8cs_source.html +++ b/_postgres_sql_database_context_8cs_source.html @@ -116,18 +116,19 @@ $(document).ready(function() { init_codefold(0); });
41 AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
42 options.UseNpgsql(databaseConfiguration.ConnectionString, options =>
43 {
-
44 options.EnableRetryOnFailure();
-
45 options.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery);
-
46
-
47 if (!String.IsNullOrEmpty(databaseConfiguration.ServerVersion))
-
48 options.SetPostgresVersion(
-
49 Version.Parse(databaseConfiguration.ServerVersion));
-
50 });
-
51 }
+
44 options.TranslateParameterizedCollectionsToConstants();
+
45 options.EnableRetryOnFailure();
+
46 options.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery);
+
47
+
48 if (!String.IsNullOrEmpty(databaseConfiguration.ServerVersion))
+
49 options.SetPostgresVersion(
+
50 Version.Parse(databaseConfiguration.ServerVersion));
+
51 });
+
52 }
-
52 }
+
53 }
-
53}
+
54}
Tgstation.Server.Host.Configuration.DatabaseConfiguration
Configuration options for the Database.DatabaseContext.
Definition DatabaseConfiguration.cs:10
Tgstation.Server.Host.Configuration.DatabaseConfiguration.ConnectionString
string? ConnectionString
The connection string for the database.
Definition DatabaseConfiguration.cs:30
Tgstation.Server.Host.Configuration.DatabaseConfiguration.DatabaseType
DatabaseType DatabaseType
The Configuration.DatabaseType to create.
Definition DatabaseConfiguration.cs:20
diff --git a/_sql_server_database_context_8cs_source.html b/_sql_server_database_context_8cs_source.html index 56e1eff8ae..a019831129 100644 --- a/_sql_server_database_context_8cs_source.html +++ b/_sql_server_database_context_8cs_source.html @@ -113,14 +113,15 @@ $(document).ready(function() { init_codefold(0); });
37 databaseConfiguration.ConnectionString,
38 sqlServerOptions =>
39 {
-
40 sqlServerOptions.EnableRetryOnFailure();
-
41 sqlServerOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery);
-
42 });
-
43 }
+
40 sqlServerOptions.TranslateParameterizedCollectionsToConstants();
+
41 sqlServerOptions.EnableRetryOnFailure();
+
42 sqlServerOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery);
+
43 });
+
44 }
-
44 }
+
45 }
-
45}
+
46}
Tgstation.Server.Host.Configuration.DatabaseConfiguration
Configuration options for the Database.DatabaseContext.
Definition DatabaseConfiguration.cs:10
Tgstation.Server.Host.Configuration.DatabaseConfiguration.ConnectionString
string? ConnectionString
The connection string for the database.
Definition DatabaseConfiguration.cs:30
Tgstation.Server.Host.Configuration.DatabaseConfiguration.DatabaseType
DatabaseType DatabaseType
The Configuration.DatabaseType to create.
Definition DatabaseConfiguration.cs:20
diff --git a/_sqlite_database_context_8cs_source.html b/_sqlite_database_context_8cs_source.html index 03f696d4ce..7112dc0eb3 100644 --- a/_sqlite_database_context_8cs_source.html +++ b/_sqlite_database_context_8cs_source.html @@ -124,41 +124,45 @@ $(document).ready(function() { init_codefold(0); });
56 if (databaseConfiguration.DatabaseType != DatabaseType.Sqlite)
57 throw new InvalidOperationException($"Invalid DatabaseType for {nameof(SqliteDatabaseContext)}!");
58
-
59 options.UseSqlite(databaseConfiguration.ConnectionString, sqliteOptions => sqliteOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery));
-
60 }
+
59 options.UseSqlite(databaseConfiguration.ConnectionString, sqliteOptions =>
+
60 {
+
61 sqliteOptions.TranslateParameterizedCollectionsToConstants();
+
62 sqliteOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery);
+
63 });
+
64 }
-
61
-
-
63 protected override void OnModelCreating(ModelBuilder modelBuilder)
-
64 {
-
65 base.OnModelCreating(modelBuilder);
-
66
-
67 // Shamelessly stolen from https://blog.dangl.me/archive/handling-datetimeoffset-in-sqlite-with-entity-framework-core/
-
68
-
69 // SQLite does not have proper support for DateTimeOffset via Entity Framework Core, see the limitations
-
70 // here: https://docs.microsoft.com/en-us/ef/core/providers/sqlite/limitations#query-limitations
-
71 // To work around this, when the Sqlite database provider is used, all model properties of type DateTimeOffset
-
72 // use the DateTimeOffsetToBinaryConverter
-
73 // Based on: https://github.com/aspnet/EntityFrameworkCore/issues/10784#issuecomment-415769754
-
74 // This only supports millisecond precision, but should be sufficient for most use cases.
-
75 if (!designTime)
-
76 foreach (var entityType in modelBuilder.Model.GetEntityTypes())
-
77 {
-
78 var properties = entityType
-
79 .ClrType
-
80 .GetProperties()
-
81 .Where(p => p.PropertyType == typeof(DateTimeOffset) || p.PropertyType == typeof(DateTimeOffset?));
-
82 foreach (var property in properties)
-
83 modelBuilder
-
84 .Entity(entityType.Name)
-
85 .Property(property.Name)
-
86 .HasConversion(new DateTimeOffsetToBinaryConverter());
-
87 }
-
88 }
+
65
+
+
67 protected override void OnModelCreating(ModelBuilder modelBuilder)
+
68 {
+
69 base.OnModelCreating(modelBuilder);
+
70
+
71 // Shamelessly stolen from https://blog.dangl.me/archive/handling-datetimeoffset-in-sqlite-with-entity-framework-core/
+
72
+
73 // SQLite does not have proper support for DateTimeOffset via Entity Framework Core, see the limitations
+
74 // here: https://docs.microsoft.com/en-us/ef/core/providers/sqlite/limitations#query-limitations
+
75 // To work around this, when the Sqlite database provider is used, all model properties of type DateTimeOffset
+
76 // use the DateTimeOffsetToBinaryConverter
+
77 // Based on: https://github.com/aspnet/EntityFrameworkCore/issues/10784#issuecomment-415769754
+
78 // This only supports millisecond precision, but should be sufficient for most use cases.
+
79 foreach (var entityType in modelBuilder.Model.GetEntityTypes())
+
80 {
+
81 var properties = entityType
+
82 .ClrType
+
83 .GetProperties()
+
84 .Where(p => p.PropertyType == typeof(DateTimeOffset) || p.PropertyType == typeof(DateTimeOffset?));
+
85 foreach (var property in properties)
+
86 modelBuilder
+
87 .Entity(entityType.Name)
+
88 .Property(property.Name)
+
89 .HasConversion(new DateTimeOffsetToBinaryConverter())
+
90 .HasColumnType("TEXT"); // Dominion: This is for purely legacy reasons
+
91 }
+
92 }
-
89 }
+
93 }
-
90}
+
94}
Tgstation.Server.Host.Configuration.DatabaseConfiguration
Configuration options for the Database.DatabaseContext.
Definition DatabaseConfiguration.cs:10
Tgstation.Server.Host.Configuration.DatabaseConfiguration.ConnectionString
string? ConnectionString
The connection string for the database.
Definition DatabaseConfiguration.cs:30
Tgstation.Server.Host.Configuration.DatabaseConfiguration.DatabaseType
DatabaseType DatabaseType
The Configuration.DatabaseType to create.
Definition DatabaseConfiguration.cs:20
@@ -167,7 +171,7 @@ $(document).ready(function() { init_codefold(0); });
Tgstation.Server.Host.Database.SqliteDatabaseContext.SqliteDatabaseContext
SqliteDatabaseContext(DbContextOptions< SqliteDatabaseContext > dbContextOptions)
Initializes a new instance of the SqliteDatabaseContext class.
Definition SqliteDatabaseContext.cs:25
Tgstation.Server.Host.Database.SqliteDatabaseContext.designTime
readonly bool designTime
If the database context is running in design time mode.
Definition SqliteDatabaseContext.cs:19
Tgstation.Server.Host.Database.SqliteDatabaseContext.ConfigureWith
static void ConfigureWith(DbContextOptionsBuilder options, DatabaseConfiguration databaseConfiguration)
Configure the SqliteDatabaseContext.
Definition SqliteDatabaseContext.cs:49
-
Tgstation.Server.Host.Database.SqliteDatabaseContext.OnModelCreating
override void OnModelCreating(ModelBuilder modelBuilder)
Definition SqliteDatabaseContext.cs:63
+
Tgstation.Server.Host.Database.SqliteDatabaseContext.OnModelCreating
override void OnModelCreating(ModelBuilder modelBuilder)
Definition SqliteDatabaseContext.cs:67
Tgstation.Server.Host.Configuration
Definition ControlPanelConfiguration.cs:4
Tgstation.Server.Host.Configuration.DatabaseType
DatabaseType
Type of database to user.
Definition DatabaseType.cs:7
Tgstation.Server.Host.Database
Definition DatabaseCollection.cs:11
diff --git a/class_tgstation_1_1_server_1_1_api_1_1_models_1_1_internal_1_1_chat_bot_settings.html b/class_tgstation_1_1_server_1_1_api_1_1_models_1_1_internal_1_1_chat_bot_settings.html index 3d3a5357a4..60d9cc6293 100644 --- a/class_tgstation_1_1_server_1_1_api_1_1_models_1_1_internal_1_1_chat_bot_settings.html +++ b/class_tgstation_1_1_server_1_1_api_1_1_models_1_1_internal_1_1_chat_bot_settings.html @@ -294,7 +294,7 @@ Here is the call graph for this function:

Definition at line 46 of file ChatBotSettings.cs.

46{ get; set; }
-

Referenced by Tgstation.Server.Api.Models.Internal.ChatBotSettings.CreateConnectionStringBuilder(), Tgstation.Server.Host.Components.Chat.Providers.DiscordProvider.DiscordProvider(), Tgstation.Server.Host.Database.MySqlDatabaseContext.OnModelCreating(), Tgstation.Server.Api.Models.Internal.ChatBotSettings.SetConnectionStringBuilder(), and Tgstation.Server.Host.Models.ChatBot.ToApi().

+

Referenced by Tgstation.Server.Api.Models.Internal.ChatBotSettings.CreateConnectionStringBuilder(), Tgstation.Server.Host.Components.Chat.Providers.DiscordProvider.DiscordProvider(), Tgstation.Server.Host.Database.MySqlDatabaseContext.OnModelCreating(), Tgstation.Server.Api.Models.Internal.ChatBotSettings.SetConnectionStringBuilder(), and Tgstation.Server.Host.Models.ChatBot.ToApi().

diff --git a/class_tgstation_1_1_server_1_1_api_1_1_models_1_1_named_entity.html b/class_tgstation_1_1_server_1_1_api_1_1_models_1_1_named_entity.html index 45e53c2ad5..372333ee3d 100644 --- a/class_tgstation_1_1_server_1_1_api_1_1_models_1_1_named_entity.html +++ b/class_tgstation_1_1_server_1_1_api_1_1_models_1_1_named_entity.html @@ -191,7 +191,7 @@ Properties

Definition at line 17 of file NamedEntity.cs.

17{ get; set; }
-

Referenced by Tgstation.Server.Host.Controllers.ChatController.Create(), Tgstation.Server.Host.Database.MySqlDatabaseContext.OnModelCreating(), Tgstation.Server.Host.Models.ChatBot.ToApi(), Tgstation.Server.Host.Models.Instance.ToApi(), and Tgstation.Server.Host.Models.UserGroup.ToApi().

+

Referenced by Tgstation.Server.Host.Controllers.ChatController.Create(), Tgstation.Server.Host.Database.MySqlDatabaseContext.OnModelCreating(), Tgstation.Server.Host.Models.ChatBot.ToApi(), Tgstation.Server.Host.Models.Instance.ToApi(), and Tgstation.Server.Host.Models.UserGroup.ToApi().

diff --git a/class_tgstation_1_1_server_1_1_host_1_1_database_1_1_my_sql_database_context.html b/class_tgstation_1_1_server_1_1_host_1_1_database_1_1_my_sql_database_context.html index 8d5e9c9f3a..d7cd1cc207 100644 --- a/class_tgstation_1_1_server_1_1_host_1_1_database_1_1_my_sql_database_context.html +++ b/class_tgstation_1_1_server_1_1_host_1_1_database_1_1_my_sql_database_context.html @@ -440,10 +440,11 @@ Properties
57 serverVersion,
58 mySqlOptions =>
59 {
-
60 mySqlOptions.EnableRetryOnFailure();
-
61 mySqlOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery);
-
62 });
-
63 }
+
60 mySqlOptions.TranslateParameterizedCollectionsToConstants();
+
61 mySqlOptions.EnableRetryOnFailure();
+
62 mySqlOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery);
+
63 });
+
64 }
Tgstation.Server.Host.Configuration.DatabaseConfiguration.ServerVersion
string? ServerVersion
The string form of the global::System.Version of the target server.
Definition DatabaseConfiguration.cs:40
Tgstation.Server.Host.Configuration.DatabaseConfiguration.ConnectionString
string? ConnectionString
The connection string for the database.
Definition DatabaseConfiguration.cs:30
Tgstation.Server.Host.Configuration.DatabaseConfiguration.DatabaseType
DatabaseType DatabaseType
The Configuration.DatabaseType to create.
Definition DatabaseConfiguration.cs:20
@@ -480,47 +481,47 @@ Properties

-

Definition at line 66 of file MySqlDatabaseContext.cs.

-
67 {
-
68 base.OnModelCreating(modelBuilder);
-
69
-
70 // Added to prevent a column type change after upgrading Pomelo.Mysql
-
71 // Related: https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/1606
-
72 modelBuilder
-
73 .MapMySqlTextField<ChatBot>(x => x.ConnectionString)
-
74 .MapMySqlTextField<ChatChannel>(x => x.Tag)
-
75 .MapMySqlTextField<ChatChannel>(x => x.IrcChannel)
-
76 .MapMySqlTextField<CompileJob>(x => x.EngineVersion)
-
77 .MapMySqlTextField<CompileJob>(x => x.DmeName)
-
78 .MapMySqlTextField<CompileJob>(x => x.Output)
-
79 .MapMySqlTextField<CompileJob>(x => x.RepositoryOrigin)
-
80 .MapMySqlTextField<DreamDaemonSettings>(x => x.AdditionalParameters)
-
81 .MapMySqlTextField<DreamMakerSettings>(x => x.ProjectName)
-
82 .MapMySqlTextField<Instance>(x => x.Name)
-
83 .MapMySqlTextField<Instance>(x => x.Path)
-
84 .MapMySqlTextField<Instance>(x => x.SwarmIdentifer)
-
85 .MapMySqlTextField<Job>(x => x.Description)
-
86 .MapMySqlTextField<Job>(x => x.ExceptionDetails)
-
87 .MapMySqlTextField<OAuthConnection>(x => x.ExternalUserId)
-
88 .MapMySqlTextField<ReattachInformation>(x => x.AccessIdentifier)
-
89 .MapMySqlTextField<RepositorySettings>(x => x.AccessToken)
-
90 .MapMySqlTextField<RepositorySettings>(x => x.AccessUser)
-
91 .MapMySqlTextField<RepositorySettings>(x => x.CommitterEmail)
-
92 .MapMySqlTextField<RepositorySettings>(x => x.CommitterName)
-
93 .MapMySqlTextField<RevisionInformation>(x => x.CommitSha)
-
94 .MapMySqlTextField<RevisionInformation>(x => x.OriginCommitSha)
-
95 .MapMySqlTextField<TestMerge>(x => x.Author)
-
96 .MapMySqlTextField<TestMerge>(x => x.BodyAtMerge)
-
97 .MapMySqlTextField<TestMerge>(x => x.Comment)
-
98 .MapMySqlTextField<TestMerge>(x => x.TargetCommitSha)
-
99 .MapMySqlTextField<TestMerge>(x => x.TitleAtMerge)
-
100 .MapMySqlTextField<TestMerge>(x => x.Url)
-
101 .MapMySqlTextField<User>(x => x.CanonicalName)
-
102 .MapMySqlTextField<User>(x => x.Name)
-
103 .MapMySqlTextField<User>(x => x.PasswordHash)
-
104 .MapMySqlTextField<User>(x => x.SystemIdentifier)
-
105 .MapMySqlTextField<UserGroup>(x => x.Name);
-
106 }
+

Definition at line 67 of file MySqlDatabaseContext.cs.

+
68 {
+
69 base.OnModelCreating(modelBuilder);
+
70
+
71 // Added to prevent a column type change after upgrading Pomelo.Mysql
+
72 // Related: https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/1606
+
73 modelBuilder
+
74 .MapMySqlTextField<ChatBot>(x => x.ConnectionString)
+
75 .MapMySqlTextField<ChatChannel>(x => x.Tag)
+
76 .MapMySqlTextField<ChatChannel>(x => x.IrcChannel)
+
77 .MapMySqlTextField<CompileJob>(x => x.EngineVersion)
+
78 .MapMySqlTextField<CompileJob>(x => x.DmeName)
+
79 .MapMySqlTextField<CompileJob>(x => x.Output)
+
80 .MapMySqlTextField<CompileJob>(x => x.RepositoryOrigin)
+
81 .MapMySqlTextField<DreamDaemonSettings>(x => x.AdditionalParameters)
+
82 .MapMySqlTextField<DreamMakerSettings>(x => x.ProjectName)
+
83 .MapMySqlTextField<Instance>(x => x.Name)
+
84 .MapMySqlTextField<Instance>(x => x.Path)
+
85 .MapMySqlTextField<Instance>(x => x.SwarmIdentifer)
+
86 .MapMySqlTextField<Job>(x => x.Description)
+
87 .MapMySqlTextField<Job>(x => x.ExceptionDetails)
+
88 .MapMySqlTextField<OAuthConnection>(x => x.ExternalUserId)
+
89 .MapMySqlTextField<ReattachInformation>(x => x.AccessIdentifier)
+
90 .MapMySqlTextField<RepositorySettings>(x => x.AccessToken)
+
91 .MapMySqlTextField<RepositorySettings>(x => x.AccessUser)
+
92 .MapMySqlTextField<RepositorySettings>(x => x.CommitterEmail)
+
93 .MapMySqlTextField<RepositorySettings>(x => x.CommitterName)
+
94 .MapMySqlTextField<RevisionInformation>(x => x.CommitSha)
+
95 .MapMySqlTextField<RevisionInformation>(x => x.OriginCommitSha)
+
96 .MapMySqlTextField<TestMerge>(x => x.Author)
+
97 .MapMySqlTextField<TestMerge>(x => x.BodyAtMerge)
+
98 .MapMySqlTextField<TestMerge>(x => x.Comment)
+
99 .MapMySqlTextField<TestMerge>(x => x.TargetCommitSha)
+
100 .MapMySqlTextField<TestMerge>(x => x.TitleAtMerge)
+
101 .MapMySqlTextField<TestMerge>(x => x.Url)
+
102 .MapMySqlTextField<User>(x => x.CanonicalName)
+
103 .MapMySqlTextField<User>(x => x.Name)
+
104 .MapMySqlTextField<User>(x => x.PasswordHash)
+
105 .MapMySqlTextField<User>(x => x.SystemIdentifier)
+
106 .MapMySqlTextField<UserGroup>(x => x.Name);
+
107 }
string? ConnectionString
The information used to connect to the Provider.
virtual ? string Name
The name of the entity represented by the NamedEntity.
diff --git a/class_tgstation_1_1_server_1_1_host_1_1_database_1_1_postgres_sql_database_context.html b/class_tgstation_1_1_server_1_1_host_1_1_database_1_1_postgres_sql_database_context.html index 59b7a22486..ebe4ae1564 100644 --- a/class_tgstation_1_1_server_1_1_host_1_1_database_1_1_postgres_sql_database_context.html +++ b/class_tgstation_1_1_server_1_1_host_1_1_database_1_1_postgres_sql_database_context.html @@ -424,14 +424,15 @@ Additional Inherited Members
41 AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
42 options.UseNpgsql(databaseConfiguration.ConnectionString, options =>
43 {
-
44 options.EnableRetryOnFailure();
-
45 options.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery);
-
46
-
47 if (!String.IsNullOrEmpty(databaseConfiguration.ServerVersion))
-
48 options.SetPostgresVersion(
-
49 Version.Parse(databaseConfiguration.ServerVersion));
-
50 });
-
51 }
+
44 options.TranslateParameterizedCollectionsToConstants();
+
45 options.EnableRetryOnFailure();
+
46 options.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery);
+
47
+
48 if (!String.IsNullOrEmpty(databaseConfiguration.ServerVersion))
+
49 options.SetPostgresVersion(
+
50 Version.Parse(databaseConfiguration.ServerVersion));
+
51 });
+
52 }
string? ConnectionString
The connection string for the database.
DatabaseType DatabaseType
The Configuration.DatabaseType to create.
DatabaseType
Type of database to user.
diff --git a/class_tgstation_1_1_server_1_1_host_1_1_database_1_1_sql_server_database_context.html b/class_tgstation_1_1_server_1_1_host_1_1_database_1_1_sql_server_database_context.html index e6bcdce201..80616ab625 100644 --- a/class_tgstation_1_1_server_1_1_host_1_1_database_1_1_sql_server_database_context.html +++ b/class_tgstation_1_1_server_1_1_host_1_1_database_1_1_sql_server_database_context.html @@ -418,10 +418,11 @@ Additional Inherited Members
37 databaseConfiguration.ConnectionString,
38 sqlServerOptions =>
39 {
-
40 sqlServerOptions.EnableRetryOnFailure();
-
41 sqlServerOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery);
-
42 });
-
43 }
+
40 sqlServerOptions.TranslateParameterizedCollectionsToConstants();
+
41 sqlServerOptions.EnableRetryOnFailure();
+
42 sqlServerOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery);
+
43 });
+
44 }
string? ConnectionString
The connection string for the database.
DatabaseType DatabaseType
The Configuration.DatabaseType to create.
DatabaseType
Type of database to user.
diff --git a/class_tgstation_1_1_server_1_1_host_1_1_database_1_1_sqlite_database_context.html b/class_tgstation_1_1_server_1_1_host_1_1_database_1_1_sqlite_database_context.html index 9eb9a211a2..6687d595da 100644 --- a/class_tgstation_1_1_server_1_1_host_1_1_database_1_1_sqlite_database_context.html +++ b/class_tgstation_1_1_server_1_1_host_1_1_database_1_1_sqlite_database_context.html @@ -429,8 +429,12 @@ Additional Inherited Members
56 if (databaseConfiguration.DatabaseType != DatabaseType.Sqlite)
57 throw new InvalidOperationException($"Invalid DatabaseType for {nameof(SqliteDatabaseContext)}!");
58
-
59 options.UseSqlite(databaseConfiguration.ConnectionString, sqliteOptions => sqliteOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery));
-
60 }
+
59 options.UseSqlite(databaseConfiguration.ConnectionString, sqliteOptions =>
+
60 {
+
61 sqliteOptions.TranslateParameterizedCollectionsToConstants();
+
62 sqliteOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SingleQuery);
+
63 });
+
64 }
string? ConnectionString
The connection string for the database.
DatabaseType DatabaseType
The Configuration.DatabaseType to create.
DatabaseType
Type of database to user.
@@ -465,36 +469,33 @@ Additional Inherited Members

-

Definition at line 63 of file SqliteDatabaseContext.cs.

-
64 {
-
65 base.OnModelCreating(modelBuilder);
-
66
-
67 // Shamelessly stolen from https://blog.dangl.me/archive/handling-datetimeoffset-in-sqlite-with-entity-framework-core/
-
68
-
69 // SQLite does not have proper support for DateTimeOffset via Entity Framework Core, see the limitations
-
70 // here: https://docs.microsoft.com/en-us/ef/core/providers/sqlite/limitations#query-limitations
-
71 // To work around this, when the Sqlite database provider is used, all model properties of type DateTimeOffset
-
72 // use the DateTimeOffsetToBinaryConverter
-
73 // Based on: https://github.com/aspnet/EntityFrameworkCore/issues/10784#issuecomment-415769754
-
74 // This only supports millisecond precision, but should be sufficient for most use cases.
-
75 if (!designTime)
-
76 foreach (var entityType in modelBuilder.Model.GetEntityTypes())
-
77 {
-
78 var properties = entityType
-
79 .ClrType
-
80 .GetProperties()
-
81 .Where(p => p.PropertyType == typeof(DateTimeOffset) || p.PropertyType == typeof(DateTimeOffset?));
-
82 foreach (var property in properties)
-
83 modelBuilder
-
84 .Entity(entityType.Name)
-
85 .Property(property.Name)
-
86 .HasConversion(new DateTimeOffsetToBinaryConverter());
-
87 }
-
88 }
-
readonly bool designTime
If the database context is running in design time mode.
+

Definition at line 67 of file SqliteDatabaseContext.cs.

+
68 {
+
69 base.OnModelCreating(modelBuilder);
+
70
+
71 // Shamelessly stolen from https://blog.dangl.me/archive/handling-datetimeoffset-in-sqlite-with-entity-framework-core/
+
72
+
73 // SQLite does not have proper support for DateTimeOffset via Entity Framework Core, see the limitations
+
74 // here: https://docs.microsoft.com/en-us/ef/core/providers/sqlite/limitations#query-limitations
+
75 // To work around this, when the Sqlite database provider is used, all model properties of type DateTimeOffset
+
76 // use the DateTimeOffsetToBinaryConverter
+
77 // Based on: https://github.com/aspnet/EntityFrameworkCore/issues/10784#issuecomment-415769754
+
78 // This only supports millisecond precision, but should be sufficient for most use cases.
+
79 foreach (var entityType in modelBuilder.Model.GetEntityTypes())
+
80 {
+
81 var properties = entityType
+
82 .ClrType
+
83 .GetProperties()
+
84 .Where(p => p.PropertyType == typeof(DateTimeOffset) || p.PropertyType == typeof(DateTimeOffset?));
+
85 foreach (var property in properties)
+
86 modelBuilder
+
87 .Entity(entityType.Name)
+
88 .Property(property.Name)
+
89 .HasConversion(new DateTimeOffsetToBinaryConverter())
+
90 .HasColumnType("TEXT"); // Dominion: This is for purely legacy reasons
+
91 }
+
92 }
-

References Tgstation.Server.Host.Database.SqliteDatabaseContext.designTime.

-

Member Data Documentation

@@ -522,8 +523,6 @@ Additional Inherited Members

Definition at line 19 of file SqliteDatabaseContext.cs.

-

Referenced by Tgstation.Server.Host.Database.SqliteDatabaseContext.OnModelCreating().

-

The documentation for this class was generated from the following file: