Skip to content

Commit

Permalink
Merge branch 'release/1.0.0-rc4'
Browse files Browse the repository at this point in the history
  • Loading branch information
albx committed Sep 29, 2018
2 parents d230505 + ce7c268 commit eaabeac
Show file tree
Hide file tree
Showing 19 changed files with 75 additions and 447 deletions.
22 changes: 1 addition & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,12 @@ Nuget package available here
[https://www.nuget.org/packages/Wilcommerce.Core.Data.EFCore](https://www.nuget.org/packages/Wilcommerce.Core.Data.EFCore)

## Usage
Add the CommonContext class to your project.

For example in an ASP.NET Core project add this line to the ConfigureServices method in Startup.cs
```<C#>
services.AddDbContext<CommonContext>(options => // Specify your provider);
```
The CommonContext is injected in the read model component and the Repositoryimplementation.

If you need to persists the events using Entity Framework Core, add the EventsContext class to your project.
Add the the EventsContext class to your project.
```<C#>
services.AddDbContext<EventsContext>(options => // Specify your provider);
```
The EventsContext is injected in the EventStore implementation

## Read model Component
The CommonDatabase class is the Entity Framework Core implementation of the [ICommonDatabase](https://github.com/wilcommerce/Wilcommerce.Core/blob/master/src/Wilcommerce.Core.Common/Domain/ReadModels/ICommonDatabase.cs) interface.

It provides a facade to access all the readonly data.
It requires an instance of CommonContext as constructor parameters.

## Repository Component
The Repository class is the Entity Framework Core implementation of the [IRepository](https://github.com/wilcommerce/Wilcommerce.Core/blob/master/src/Wilcommerce.Core.Common/Domain/Repository/IRepository.cs) interface.

It provides all the methods useful for persist an Aggregate model.
It requires a CommonContext instance as constructor parameter.

## EventStore Component
The EventStore class is the Entity Framework Core implementation of the [IEventStore](https://github.com/wilcommerce/Wilcommerce.Core/blob/master/src/Wilcommerce.Core.Infrastructure/IEventStore.cs) interface.

Expand Down
1 change: 0 additions & 1 deletion Wilcommerce.Core.Data.EFCore.Test/Events/EventStoreTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Linq;
using Wilcommerce.Core.Common.Events.User;
using Wilcommerce.Core.Data.EFCore.Events;
using Wilcommerce.Core.Data.EFCore.Test.Fixtures;
using Xunit;
Expand Down
56 changes: 0 additions & 56 deletions Wilcommerce.Core.Data.EFCore.Test/Fixtures/CommonContextFixture.cs

This file was deleted.

4 changes: 1 addition & 3 deletions Wilcommerce.Core.Data.EFCore.Test/Fixtures/EventsFixtures.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using Microsoft.EntityFrameworkCore;
using System;
using Wilcommerce.Core.Common.Domain.Events;
using Wilcommerce.Core.Common.Events.User;
using Wilcommerce.Core.Data.EFCore.Events;
using Wilcommerce.Core.Common.Events;

namespace Wilcommerce.Core.Data.EFCore.Test.Fixtures
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using Wilcommerce.Core.Infrastructure;

namespace Wilcommerce.Core.Data.EFCore.Test.Fixtures
{
public class NewAdministratorCreatedEvent : DomainEvent
{
public Guid UserId { get; private set; }
public string Name { get; private set; }
public string Email { get; private set; }

public NewAdministratorCreatedEvent(Guid userId, string name, string email)
: base(userId ,typeof(NewAdministratorCreatedEvent))
{
UserId = userId;
Name = name;
Email = email;
}
}
}
16 changes: 16 additions & 0 deletions Wilcommerce.Core.Data.EFCore.Test/Fixtures/UserDisabledEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using Wilcommerce.Core.Infrastructure;

namespace Wilcommerce.Core.Data.EFCore.Test.Fixtures
{
public class UserDisabledEvent : DomainEvent
{
public Guid UserId { get; private set; }

public UserDisabledEvent(Guid userId)
: base(userId, typeof(UserDisabledEvent))
{
UserId = userId;
}
}
}
16 changes: 16 additions & 0 deletions Wilcommerce.Core.Data.EFCore.Test/Fixtures/UserEnabledEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using Wilcommerce.Core.Infrastructure;

namespace Wilcommerce.Core.Data.EFCore.Test.Fixtures
{
public class UserEnabledEvent : DomainEvent
{
public Guid UserId { get; private set; }

public UserEnabledEvent(Guid userId)
: base(userId, typeof(UserEnabledEvent))
{
UserId = userId;
}
}
}
37 changes: 0 additions & 37 deletions Wilcommerce.Core.Data.EFCore.Test/ReadModels/CommonDatabaseTest.cs

This file was deleted.

52 changes: 0 additions & 52 deletions Wilcommerce.Core.Data.EFCore.Test/Repository/RepositoryTest.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
<PackageReference Include="Moq" Version="4.8.2" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.1.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="Moq" Version="4.10.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
45 changes: 0 additions & 45 deletions src/Wilcommerce.Core.Data.EFCore/CommonContext.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/Wilcommerce.Core.Data.EFCore/Events/EventStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Wilcommerce.Core.Common.Domain.Events;
using Wilcommerce.Core.Common.Events;
using Wilcommerce.Core.Infrastructure;

namespace Wilcommerce.Core.Data.EFCore.Events
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Microsoft.EntityFrameworkCore;
using Wilcommerce.Core.Common.Domain.Events;
using Wilcommerce.Core.Common.Events;
using Wilcommerce.Core.Data.EFCore.Mapping;

namespace Wilcommerce.Core.Data.EFCore.Events
namespace Wilcommerce.Core.Data.EFCore
{
/// <summary>
/// Defines the Entity Framework context for the events
Expand Down
2 changes: 1 addition & 1 deletion src/Wilcommerce.Core.Data.EFCore/Mapping/EventMapping.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Wilcommerce.Core.Common.Domain.Events;
using Wilcommerce.Core.Common.Events;

namespace Wilcommerce.Core.Data.EFCore.Mapping
{
Expand Down
28 changes: 0 additions & 28 deletions src/Wilcommerce.Core.Data.EFCore/Mapping/GeneralSettingsMapping.cs

This file was deleted.

Loading

0 comments on commit eaabeac

Please sign in to comment.