Skip to content

Commit 64dcce9

Browse files
JaBistDuNarrischJaBistDuNarrisch
authored andcommitted
Oracle test handling adjustments
1 parent eff914f commit 64dcce9

26 files changed

+516
-75
lines changed

.editorconfig

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ spelling_exclusion_path = SpellingExclusions.dic
88

99
# Code files
1010
[*.{cs,csx,vb,vbx}]
11+
end_of_line = lf
1112
indent_size = 4
1213
insert_final_newline = true
1314
charset = utf-8
1415

1516
# XML project files
1617
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
17-
indent_size = 2
18+
indent_size = 4
19+
end_of_line = lf
1820

1921
# XML config files
2022
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
@@ -155,6 +157,7 @@ dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
155157
dotnet_style_prefer_compound_assignment = true:suggestion
156158
dotnet_style_prefer_simplified_interpolation = true:suggestion
157159
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
160+
tab_width = 4
158161

159162
##########################################
160163
# C# Specific settings
@@ -223,7 +226,7 @@ csharp_style_prefer_extended_property_pattern = true:suggestion
223226
csharp_style_prefer_init_only_properties = true:suggestion
224227

225228
# Braces
226-
csharp_prefer_braces = always:warning
229+
csharp_prefer_braces = true:silent
227230
csharp_preserve_single_line_blocks = true
228231
csharp_preserve_single_line_statements = true
229232
dotnet_diagnostic.IDE0011.severity = warning
@@ -271,6 +274,12 @@ dotnet_diagnostic.IDE2005.severity = warning
271274
dotnet_diagnostic.IDE2006.severity = warning
272275
csharp_style_expression_bodied_lambdas = true:silent
273276
csharp_style_expression_bodied_local_functions = false:silent
277+
csharp_using_directive_placement = outside_namespace:silent
278+
csharp_prefer_simple_using_statement = true:suggestion
279+
csharp_style_prefer_method_group_conversion = true:silent
280+
csharp_style_prefer_top_level_statements = true:silent
281+
csharp_style_prefer_primary_constructors = true:suggestion
282+
csharp_prefer_system_threading_lock = true:suggestion
274283

275284
##########################################
276285
# Exceptions by path

.github/workflows/sql/oracle.sql

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,26 @@ alter session set container = freepdb1;
44

55
create user k identified by k;
66

7-
grant
8-
create user
9-
to k;
7+
grant select_catalog_role to k;
108

11-
grant
12-
drop user
13-
to k;
9+
grant create tablespace to k;
1410

15-
grant
16-
create session
17-
to k with admin option;
11+
grant drop tablespace to k;
12+
13+
grant create user to k;
14+
15+
grant drop user to k;
16+
17+
grant create session to k with admin option;
1818

1919
grant resource to k with admin option;
2020

2121
grant connect to k with admin option;
2222

23-
grant
24-
unlimited tablespace
25-
to k with admin option;
23+
grant unlimited tablespace to k with admin option;
2624

2725
grant select on v_$session to k with grant option
2826

29-
grant
30-
alter system
31-
to k
27+
grant alter system to k
3228

3329
exit;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using LinqToDB.Mapping;
2+
using Migrator.Tests.Database.Data.Common.Interfaces;
3+
4+
namespace Migrator.Tests.Database.Data.Common;
5+
6+
public abstract class EntityConfiguration<T>(FluentMappingBuilder fluentMappingBuilder) : IEntityConfiguration where T : class
7+
{
8+
protected EntityMappingBuilder<T> _EntityMappingBuilder = fluentMappingBuilder.Entity<T>();
9+
protected FluentMappingBuilder _FluentMappingBuilder = fluentMappingBuilder;
10+
11+
/// <summary>
12+
/// Configures the entity in the fluent migrator of Linq2db
13+
/// </summary>
14+
public abstract void ConfigureEntity();
15+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Migrator.Tests.Database.Data.Common.Interfaces;
2+
3+
public interface IEntityConfiguration
4+
{
5+
/// <summary>
6+
/// Configure the entity mapping.
7+
/// </summary>
8+
void ConfigureEntity();
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using LinqToDB.Mapping;
2+
3+
namespace Migrator.Tests.Database.Data.Common.Interfaces;
4+
5+
public interface IMappingSchemaFactory
6+
{
7+
MappingSchema CreateOracleMappingSchema();
8+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.Collections.Generic;
2+
using LinqToDB.Mapping;
3+
using Migrator.Tests.Database.Data.Common.Interfaces;
4+
using Migrator.Tests.Database.Data.Mappings.Oracle;
5+
6+
namespace DotNetProjects.Migrator.Framework.Data.Common;
7+
8+
public class MappingSchemaFactory() : IMappingSchemaFactory
9+
{
10+
public MappingSchema CreateOracleMappingSchema()
11+
{
12+
var fluentMappingBuilder = new FluentMappingBuilder();
13+
14+
var configs = new List<IEntityConfiguration>
15+
{
16+
new OracleAllConsColumnsConfiguration(fluentMappingBuilder),
17+
new OracleAllConstraintsConfiguration(fluentMappingBuilder),
18+
new OracleAllTabColumnsConfiguration(fluentMappingBuilder),
19+
new OracleAllTabColumnsConfiguration(fluentMappingBuilder),
20+
new OracleAllUsersConfiguration(fluentMappingBuilder),
21+
new OracleDBADataFilesConfiguration(fluentMappingBuilder),
22+
new OracleVSessionConfiguration(fluentMappingBuilder),
23+
};
24+
25+
return Configure(fluentMappingBuilder, configs);
26+
}
27+
28+
private static MappingSchema Configure(FluentMappingBuilder fluentMappingBuilder, IEnumerable<IEntityConfiguration> entityConfigurations)
29+
{
30+
foreach (var config in entityConfigurations)
31+
{
32+
config.ConfigureEntity();
33+
}
34+
35+
fluentMappingBuilder.Build();
36+
37+
return fluentMappingBuilder.MappingSchema;
38+
}
39+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using DotNetProjects.Migrator.Framework.Data.Models.Oracle;
2+
using LinqToDB.Mapping;
3+
using Migrator.Tests.Database.Data.Common;
4+
5+
namespace Migrator.Tests.Database.Data.Mappings.Oracle;
6+
7+
public class OracleAllConsColumnsConfiguration(FluentMappingBuilder fluentMappingBuilder)
8+
: EntityConfiguration<AllConsColumns>(fluentMappingBuilder)
9+
{
10+
public override void ConfigureEntity()
11+
{
12+
_EntityMappingBuilder!.HasTableName("ALL_CONS_COLUMNS");
13+
14+
_EntityMappingBuilder.Property(x => x.ColumnName)
15+
.HasColumnName("COLUMN_NAME");
16+
17+
_EntityMappingBuilder.Property(x => x.ConstraintName)
18+
.HasColumnName("CONSTRAINT_NAME");
19+
20+
_EntityMappingBuilder.Property(x => x.Owner)
21+
.HasColumnName("OWNER");
22+
23+
_EntityMappingBuilder.Property(x => x.Position)
24+
.HasColumnName("POSITION");
25+
26+
_EntityMappingBuilder.Property(x => x.TableName)
27+
.HasColumnName("TABLE_NAME");
28+
}
29+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using DotNetProjects.Migrator.Framework.Data.Models.Oracle;
2+
using LinqToDB.Mapping;
3+
using Migrator.Tests.Database.Data.Common;
4+
5+
namespace Migrator.Tests.Database.Data.Mappings.Oracle;
6+
7+
public class OracleAllConstraintsConfiguration(FluentMappingBuilder fluentMappingBuilder)
8+
: EntityConfiguration<AllConstraints>(fluentMappingBuilder)
9+
{
10+
public override void ConfigureEntity()
11+
{
12+
_EntityMappingBuilder!.HasTableName("ALL_CONSTRAINTS");
13+
14+
_EntityMappingBuilder.Property(x => x.ConstraintName)
15+
.HasColumnName("CONSTRAINT_NAME");
16+
17+
_EntityMappingBuilder.Property(x => x.RConstraintName)
18+
.HasColumnName("R_CONSTRAINT_NAME");
19+
20+
_EntityMappingBuilder.Property(x => x.ROwner)
21+
.HasColumnName("R_OWNER");
22+
23+
_EntityMappingBuilder.Property(x => x.ConstraintType)
24+
.HasColumnName("CONSTRAINT_TYPE");
25+
26+
_EntityMappingBuilder.Property(x => x.Owner)
27+
.HasColumnName("OWNER");
28+
29+
_EntityMappingBuilder.Property(x => x.Status)
30+
.HasColumnName("STATUS");
31+
32+
_EntityMappingBuilder.Property(x => x.TableName)
33+
.HasColumnName("TABLE_NAME");
34+
}
35+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using DotNetProjects.Migrator.Framework.Data.Models.Oracle;
2+
using LinqToDB.Mapping;
3+
using Migrator.Tests.Database.Data.Common;
4+
5+
namespace Migrator.Tests.Database.Data.Mappings.Oracle;
6+
7+
public class OracleAllTabColumnsConfiguration(FluentMappingBuilder fluentMappingBuilder)
8+
: EntityConfiguration<AllTabColumns>(fluentMappingBuilder)
9+
{
10+
public override void ConfigureEntity()
11+
{
12+
_EntityMappingBuilder!.HasTableName("ALL_TAB_COLUMNS");
13+
14+
_EntityMappingBuilder.Property(x => x.ColumnName)
15+
.HasColumnName("COLUMN_NAME");
16+
17+
_EntityMappingBuilder.Property(x => x.DataDefault)
18+
.HasColumnName("DATA_DEFAULT");
19+
20+
_EntityMappingBuilder.Property(x => x.DataLength)
21+
.HasColumnName("DATA_LENGTH");
22+
23+
_EntityMappingBuilder.Property(x => x.DataType)
24+
.HasColumnName("DATA_TYPE");
25+
26+
_EntityMappingBuilder.Property(x => x.IdentityColumn)
27+
.HasColumnName("IDENTITY_COLUMN");
28+
29+
_EntityMappingBuilder.Property(x => x.Nullable)
30+
.HasColumnName("NULLABLE");
31+
32+
_EntityMappingBuilder.Property(x => x.Owner)
33+
.HasColumnName("OWNER");
34+
35+
_EntityMappingBuilder.Property(x => x.TableName)
36+
.HasColumnName("TABLE_NAME");
37+
}
38+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using DotNetProjects.Migrator.Framework.Data.Models.Oracle;
2+
using LinqToDB.Mapping;
3+
using Migrator.Tests.Database.Data.Common;
4+
5+
namespace Migrator.Tests.Database.Data.Mappings.Oracle;
6+
7+
public class OracleAllUsersConfiguration(FluentMappingBuilder fluentMappingBuilder)
8+
: EntityConfiguration<AllUsers>(fluentMappingBuilder)
9+
{
10+
public override void ConfigureEntity()
11+
{
12+
_EntityMappingBuilder!.HasTableName("ALL_USERS");
13+
14+
_EntityMappingBuilder.Property(x => x.UserName)
15+
.HasColumnName("USERNAME");
16+
}
17+
}

0 commit comments

Comments
 (0)