Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit d4473e8

Browse files
committed
Code cleanup
1 parent 82d6dd6 commit d4473e8

14 files changed

+221
-217
lines changed

README.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@
44
[![Prerelease](https://img.shields.io/nuget/vpre/dbup-sqlce?color=orange&label=prerelease)](https://www.nuget.org/packages/dbup-sqlce)
55

66
# DbUp SQL CE Support
7-
DbUp is a .NET library that helps you to deploy changes to SQL Server databases. It tracks which SQL scripts have been run already, and runs the change scripts that are needed to get your database up to date.
7+
8+
DbUp is a .NET library that helps you to deploy changes to SQL Server databases. It tracks which SQL scripts have been
9+
run already, and runs the change scripts that are needed to get your database up to date.
810

911
## Getting Help
12+
1013
To learn more about DbUp check out the [documentation](https://dbup.readthedocs.io/en/latest/)
1114

12-
Please only log issue related to SQL CE Support in this repo. For cross cutting issues, please use our [main issue list](https://github.com/DbUp/DbUp/issues).
15+
Please only log issue related to SQL CE Support in this repo. For cross cutting issues, please use
16+
our [main issue list](https://github.com/DbUp/DbUp/issues).
1317

1418
# Contributing
1519

16-
See the [readme in our main repo](https://github.com/DbUp/DbUp/blob/master/README.md) for how to get started and contribute.
20+
See the [readme in our main repo](https://github.com/DbUp/DbUp/blob/master/README.md) for how to get started and
21+
contribute.

src/.editorconfig

+8-8
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ dotnet_style_prefer_conditional_expression_over_return = true:silent
4848
# Naming Conventions #
4949
###############################
5050
# Style Definitions
51-
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
51+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
5252
# Use PascalCase for constant fields
5353
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
54-
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
55-
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
56-
dotnet_naming_symbols.constant_fields.applicable_kinds = field
57-
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
58-
dotnet_naming_symbols.constant_fields.required_modifiers = const
54+
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
55+
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
56+
dotnet_naming_symbols.constant_fields.applicable_kinds = field
57+
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
58+
dotnet_naming_symbols.constant_fields.required_modifiers = const
5959
###############################
6060
# C# Coding Conventions #
6161
###############################
@@ -78,7 +78,7 @@ csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
7878
csharp_style_throw_expression = true:suggestion
7979
csharp_style_conditional_delegate_call = true:suggestion
8080
# Modifier preferences
81-
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
81+
csharp_preferred_modifier_order = public, private, protected, internal, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, volatile, async:suggestion
8282
# Expression-level preferences
8383
csharp_prefer_braces = when_multiline:suggestion
8484
csharp_style_deconstructed_variable_declaration = true:suggestion
@@ -120,4 +120,4 @@ csharp_preserve_single_line_blocks = true
120120
###############################
121121
[*.vb]
122122
# Modifier preferences
123-
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion
123+
visual_basic_preferred_modifier_order = Partial, Default, Private, Protected, Public, Friend, NotOverridable, Overridable, MustOverride, Overloads, Overrides, MustInherit, NotInheritable, Static, Shared, Shadows, ReadOnly, WriteOnly, Dim, Const, WithEvents, Widening, Narrowing, Custom, Async:suggestion

src/Directory.Build.props

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project>
33

4-
<PropertyGroup>
5-
<Authors>https://github.com/orgs/DbUp/people</Authors>
6-
<PackageReleaseNotes>https://github.com/DbUp/dbup-sqlce/releases</PackageReleaseNotes>
7-
<PackageProjectUrl>https://dbup.github.io</PackageProjectUrl>
8-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
9-
<RepositoryUrl>https://github.com/dbup-sqlce/dbup-sqlce.git</RepositoryUrl>
10-
<LangVersion>latest</LangVersion>
11-
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
12-
</PropertyGroup>
4+
<PropertyGroup>
5+
<Authors>https://github.com/orgs/DbUp/people</Authors>
6+
<PackageReleaseNotes>https://github.com/DbUp/dbup-sqlce/releases</PackageReleaseNotes>
7+
<PackageProjectUrl>https://dbup.github.io</PackageProjectUrl>
8+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
9+
<RepositoryUrl>https://github.com/dbup-sqlce/dbup-sqlce.git</RepositoryUrl>
10+
<LangVersion>latest</LangVersion>
11+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
12+
</PropertyGroup>
1313

14-
<PropertyGroup Condition="'$(TF_BUILD)' == 'true' Or '$(CI)' == 'true'">
14+
<PropertyGroup Condition="'$(TF_BUILD)' == 'true' Or '$(CI)' == 'true'">
1515

16-
<!-- Perform a deterministic build, so our binaries aren't impacted by build server environmental factors (e.g. file paths). -->
17-
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
16+
<!-- Perform a deterministic build, so our binaries aren't impacted by build server environmental factors (e.g. file paths). -->
17+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
1818

19-
<!-- Embed source files that are not tracked by the source control manager in the PDB -->
20-
<EmbedUntrackedSources>true</EmbedUntrackedSources>
19+
<!-- Embed source files that are not tracked by the source control manager in the PDB -->
20+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
2121

22-
<!-- Recommended: Embed symbols containing Source Link in the main file (exe/dll) -->
23-
<DebugType>embedded</DebugType>
22+
<!-- Recommended: Embed symbols containing Source Link in the main file (exe/dll) -->
23+
<DebugType>embedded</DebugType>
2424

25-
</PropertyGroup>
25+
</PropertyGroup>
2626

2727
</Project>

src/Tests/DatabaseSupportTests.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#if !NETCORE
22
using DbUp.Builder;
3-
using DbUp.SqlCe;
43
using DbUp.Tests.Common;
54

6-
namespace DbUp.Tests.Providers.SqlCe;
5+
namespace DbUp.SqlCe.Tests;
76

87
public class DatabaseSupportTests : DatabaseSupportTestsBase
98
{

src/Tests/NoPublicApiChanges.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#if !NETCORE
22
using DbUp.Tests.Common;
33

4-
namespace DbUp.Tests.Providers.SqlCe;
4+
namespace DbUp.SqlCe.Tests;
55

66
public class NoPublicApiChanges : NoPublicApiChangesBase
77
{

src/Tests/SqlCeSupportTests.cs

+18-20
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
11
#if !NETCORE
2-
using System;
32
using System.Data.SqlServerCe;
43
using System.IO;
54
using Shouldly;
65
using Xunit;
76

8-
namespace DbUp.Tests.Support.SqlCe
7+
namespace DbUp.SqlCe.Tests;
8+
9+
public class SqlCeSupportTests
910
{
10-
public class SqlCeSupportTests
11+
[Fact]
12+
public void CanUseSqlCe4()
1113
{
12-
[Fact]
13-
public void CanUseSqlCe4()
14-
{
15-
const string connectionString = "Data Source=test.sdf; Persist Security Info=False";
14+
const string connectionString = "Data Source=test.sdf; Persist Security Info=False";
1615

17-
if (!File.Exists("test.sdf"))
18-
{
19-
var engine = new SqlCeEngine(connectionString);
20-
engine.CreateDatabase();
21-
}
16+
if (!File.Exists("test.sdf"))
17+
{
18+
var engine = new SqlCeEngine(connectionString);
19+
engine.CreateDatabase();
20+
}
2221

23-
//Verify supports scripts which specify schema (To Support SqlCe and Sql with Schemas)
24-
var upgrader = DeployChanges.To
25-
.SqlCeDatabase(connectionString)
26-
.WithScript("Script0001", "create table $schema$.Foo (Id int)")
27-
.Build();
22+
//Verify supports scripts which specify schema (To Support SqlCe and Sql with Schemas)
23+
var upgrader = DeployChanges.To
24+
.SqlCeDatabase(connectionString)
25+
.WithScript("Script0001", "create table $schema$.Foo (Id int)")
26+
.Build();
2827

29-
var result = upgrader.PerformUpgrade();
28+
var result = upgrader.PerformUpgrade();
3029

31-
result.Successful.ShouldBe(true);
32-
}
30+
result.Successful.ShouldBe(true);
3331
}
3432
}
3533
#endif

src/Tests/Tests.csproj

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFrameworks>net462</TargetFrameworks>
5-
<AssemblyName>Tests</AssemblyName>
6-
<RootNamespace>DbUp.SqlCe.Tests</RootNamespace>
7-
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
8-
<!-- <ImplicitUsings>enable</ImplicitUsings> Can't use implict usings with net46 -->
9-
<Nullable>enable</Nullable>
10-
<NoWarn>$(NoWarn);NETSDK1138</NoWarn> <!-- Purposefully leaving an old version of netcoreapp to ensure we have compatibility. This never gets published -->
11-
<LangVersion>latest</LangVersion>
12-
</PropertyGroup>
3+
<PropertyGroup>
4+
<TargetFrameworks>net462</TargetFrameworks>
5+
<AssemblyName>Tests</AssemblyName>
6+
<RootNamespace>DbUp.SqlCe.Tests</RootNamespace>
7+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
8+
<!-- <ImplicitUsings>enable</ImplicitUsings> Can't use implict usings with net46 -->
9+
<Nullable>enable</Nullable>
10+
<NoWarn>$(NoWarn);NETSDK1138</NoWarn> <!-- Purposefully leaving an old version of netcoreapp to ensure we have compatibility. This never gets published -->
11+
<LangVersion>latest</LangVersion>
12+
</PropertyGroup>
1313

14-
<ItemGroup>
15-
<ProjectReference Include="..\dbup-sqlce\dbup-sqlce.csproj" />
16-
<PackageReference Include="DbUp.Tests.Common" Version="5.0.37" />
17-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
18-
<PackageReference Include="xunit" Version="2.6.6" />
19-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
20-
<PrivateAssets>all</PrivateAssets>
21-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
22-
</PackageReference>
23-
</ItemGroup>
14+
<ItemGroup>
15+
<ProjectReference Include="..\dbup-sqlce\dbup-sqlce.csproj"/>
16+
<PackageReference Include="DbUp.Tests.Common" Version="5.0.37"/>
17+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
18+
<PackageReference Include="xunit" Version="2.6.6"/>
19+
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
20+
<PrivateAssets>all</PrivateAssets>
21+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
22+
</PackageReference>
23+
</ItemGroup>
24+
25+
<ItemGroup>
26+
<Compile Remove="ApprovalFiles\*.cs"/>
27+
<None Include="ApprovalFiles\*.cs"/>
28+
</ItemGroup>
2429

25-
<ItemGroup>
26-
<Compile Remove="ApprovalFiles\*.cs" />
27-
<None Include="ApprovalFiles\*.cs" />
28-
</ItemGroup>
29-
3030
</Project>

src/dbup-sqlce.sln.DotSettings

+16-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2-
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ClassWithVirtualMembersNeverInherited_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
3-
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_INTERNAL_MODIFIER/@EntryValue">Implicit</s:String>
4-
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_PRIVATE_MODIFIER/@EntryValue">Implicit</s:String>
5-
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SQ/@EntryIndexedValue">SQ</s:String>
6-
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
7-
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
8-
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters /&gt;&lt;/data&gt;</s:String>
9-
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data /&gt;</s:String></wpf:ResourceDictionary>
1+
<wpf:ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib"
2+
xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xml:space="preserve">
4+
<s:String
5+
x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ClassWithVirtualMembersNeverInherited_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
6+
<s:String
7+
x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_INTERNAL_MODIFIER/@EntryValue">Implicit</s:String>
8+
<s:String
9+
x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_PRIVATE_MODIFIER/@EntryValue">Implicit</s:String>
10+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SQ/@EntryIndexedValue">SQ</s:String>
11+
<s:String
12+
x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
13+
<s:String
14+
x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
15+
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters /&gt;&lt;/data&gt;</s:String>
16+
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data /&gt;</s:String></wpf:ResourceDictionary>

src/dbup-sqlce/SqlCeConnectionManager.cs

+14-15
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,25 @@
33
using DbUp.Engine.Transactions;
44
using DbUp.Support;
55

6-
namespace DbUp.SqlCe
6+
namespace DbUp.SqlCe;
7+
8+
/// <summary>
9+
/// Manages SqlCe Database Connections
10+
/// </summary>
11+
public class SqlCeConnectionManager : DatabaseConnectionManager
712
{
813
/// <summary>
914
/// Manages SqlCe Database Connections
1015
/// </summary>
11-
public class SqlCeConnectionManager : DatabaseConnectionManager
16+
/// <param name="connectionString"></param>
17+
public SqlCeConnectionManager(string connectionString) : base(l => new SqlCeConnection(connectionString))
1218
{
13-
/// <summary>
14-
/// Manages SqlCe Database Connections
15-
/// </summary>
16-
/// <param name="connectionString"></param>
17-
public SqlCeConnectionManager(string connectionString) : base(l => new SqlCeConnection(connectionString))
18-
{
19-
}
19+
}
2020

21-
public override IEnumerable<string> SplitScriptIntoCommands(string scriptContents)
22-
{
23-
var commandSplitter = new SqlCommandSplitter();
24-
var scriptStatements = commandSplitter.SplitScriptIntoCommands(scriptContents);
25-
return scriptStatements;
26-
}
21+
public override IEnumerable<string> SplitScriptIntoCommands(string scriptContents)
22+
{
23+
var commandSplitter = new SqlCommandSplitter();
24+
var scriptStatements = commandSplitter.SplitScriptIntoCommands(scriptContents);
25+
return scriptStatements;
2726
}
2827
}

src/dbup-sqlce/SqlCeObjectParser.cs

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
using DbUp.Support;
22

3-
namespace DbUp.SqlCe
3+
namespace DbUp.SqlCe;
4+
5+
/// <summary>
6+
/// Parses Sql Objects and performs quoting functions.
7+
/// </summary>
8+
public class SqlCeObjectParser : SqlObjectParser
49
{
5-
/// <summary>
6-
/// Parses Sql Objects and performs quoting functions.
7-
/// </summary>
8-
public class SqlCeObjectParser : SqlObjectParser
10+
public SqlCeObjectParser() : base("[", "]")
911
{
10-
public SqlCeObjectParser() : base("[", "]")
11-
{
12-
}
1312
}
14-
}
13+
}

src/dbup-sqlce/SqlCePreprocessor.cs

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
using System.Text.RegularExpressions;
22
using DbUp.Engine;
33

4-
namespace DbUp.SqlCe
4+
namespace DbUp.SqlCe;
5+
6+
/// <summary>
7+
/// This preprocessor makes minor adjustments to your sql to make it compatible with SqlCe.
8+
/// </summary>
9+
public class SqlCePreprocessor : IScriptPreprocessor
510
{
611
/// <summary>
7-
/// This preprocessor makes minor adjustments to your sql to make it compatible with SqlCe.
12+
/// Performs some preprocessing step on a script
813
/// </summary>
9-
public class SqlCePreprocessor : IScriptPreprocessor
14+
public string Process(string contents)
1015
{
11-
/// <summary>
12-
/// Performs some preprocessing step on a script
13-
/// </summary>
14-
public string Process(string contents)
15-
{
16-
return Regex.Replace(contents, @"nvarchar\s?\(max\)", "ntext", RegexOptions.IgnoreCase);
17-
}
16+
return Regex.Replace(contents, @"nvarchar\s?\(max\)", "ntext", RegexOptions.IgnoreCase);
1817
}
1918
}

0 commit comments

Comments
 (0)