Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmus committed Apr 30, 2018
2 parents 47ef8b5 + 1ec1c72 commit ebc0df2
Show file tree
Hide file tree
Showing 25 changed files with 305 additions and 67 deletions.
8 changes: 7 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
### New in 0.56 (not released yet)
### New in 0.57 (not released yet)

* Fixed: AggregateException/InvalidOperationException when reading and updating
an aggregate from different threads at the same time using `InMemoryEventPersistence`
* New: .NET standard 1.6 and 2.0 support for `EventFlow.MsSql` package

### New in 0.56.3328 (released 2018-04-24)

* New: Allow enums to be used in `SingleValueObject<T>` and protect from
undefined enum values
Expand Down
3 changes: 3 additions & 0 deletions Source/EventFlow.Autofac.Tests/EventFlow.Autofac.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
<ProjectReference Include="..\EventFlow.Autofac\EventFlow.Autofac.csproj" />
<ProjectReference Include="..\EventFlow.TestHelpers\EventFlow.TestHelpers.csproj" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
<ProjectReference Include="..\EventFlow.Elasticsearch\EventFlow.Elasticsearch.csproj" />
<ProjectReference Include="..\EventFlow.TestHelpers\EventFlow.TestHelpers.csproj" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
<ProjectReference Include="..\EventFlow.EventStores.EventStore\EventFlow.EventStores.EventStore.csproj" />
<ProjectReference Include="..\EventFlow.TestHelpers\EventFlow.TestHelpers.csproj" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@
<ProjectReference Include="..\EventFlow.Examples.Shipping\EventFlow.Examples.Shipping.csproj" />
<ProjectReference Include="..\EventFlow.TestHelpers\EventFlow.TestHelpers.csproj" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@
<ItemGroup>
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>
3 changes: 3 additions & 0 deletions Source/EventFlow.MsSql.Tests/EventFlow.MsSql.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@
<EmbeddedResource Include="IntegrationTests\ReadStores\Scripts\0001 - Create table ReadModel-ThingyAggregate.sql" />
<EmbeddedResource Include="IntegrationTests\ReadStores\Scripts\0002 - Create table ReadModel-ThingyMessage.sql" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>
5 changes: 4 additions & 1 deletion Source/EventFlow.MsSql/EventFlow.MsSql.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../Common.props" />
<PropertyGroup>
<TargetFramework>net451</TargetFramework>
<TargetFrameworks>net451;netstandard1.6;netstandard2.0</TargetFrameworks>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<GenerateAssemblyInfo>True</GenerateAssemblyInfo>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
Expand All @@ -23,6 +23,9 @@
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="dbup-sqlserver" Version="4.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EventFlow.Sql\EventFlow.Sql.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace EventFlow.MsSql.EventStores
{
public static class EventFlowEventStoresMsSql
{
public static Assembly Assembly { get; } = typeof(EventFlowEventStoresMsSql).Assembly;
public static Assembly Assembly { get; } = typeof(EventFlowEventStoresMsSql).GetTypeInfo().Assembly;

public static IEnumerable<SqlScript> GetSqlScripts()
{
Expand Down
6 changes: 6 additions & 0 deletions Source/EventFlow.MsSql/MsSqlDatabaseMigrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

using DbUp.Builder;
using EventFlow.Logs;
using EventFlow.Sql.Migrations;

Expand All @@ -34,5 +35,10 @@ public MsSqlDatabaseMigrator(
: base(log, sqlConfiguration)
{
}

protected override UpgradeEngineBuilder For(SupportedDatabases supportedDatabases, string connectionString)
{
return supportedDatabases.SqlDatabase(connectionString);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace EventFlow.MsSql.SnapshotStores
{
public static class EventFlowSnapshotStoresMsSql
{
public static Assembly Assembly { get; } = typeof(EventFlowSnapshotStoresMsSql).Assembly;
public static Assembly Assembly { get; } = typeof(EventFlowSnapshotStoresMsSql).GetTypeInfo().Assembly;

public static IEnumerable<SqlScript> GetSqlScripts()
{
Expand Down
3 changes: 3 additions & 0 deletions Source/EventFlow.Owin.Tests/EventFlow.Owin.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@
<ProjectReference Include="..\EventFlow.Owin\EventFlow.Owin.csproj" />
<ProjectReference Include="..\EventFlow.TestHelpers\EventFlow.TestHelpers.csproj" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@
<ProjectReference Include="..\EventFlow.RabbitMQ\EventFlow.RabbitMQ.csproj" />
<ProjectReference Include="..\EventFlow.TestHelpers\EventFlow.TestHelpers.csproj" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>
3 changes: 3 additions & 0 deletions Source/EventFlow.SQLite.Tests/EventFlow.SQLite.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@
<ProjectReference Include="..\EventFlow.SQLite\EventFlow.SQLite.csproj" />
<ProjectReference Include="..\EventFlow.TestHelpers\EventFlow.TestHelpers.csproj" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions Source/EventFlow.SQLite/EventFlow.SQLite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="dbup-sqlserver" Version="4.0.0" />
<PackageReference Include="System.Data.SQLite" Version="1.0.105" />
</ItemGroup>
<ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions Source/EventFlow.Sql.Tests/EventFlow.Sql.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@
<ItemGroup>
<Reference Include="System.ComponentModel.DataAnnotations" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Source/EventFlow.Sql/EventFlow.Sql.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="1.50.2" />
<PackageReference Condition="'$(TargetFramework)' == 'net451'" Include="dbup" Version="3.3.5" />
<PackageReference Include="dbup-core" Version="4.0.0" />
<PackageReference Condition="'$(TargetFramework)' == 'netstandard1.6'" Include="System.ComponentModel.Annotations" Version="4.3.0" />
<PackageReference Condition="'$(TargetFramework)' == 'netstandard2.0'" Include="System.ComponentModel.Annotations" Version="4.4.1" />
</ItemGroup>
Expand Down
4 changes: 0 additions & 4 deletions Source/EventFlow.Sql/Integrations/DbUpUpgradeLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#if NET451

using DbUp.Engine.Output;
using EventFlow.Logs;

Expand Down Expand Up @@ -53,5 +51,3 @@ public void WriteWarning(string format, params object[] args)
}
}
}

#endif
17 changes: 7 additions & 10 deletions Source/EventFlow.Sql/Migrations/SqlDatabaseMigrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#if NET451

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using DbUp;
using DbUp.Builder;
using DbUp.Engine;
using EventFlow.Logs;
using EventFlow.Sql.Connections;
Expand All @@ -36,13 +35,13 @@

namespace EventFlow.Sql.Migrations
{
public class SqlDatabaseMigrator<TConfiguration> : ISqlDatabaseMigrator
public abstract class SqlDatabaseMigrator<TConfiguration> : ISqlDatabaseMigrator
where TConfiguration : ISqlConfiguration<TConfiguration>
{
private readonly ILog _log;
private readonly TConfiguration _sqlConfiguration;

public SqlDatabaseMigrator(
protected SqlDatabaseMigrator(
ILog log,
TConfiguration sqlConfiguration)
{
Expand All @@ -57,8 +56,7 @@ public void MigrateDatabaseUsingEmbeddedScripts(Assembly assembly)

public void MigrateDatabaseUsingEmbeddedScripts(Assembly assembly, string connectionString)
{
var upgradeEngine = DeployChanges.To
.SqlDatabase(connectionString)
var upgradeEngine = For(DeployChanges.To, connectionString)
.WithScriptsEmbeddedInAssembly(assembly)
.WithExecutionTimeout(TimeSpan.FromMinutes(5))
.WithTransaction()
Expand All @@ -76,8 +74,7 @@ public void MigrateDatabaseUsingScripts(IEnumerable<SqlScript> sqlScripts)
public void MigrateDatabaseUsingScripts(IEnumerable<SqlScript> sqlScripts, string connectionString)
{
var dbUpSqlScripts = sqlScripts.Select(s => new DbUp.Engine.SqlScript(s.Name, s.Content));
var upgradeEngine = DeployChanges.To
.SqlDatabase(connectionString)
var upgradeEngine = For(DeployChanges.To, connectionString)
.WithScripts(dbUpSqlScripts)
.WithExecutionTimeout(TimeSpan.FromMinutes(5))
.WithTransaction()
Expand All @@ -103,7 +100,7 @@ private void Upgrade(UpgradeEngine upgradeEngine)
throw new SqlMigrationException(scripts, result.Error.Message, result.Error);
}
}

protected abstract UpgradeEngineBuilder For(SupportedDatabases supportedDatabases, string connectionString);
}
}

#endif
2 changes: 1 addition & 1 deletion Source/EventFlow.TestHelpers/MsSql/MsSqlHelpz.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static MsSqlConnectionString CreateConnectionString(string label)
var envrionmentUsername = Environment.GetEnvironmentVariable("HELPZ_MSSQL_USER");

connectionstringParts.Add(string.IsNullOrEmpty(environmentServer)
? @"Server=localhost\SQLEXPRESS"
? @"Server=."
: $"Server={environmentServer}");
connectionstringParts.Add(string.IsNullOrEmpty(envrionmentUsername)
? @"Integrated Security=True"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public async Task AsynchronousSubscribesGetInvoked()
var pingId = await PublishPingCommandAsync(A<ThingyId>()).ConfigureAwait(false);

// Assert
var receivedPingId = _testAsynchronousSubscriber.PingIds.Take();
var receivedPingId = await Task.Run(() => _testAsynchronousSubscriber.PingIds.Take()).ConfigureAwait(false);
receivedPingId.Should().IsSameOrEqualTo(pingId);
}

Expand Down
Loading

0 comments on commit ebc0df2

Please sign in to comment.