Skip to content

Commit

Permalink
Merge pull request #3 from wilcommerce/milestone-1.0.0
Browse files Browse the repository at this point in the history
Release 1.0.0
  • Loading branch information
albx authored Dec 21, 2019
2 parents bc1ba26 + 96ca05b commit bda27de
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 32 deletions.
36 changes: 27 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Wilcommerce.Auth.Data.EFCore
Contains an implementation of [Wilcommerce.Auth](https://github.com/wilcommerce/Wilcommerce.Auth) package using Entity Framework Core as persistence framework.

## Requirements
According to Entity Framework Core 3.1 requirements, this project is built using NETStandard 2.1 as Target Framework (See [https://docs.microsoft.com/it-it/ef/core/what-is-new/ef-core-3.0/breaking-changes#netstandard21](https://docs.microsoft.com/it-it/ef/core/what-is-new/ef-core-3.0/breaking-changes#netstandard21) for further informations).

This means it will not run on projects which target .NET Framework.

If you have some specific needs you can [open a issue on GitHub](https://github.com/wilcommerce/Wilcommerce.Auth.Data.EFCore/issues) or you can consider to [contribute to Wilcommerce](CONTRIBUTING.md).

## Installation
Nuget package available here

Expand All @@ -14,16 +21,27 @@ For example in an ASP.NET Core project add this line to the ConfigureServices me
services.AddDbContext<AuthContext>(options => // Specify your provider);
```

The AuthContext is injected in the read model component and the Repository implementation.
The AuthContext is injected in the read model component.

## Read model Component
The CatalogDatabase class is the implementation of the [IAuthDatabase](https://github.com/wilcommerce/Wilcommerce.Auth/blob/develop/src/Wilcommerce.Auth/ReadModels/IAuthDatabase.cs) interface.
After the DbContext has been registered in the ServiceCollection, you need to add a migration using **donet** CLI or the **Package Manager Console**.
```
// Using dotnet CLI
dotnet ef migrations add -c Wilcommerce.Auth.Data.EFCore.AuthContext Initial
It provides a facade to access all the readonly data.
It requires an instance of AuthContext as constructor parameters.
// Using Package Manager Console
EntityFrameworkCore\Add-Migration -Context Wilcommerce.Auth.Data.EFCore.AuthContext Initial
```

After this, you can update your database:
```
// Using dotnet CLI
dotnet ef database update -c Wilcommerce.Auth.Data.EFCore.AuthContext
## Repository Component
The Repository class is the implementation of the [IRepository](https://github.com/wilcommerce/Wilcommerce.Auth/blob/develop/src/Wilcommerce.Auth/Repository/IRepository.cs) interface.
// Using Package Manager Console
EntityFrameworkCore\Update-Database -Context Wilcommerce.Auth.Data.EFCore.AuthContext
It provides all the methods useful for persist an Aggregate model.
It requires a AuthContext instance as constructor parameter.
## Read model Component
The AuthDatabase class is the implementation of the [IAuthDatabase](https://github.com/wilcommerce/Wilcommerce.Auth/blob/develop/src/Wilcommerce.Auth/ReadModels/IAuthDatabase.cs) interface.
It provides a facade to access all the readonly data.
It requires an instance of AuthContext as constructor parameter.
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.1.4" />
<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">
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 0 additions & 7 deletions src/Wilcommerce.Auth.Data.EFCore/Mapping/IdentityMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ public static class IdentityMapping
/// <returns>The modelBuilder instance</returns>
public static ModelBuilder MapIdentity(this ModelBuilder modelBuilder)
{
foreach (var entity in modelBuilder.Model.GetEntityTypes())
{
entity
.Relational()
.TableName = $"Wilcommerce_{entity.ClrType.Name}";
}

modelBuilder.Entity<User>()
.OwnsOne(u => u.ProfileImage);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,28 @@

<PropertyGroup>
<VersionPrefix>1.0.0</VersionPrefix>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>Wilcommerce.Auth.Data.EFCore</AssemblyName>
<PackageId>Wilcommerce.Auth.Data.EFCore</PackageId>
<Version>1.0.0-rc4</Version>
<Version>1.0.0</Version>
<Authors>Alberto Mori</Authors>
<Description>Implementation of Authentication package for Entity Framework Core</Description>
<PackageLicenseUrl>https://github.com/wilcommerce/Wilcommerce.Auth.Data.EFCore/blob/master/LICENSE</PackageLicenseUrl>
<PackageIcon>icon.png</PackageIcon>
<PackageProjectUrl>https://github.com/wilcommerce/Wilcommerce.Auth.Data.EFCore</PackageProjectUrl>
<PackageIconUrl>http://wilcommerce.com/logo64.png</PackageIconUrl>
<RepositoryUrl>https://github.com/wilcommerce/Wilcommerce.Auth.Data.EFCore</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>wilcommerce;ecommerce;opensource;.netcore;.net;entity framework core</PackageTags>
<Title>Wilcommerce.Auth.Data.EFCore</Title>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\icon.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>bin\Debug\netstandard2.0\Wilcommerce.Auth.Data.EFCore.xml</DocumentationFile>
</PropertyGroup>
Expand All @@ -25,16 +33,19 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.1.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.1.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.1.4" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational.Design" Version="2.0.0-preview1-final" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.4">
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Wilcommerce.Auth" Version="1.0.0-rc6" />
<PackageReference Include="Wilcommerce.Auth" Version="1.0.0" />
</ItemGroup>

</Project>

0 comments on commit bda27de

Please sign in to comment.