Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/5.0.2 #730

Merged
merged 17 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,6 @@ data/dsl/*.java
# Nodejs / NPM
node_modules
package-lock.json

!tools/**
!tools/packages.config
6 changes: 3 additions & 3 deletions src/Orc.DataAccess.Example/Orc.DataAccess.Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

<ItemGroup>
<PackageReference Include="Catel.Fody" Version="4.9.0" PrivateAssets="all" />
<PackageReference Include="Fody" Version="6.8.0" PrivateAssets="all">
<PackageReference Include="Fody" Version="6.8.2" PrivateAssets="all">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="LoadAssembliesOnStartup.Fody" Version="4.6.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.4" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
<PackageReference Include="ModuleInit.Fody" Version="2.1.1" PrivateAssets="all" />
<PackageReference Include="Orchestra.Core" Version="7.0.0" />
<PackageReference Include="Orchestra.Core" Version="7.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Orc.Automation.Controls;
using Orc.Automation.Tests;

public abstract class StyledControlTestFacts<TControl> : ControlUiTestFactsBase<TControl>
public abstract class StyledControlTestFacts<TControl> : ControlUiTestsBase<TControl>
where TControl : System.Windows.FrameworkElement
{
protected override bool TryLoadControl(TestHostAutomationControl testHost, out string testedControlAutomationId)
Expand Down
18 changes: 9 additions & 9 deletions src/Orc.DataAccess.Tests/Helpers/KeyValueStringParserFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
[TestFixture]
public class KeyValueStringParserFacts
{
[TestCase(@"ConnectionString=Data Source=myServer\sqlexpress;Initial Catalog=TestProject;Integrated Security=True; , Table=RelationOperations,Dialect=SQLSERVER_2008 ",
[TestCase($@"ConnectionString=Data Source=myServer\sqlexpress;Initial Catalog=TestProject;Integrated Security=True; {KeyValueStringParser.KeyValuePairsDelimiter}Table=RelationOperations{KeyValueStringParser.KeyValuePairsDelimiter} Dialect=SQLSERVER_2008 ",
new[] {"ConnectionString", "Table", "Dialect"},
new[] {@"Data Source=myServer\sqlexpress;Initial Catalog=TestProject;Integrated Security=True;", "RelationOperations", "SQLSERVER_2008"})]
[TestCase(@"FilePath=ElsinoreData.xlsx, Worksheet=Operation, CellRange=A212 ",
[TestCase(@$"FilePath=ElsinoreData.xlsx{KeyValueStringParser.KeyValuePairsDelimiter} Worksheet=Operation{KeyValueStringParser.KeyValuePairsDelimiter} CellRange=A212 ",
new[] {"FilePath", "Worksheet", "CellRange"},
new[] {@"ElsinoreData.xlsx", "Operation", "A212"})]
public void CorrectlyParseSourceIntoKeyValueDictionary(string source, string[] expectedKeys, string[] expectedValues)
Expand All @@ -23,9 +23,9 @@ public void CorrectlyParseSourceIntoKeyValueDictionary(string source, string[] e
}

[TestCase(new[] {"ConnectionString", "Table", "Dialect"}, new[] {@"Data Source=myServer\sqlexpress;Initial Catalog=TestProject;Integrated Security=True;", "RelationOperations", "SQLSERVER_2008"},
@"ConnectionString=Data Source=myServer\sqlexpress;Initial Catalog=TestProject;Integrated Security=True;, Table=RelationOperations, Dialect=SQLSERVER_2008")]
$@"ConnectionString=Data Source=myServer\sqlexpress;Initial Catalog=TestProject;Integrated Security=True;{KeyValueStringParser.KeyValuePairsDelimiter} Table=RelationOperations{KeyValueStringParser.KeyValuePairsDelimiter} Dialect=SQLSERVER_2008")]
[TestCase(new[] {"FilePath", "Worksheet", "CellRange"}, new[] {@"ElsinoreData.xlsx", "Operation", "A212"},
@"FilePath=ElsinoreData.xlsx, Worksheet=Operation, CellRange=A212")]
$@"FilePath=ElsinoreData.xlsx{KeyValueStringParser.KeyValuePairsDelimiter} Worksheet=Operation{KeyValueStringParser.KeyValuePairsDelimiter} CellRange=A212")]
public void CorrectlyFormatToKeyValueString(string[] keys, string[] values, string expectedResult)
{
var sourceKeyValues = keys.Zip(values, (key, value) => new KeyValuePair<string, string>(key, value));
Expand All @@ -35,11 +35,11 @@ public void CorrectlyFormatToKeyValueString(string[] keys, string[] values, stri
Assert.That(expectedResult, Is.EqualTo(result));
}

[TestCase(@"ConnectionString=Data Source=myServer\sqlexpress;Initial Catalog=TestProject;Integrated Security=True;, Table=RelationOperations, Dialect=SQLSERVER_2008", "Catalog",
"SomeValue", @"ConnectionString=Data Source=myServer\sqlexpress;Initial Catalog=TestProject;Integrated Security=True;, Table=RelationOperations, Dialect=SQLSERVER_2008, Catalog=SomeValue")]
[TestCase(@"ConnectionString=Data Source=myServer\sqlexpress;Initial Catalog=TestProject;Integrated Security=True;, Table=RelationOperations, Dialect=SQLSERVER_2008", "ConnectionString",
"Other connection string", @"ConnectionString=Other connection string, Table=RelationOperations, Dialect=SQLSERVER_2008")]
[TestCase(@"FilePath =ElsinoreData.xlsx, Worksheet=Operation, CellRange=A212", "Worksheet", "Other worksheet", @"FilePath =ElsinoreData.xlsx, Worksheet=Other worksheet, CellRange=A212")]
[TestCase($@"ConnectionString=Data Source=myServer\sqlexpress;Initial Catalog=TestProject;Integrated Security=True;{KeyValueStringParser.KeyValuePairsDelimiter} Table=RelationOperations{KeyValueStringParser.KeyValuePairsDelimiter} Dialect=SQLSERVER_2008", "Catalog",
"SomeValue", $@"ConnectionString=Data Source=myServer\sqlexpress;Initial Catalog=TestProject;Integrated Security=True;{KeyValueStringParser.KeyValuePairsDelimiter} Table=RelationOperations{KeyValueStringParser.KeyValuePairsDelimiter} Dialect=SQLSERVER_2008{KeyValueStringParser.KeyValuePairsDelimiter} Catalog=SomeValue")]
[TestCase($@"ConnectionString=Data Source=myServer\sqlexpress;Initial Catalog=TestProject;Integrated Security=True;{KeyValueStringParser.KeyValuePairsDelimiter} Table=RelationOperations{KeyValueStringParser.KeyValuePairsDelimiter} Dialect=SQLSERVER_2008", "ConnectionString",
"Other connection string", $@"ConnectionString=Other connection string{KeyValueStringParser.KeyValuePairsDelimiter} Table=RelationOperations{KeyValueStringParser.KeyValuePairsDelimiter} Dialect=SQLSERVER_2008")]
[TestCase($@"FilePath =ElsinoreData.xlsx{KeyValueStringParser.KeyValuePairsDelimiter} Worksheet=Operation{KeyValueStringParser.KeyValuePairsDelimiter} CellRange=A212", "Worksheet", "Other worksheet", $@"FilePath =ElsinoreData.xlsx{KeyValueStringParser.KeyValuePairsDelimiter} Worksheet=Other worksheet{KeyValueStringParser.KeyValuePairsDelimiter} CellRange=A212")]
public void CorrectlySetValueByKeyToKeyValueString(string source, string key, string value, string expectedSource)
{
var result = KeyValueStringParser.SetValue(source, key, value);
Expand Down
14 changes: 7 additions & 7 deletions src/Orc.DataAccess.Tests/Orc.DataAccess.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@

<ItemGroup>
<PackageReference Include="Catel.Fody" Version="4.9.0" PrivateAssets="all" />
<PackageReference Include="Fody" Version="6.8.0" PrivateAssets="all">
<PackageReference Include="Fody" Version="6.8.2" PrivateAssets="all">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="MethodBoundaryAspect.Fody" Version="2.0.149" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="ModuleInit.Fody" Version="2.1.1" PrivateAssets="all" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="NUnit" Version="4.0.1" PrivateAssets="all" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Orc.Automation.Tests" Version="5.0.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="NUnit" Version="4.2.2" PrivateAssets="all" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="Orc.Automation.Tests" Version="5.0.5" />
<PackageReference Include="PublicApiGenerator" Version="11.1.0" PrivateAssets="all" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="Verify.NUnit" Version="22.8.0" />
<PackageReference Include="Verify.NUnit" Version="27.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Reflection;
using NUnit.Framework;
using Database;
using Microsoft.Win32;
using Moq;
using Orc.Automation.Tests;
using NUnit.Framework;

[TestFixture]
public class SystemSqlDbDataSourceProviderTests
{
[TestCase<SystemSqlDbDataSourceProvider>("System.Data.SqlClient")]
[TestCase<MsSqlDbDataSourceProvider>("Microsoft.Data.SqlClient")]
[Orc.Automation.Tests.TestCase<SystemSqlDbDataSourceProvider>("System.Data.SqlClient")]
[Orc.Automation.Tests.TestCase<MsSqlDbDataSourceProvider>("Microsoft.Data.SqlClient")]
public void GetDataSources_Returns_Correct_Local_Server_List<T>(string providerName)
where T : MsSqlDbDataSourceProviderBase
{
Expand All @@ -35,10 +33,7 @@ public void GetDataSources_Returns_Correct_Local_Server_List<T>(string providerN
{
if (Equals(x, "InstalledInstances"))
{
return new List<string>
{
serverName
};
return new List<string> { serverName };
}

return null;
Expand All @@ -60,17 +55,17 @@ public void GetDataSources_Returns_Correct_Local_Server_List<T>(string providerN
{
return null;
}

return registerKey.Object;
});

var dbProvider = (T) Activator.CreateInstance(typeof(T), BindingFlags.NonPublic | BindingFlags.Instance,
(Binder?) null, new object?[] {registerKeyService.Object}, (CultureInfo?)null);
var dbProvider = (T)Activator.CreateInstance(typeof(T), BindingFlags.NonPublic | BindingFlags.Instance,
null, new object?[] { registerKeyService.Object }, null);

var expectedServerName = $"{Environment.MachineName}\\{serverName}";

var sources = dbProvider.GetDataSources();

Assert.That(sources, Is.EquivalentTo(new []{ new DbDataSource(providerName, expectedServerName) }));
Assert.That(sources, Is.EquivalentTo(new[] { new DbDataSource(providerName, expectedServerName) }));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace Orc.DataAccess
public static class KeyValueStringParser
{
public const char KeyValueDelimiter = '=';
public const char KeyValuePairsDelimiter = ',';
public const string KeyValuePairsDelimiter = "|||";
public static string FormatToKeyValueString(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string>> keyPairs) { }
public static string? GetValue(string source, string key) { }
public static System.Collections.Generic.Dictionary<string, string> Parse(string source) { }
Expand Down Expand Up @@ -257,14 +257,14 @@ namespace Orc.DataAccess.Database
{
public static void ConnectInstance<TBaseType>(this Orc.DataAccess.Database.DbProvider dbProvider, TBaseType instance) { }
public static void ConnectType<TBaseType>(this Orc.DataAccess.Database.DbProvider dbProvider, System.Type type) { }
public static T CreateConnectedInstance<T>(this Orc.DataAccess.Database.DbProvider dbProvider, params object[] parameters)
public static T? CreateConnectedInstance<T>(this Orc.DataAccess.Database.DbProvider dbProvider, params object[] parameters)
where T : notnull { }
public static System.Data.Common.DbConnection? CreateConnection(this Orc.DataAccess.Database.DbProvider dbProvider, Orc.DataAccess.Database.DatabaseSource databaseSource) { }
public static System.Data.Common.DbConnection? CreateConnection(this Orc.DataAccess.Database.DbProvider dbProvider, string connectionString) { }
public static Orc.DataAccess.Database.DbSourceGatewayBase CreateDbSourceGateway(this Orc.DataAccess.Database.DbProvider dbProvider, Orc.DataAccess.Database.DatabaseSource databaseSource) { }
public static Orc.DataAccess.Database.DbSourceGatewayBase? CreateDbSourceGateway(this Orc.DataAccess.Database.DbProvider dbProvider, Orc.DataAccess.Database.DatabaseSource databaseSource) { }
public static System.Collections.Generic.IList<System.Type> GetConnectedTypes<T>(this Orc.DataAccess.Database.DbProvider dbProvider) { }
public static System.Collections.Generic.IList<Orc.DataAccess.Database.DbDataSource> GetDataSources(this Orc.DataAccess.Database.DbProvider dbProvider) { }
public static T GetOrCreateConnectedInstance<T>(this Orc.DataAccess.Database.DbProvider dbProvider)
public static T? GetOrCreateConnectedInstance<T>(this Orc.DataAccess.Database.DbProvider dbProvider)
where T : notnull { }
}
public class DbProviderFactoryRepository
Expand Down Expand Up @@ -338,24 +338,23 @@ namespace Orc.DataAccess.Database
protected abstract string ProviderName { get; }
public virtual System.Collections.Generic.IList<Orc.DataAccess.Database.DbDataSource> GetDataSources() { }
}
[Orc.DataAccess.Database.ConnectToProvider("System.Data.SqlClient")]
public class MsSqlDbSourceGateway : Orc.DataAccess.Database.SqlDbSourceGatewayBase
[Orc.DataAccess.Database.ConnectToProvider("Microsoft.Data.SqlClient")]
public class MsSqlDbSourceGateway : Orc.DataAccess.Database.MsSqlDbSourceGatewayBase
{
public MsSqlDbSourceGateway(Orc.DataAccess.Database.DatabaseSource source) { }
}
public abstract class MsSqlDbSourceGatewayBase : Orc.DataAccess.Database.SqlDbSourceGatewayBase
{
public MsSqlDbSourceGatewayBase(Orc.DataAccess.Database.DatabaseSource source) { }
protected override System.Collections.Generic.Dictionary<Orc.DataAccess.Database.TableType, System.Func<Orc.DataAccess.DataSourceParameters>> DataSourceParametersFactory { get; }
protected override System.Collections.Generic.Dictionary<Orc.DataAccess.Database.TableType, System.Func<System.Data.Common.DbConnection, System.Data.Common.DbCommand>> GetObjectListCommandsFactory { get; }
protected override System.Data.Common.DbCommand CreateGetTableRecordsCommand(System.Data.Common.DbConnection connection, Orc.DataAccess.DataSourceParameters parameters, int offset, int fetchCount, bool isPagingEnabled) { }
protected override System.Data.Common.DbCommand CreateTableCountCommand(System.Data.Common.DbConnection connection) { }
}
[Orc.DataAccess.Database.ConnectToProvider("MySql.Data.MySqlClient")]
public class MySqlSourceGateway : Orc.DataAccess.Database.SqlDbSourceGatewayBase
public class MySqlSourceGateway : Orc.DataAccess.Database.MsSqlDbSourceGatewayBase
{
public MySqlSourceGateway(Orc.DataAccess.Database.DatabaseSource source) { }
protected override System.Collections.Generic.Dictionary<Orc.DataAccess.Database.TableType, System.Func<Orc.DataAccess.DataSourceParameters>> DataSourceParametersFactory { get; }
protected override System.Collections.Generic.Dictionary<Orc.DataAccess.Database.TableType, System.Func<System.Data.Common.DbConnection, System.Data.Common.DbCommand>> GetObjectListCommandsFactory { get; }
protected override System.Data.Common.DbCommand CreateGetFunctionRecordsCommand(System.Data.Common.DbConnection connection, Orc.DataAccess.DataSourceParameters parameters, int offset, int fetchCount) { }
protected override System.Data.Common.DbCommand CreateGetTableRecordsCommand(System.Data.Common.DbConnection connection, Orc.DataAccess.DataSourceParameters parameters, int offset, int fetchCount, bool isPagingEnabled) { }
protected override System.Data.Common.DbCommand CreateTableCountCommand(System.Data.Common.DbConnection connection) { }
}
[Orc.DataAccess.Database.ConnectToProvider("Oracle.ManagedDataAccess.Client")]
public class OracleSourceGateway : Orc.DataAccess.Database.SqlDbSourceGatewayBase
Expand All @@ -379,7 +378,7 @@ namespace Orc.DataAccess.Database
protected override System.Data.Common.DbCommand CreateTableCountCommand(System.Data.Common.DbConnection connection) { }
public override Orc.DataAccess.DataSourceParameters GetQueryParameters() { }
}
[Orc.DataAccess.Database.ConnectToProvider("System.Data.SQLite")]
[Orc.DataAccess.Database.ConnectToProvider("SQLite Data Provider")]
public class SqLiteSourceGateway : Orc.DataAccess.Database.SqlDbSourceGatewayBase
{
public SqLiteSourceGateway(Orc.DataAccess.Database.DatabaseSource source) { }
Expand Down Expand Up @@ -443,6 +442,11 @@ namespace Orc.DataAccess.Database
public SystemSqlDbDataSourceProvider() { }
protected override string ProviderName { get; }
}
[Orc.DataAccess.Database.ConnectToProvider("System.Data.SqlClient")]
public class SystemSqlDbSourceGateway : Orc.DataAccess.Database.MsSqlDbSourceGatewayBase
{
public SystemSqlDbSourceGateway(Orc.DataAccess.Database.DatabaseSource source) { }
}
public enum TableType
{
Table = 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public ConnectionStringAdvancedOptionsViewModel(DbConnectionString connectionStr
ArgumentNullException.ThrowIfNull(connectionString);

ConnectionString = connectionString;
ConnectionStringProperties = Array.Empty<DbConnectionStringProperty>();
ConnectionStringProperties = [];

_updateFilterTimer.Interval = TimeSpan.FromMilliseconds(200);
_updateFilterTimer.Tick += OnUpdateFilterTimerTick;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ private async void OnEditCommandExecuted(object sender, ExecutedRoutedEventArgs
{
_dbProvider = connectionStringEditViewModel.DbProvider;
var connectionString = connectionStringEditViewModel.ConnectionString;


SetCurrentValue(DatabaseProviderProperty, connectionString?.DbProvider.InvariantName);
SetCurrentValue(ConnectionStringProperty, connectionString?.ToString());
_connectionStringTextBox?.SetCurrentValue(TextBox.TextProperty, connectionString?.ToDisplayString());
SetCurrentValue(ConnectionStateProperty, connectionStringEditViewModel.ConnectionState);
SetCurrentValue(DatabaseProviderProperty, connectionString?.DbProvider.InvariantName);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Orc.DataAccess.Xaml/Orc.DataAccess.Xaml.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@

<ItemGroup>
<PackageReference Include="Catel.Fody" Version="4.9.0" PrivateAssets="all" />
<PackageReference Include="Fody" Version="6.8.0" PrivateAssets="all">
<PackageReference Include="Fody" Version="6.8.2" PrivateAssets="all">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="MethodTimer.Fody" Version="3.2.2" PrivateAssets="all" />
<PackageReference Include="ModuleInit.Fody" Version="2.1.1" PrivateAssets="all" />
<PackageReference Include="Obsolete.Fody" Version="5.3.0" PrivateAssets="all" />
<PackageReference Include="Orc.Controls" Version="5.0.1" />
<PackageReference Include="Orc.Controls" Version="5.0.7" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static class DbConnectionStringExtensions

var provider = connectionString.DbProvider;
var schemaProvider = provider.GetProvider().GetOrCreateConnectedInstance<IDataSourceSchemaProvider>();
return schemaProvider.GetSchema(connectionString);
return schemaProvider?.GetSchema(connectionString);
}

public static ConnectionState GetConnectionState(this DbConnectionString connectionString)
Expand Down
Loading