Skip to content

Commit 3102db1

Browse files
authored
Merge pull request #6 from AppCoreNet/dev
Release v0.4.0
2 parents 7c0bef0 + 4f3d543 commit 3102db1

80 files changed

Lines changed: 3069 additions & 2277 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Directory.Build.props

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,24 @@
22
<PropertyGroup>
33
<Authors>AppCore .NET Contributors</Authors>
44
<Company>The AppCore .NET project</Company>
5-
<Product>AppCore .NET Project Template</Product>
6-
<Copyright>Copyright (c) 2018-2020 the AppCore .NET project</Copyright>
5+
<Product>AppCore .NET data providers</Product>
6+
<Copyright>Copyright (c) 2018-2022 the AppCore .NET project</Copyright>
77
<Version>1.0.0</Version>
88
<PackageLicenseExpression>MIT</PackageLicenseExpression>
99
<RepositoryUrl>https://github.com/AppCoreNet/Template</RepositoryUrl>
1010
<RepositoryType>git</RepositoryType>
11+
<Nullable>enable</Nullable>
1112
<LangVersion>latest</LangVersion>
12-
<NoWarn>$(NoWarn);NU5105</NoWarn>
1313
<!--
1414
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
1515
<RestoreLockedMode Condition="'$(CI)' == 'true'">true</RestoreLockedMode>
1616
-->
17+
<DefineConstants>$(DefineConstants);ENABLE_NULLABLE</DefineConstants>
1718
</PropertyGroup>
1819

1920
<Import Project="./build/shared/dotnet/common.props" />
2021
<Import Project="./build/shared/dotnet/netfx.props" />
21-
22+
2223
<Import Project="./build/sources.props" />
2324
<Import Project="./build/dependency-versions.props" />
2425

build/dependency-versions.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<AppCore_Shared_Version>0.3.0</AppCore_Shared_Version>
4-
<AppCore_DI_Version>0.3.0</AppCore_DI_Version>
3+
<AppCore_Shared_Version>0.4.3</AppCore_Shared_Version>
4+
<AppCore_Extensions_Version>0.4.0</AppCore_Extensions_Version>
55
</PropertyGroup>
66
</Project>

build/shared/azure-pipelines/install-steps.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
steps:
2-
- task: UseDotNet@2
3-
displayName: 'Install .NET Core SDK 2.1'
4-
inputs:
5-
version: '2.1.x'
2+
63
- task: UseDotNet@2
74
displayName: 'Install .NET Core SDK 3.1'
85
inputs:
96
version: '3.1.x'
107
- task: UseDotNet@2
118
displayName: 'Install .NET SDK 5'
129
inputs:
13-
version: '5.x'
10+
version: '5.x'
1411
- task: UseDotNet@2
1512
displayName: 'Install .NET SDK 6'
1613
inputs:

global.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"sdk": {
3+
"version": "6.0.101",
4+
"rollForward": "latestFeature"
5+
}
6+
}

src/AppCore.Data.Abstractions/AppCore.Data.Abstractions.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.1;netstandard2.0;net461</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.1;netstandard2.0;net462</TargetFrameworks>
55
<RootNamespace>AppCore.Data</RootNamespace>
66
<Description>Provides public API for the AppCore .NET persistence framework.</Description>
77
</PropertyGroup>
@@ -11,10 +11,9 @@
1111
<PrivateAssets>all</PrivateAssets>
1212
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
1313
</PackageReference>
14-
<PackageReference Include="AppCore.DependencyInjection.Abstractions" Version="$(AppCore_DI_Version)" />
1514
</ItemGroup>
1615

17-
<ItemGroup Condition="'$(TargetFramework)'=='net461' OR '$(TargetFramework)'=='netstandard2.0'">
16+
<ItemGroup Condition="'$(TargetFramework)'=='net462' OR '$(TargetFramework)'=='netstandard2.0'">
1817
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.0.0" />
1918
</ItemGroup>
2019

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
// Licensed under the MIT License.
22
// Copyright (c) 2020 the AppCore .NET project.
33

4-
namespace AppCore.Data
4+
namespace AppCore.Data;
5+
6+
/// <summary>
7+
/// Identifies the default data provider.
8+
/// </summary>
9+
public sealed class DefaultDataProvider
510
{
6-
/// <summary>
7-
/// Identifies the default data provider.
8-
/// </summary>
9-
public sealed class DefaultDataProvider
11+
private DefaultDataProvider()
1012
{
11-
private DefaultDataProvider()
12-
{
13-
}
1413
}
15-
}
14+
}

src/AppCore.Data.Abstractions/EntityConcurrencyException.cs

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,28 @@
33

44
using System;
55

6-
namespace AppCore.Data
6+
namespace AppCore.Data;
7+
8+
/// <summary>
9+
/// Exception which is thrown when entities could not be updated because of optimistic concurrency checks.
10+
/// </summary>
11+
public class EntityConcurrencyException : EntityException
712
{
813
/// <summary>
9-
/// Exception which is thrown when entities could not be updated because of optimistic concurrency checks.
14+
/// Initializes a new instance of the <see cref="EntityConcurrencyException"/> class.
1015
/// </summary>
11-
public class EntityConcurrencyException : EntityException
16+
/// <param name="innerException">The inner exception.</param>
17+
public EntityConcurrencyException(Exception? innerException)
18+
: base("Entities may have been modified or deleted since they were loaded.",
19+
innerException)
1220
{
13-
/// <summary>
14-
/// Initializes a new instance of the <see cref="EntityConcurrencyException"/> class.
15-
/// </summary>
16-
/// <param name="innerException">The inner exception.</param>
17-
public EntityConcurrencyException(Exception innerException)
18-
: base("Entities may have been modified or deleted since they were loaded.",
19-
innerException)
20-
{
21-
}
21+
}
2222

23-
/// <summary>
24-
/// Initializes a new instance of the <see cref="EntityConcurrencyException"/> class.
25-
/// </summary>
26-
public EntityConcurrencyException()
27-
: this(null)
28-
{
29-
}
23+
/// <summary>
24+
/// Initializes a new instance of the <see cref="EntityConcurrencyException"/> class.
25+
/// </summary>
26+
public EntityConcurrencyException()
27+
: this(null)
28+
{
3029
}
3130
}

src/AppCore.Data.Abstractions/EntityException.cs

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,29 @@
33

44
using System;
55

6-
namespace AppCore.Data
6+
namespace AppCore.Data;
7+
8+
/// <summary>
9+
/// Provides base class for exceptions related to entities.
10+
/// </summary>
11+
public abstract class EntityException : Exception
712
{
813
/// <summary>
9-
/// Provides base class for exceptions related to entities.
14+
/// Initializes a new instance of the <see cref="EntityException"/> class.
1015
/// </summary>
11-
public abstract class EntityException : Exception
16+
/// <param name="message">The exception message.</param>
17+
/// <param name="innerException">The inner exception.</param>
18+
protected EntityException(string message, Exception? innerException)
19+
: base(message, innerException)
1220
{
13-
/// <summary>
14-
/// Initializes a new instance of the <see cref="EntityException"/> class.
15-
/// </summary>
16-
/// <param name="message">The exception message.</param>
17-
/// <param name="innerException">The inner exception.</param>
18-
protected EntityException(string message, Exception innerException)
19-
: base(message, innerException)
20-
{
21-
}
21+
}
2222

23-
/// <summary>
24-
/// Initializes a new instance of the <see cref="EntityException"/> class.
25-
/// </summary>
26-
/// <param name="message">The exception message.</param>
27-
protected EntityException(string message)
28-
: this(message, null)
29-
{
30-
}
23+
/// <summary>
24+
/// Initializes a new instance of the <see cref="EntityException"/> class.
25+
/// </summary>
26+
/// <param name="message">The exception message.</param>
27+
protected EntityException(string message)
28+
: this(message, null)
29+
{
3130
}
3231
}

src/AppCore.Data.Abstractions/EntityExtensions.cs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,22 @@
44
using System.Collections.Generic;
55
using AppCore.Diagnostics;
66

7-
namespace AppCore.Data
7+
namespace AppCore.Data;
8+
9+
/// <summary>
10+
/// Provides extension methods for the <see cref="IEntity{TId}"/> interface.
11+
/// </summary>
12+
public static class EntityExtensions
813
{
914
/// <summary>
10-
/// Provides extension methods for the <see cref="IEntity{TId}"/> interface.
15+
/// Gets a value indicating whether the entity is transient.
1116
/// </summary>
12-
public static class EntityExtensions
17+
/// <typeparam name="TId">The type of the entity id.</typeparam>
18+
/// <param name="entity">The entity.</param>
19+
/// <returns><c>tru</c> if the entity is transient; <c>false</c> otherwise.</returns>
20+
public static bool IsTransient<TId>(this IEntity<TId> entity)
1321
{
14-
/// <summary>
15-
/// Gets a value indicating whether the entity is transient.
16-
/// </summary>
17-
/// <typeparam name="TId">The type of the entity id.</typeparam>
18-
/// <param name="entity">The entity.</param>
19-
/// <returns><c>tru</c> if the entity is transient; <c>false</c> otherwise.</returns>
20-
public static bool IsTransient<TId>(this IEntity<TId> entity)
21-
{
22-
Ensure.Arg.NotNull(entity, nameof(entity));
23-
return EqualityComparer<TId>.Default.Equals(entity.Id, default);
24-
}
22+
Ensure.Arg.NotNull(entity);
23+
return EqualityComparer<TId>.Default.Equals(entity.Id, default!);
2524
}
2625
}

src/AppCore.Data.Abstractions/EntityNotFoundException.cs

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,35 @@
44
using System;
55
using AppCore.Diagnostics;
66

7-
namespace AppCore.Data
7+
namespace AppCore.Data;
8+
9+
/// <summary>
10+
/// Exception which is thrown when a entity was not found.
11+
/// </summary>
12+
public class EntityNotFoundException : EntityException
813
{
914
/// <summary>
10-
/// Exception which is thrown when a entity was not found.
15+
/// Gets the <see cref="Type"/> of the entity which was not found.
1116
/// </summary>
12-
public class EntityNotFoundException : EntityException
13-
{
14-
/// <summary>
15-
/// Gets the <see cref="Type"/> of the entity which was not found.
16-
/// </summary>
17-
public Type EntityType { get; }
17+
public Type EntityType { get; }
1818

19-
/// <summary>
20-
/// Gets the unique id of the entity which was not found.
21-
/// </summary>
22-
public object Id { get; }
19+
/// <summary>
20+
/// Gets the unique id of the entity which was not found.
21+
/// </summary>
22+
public object Id { get; }
2323

24-
/// <summary>
25-
/// Initializes a new instance of the <see cref="EntityNotFoundException"/> class.
26-
/// </summary>
27-
/// <param name="entityType">The <see cref="Type"/> of the entity.</param>
28-
/// <param name="id">The id of the entity.</param>
29-
public EntityNotFoundException(Type entityType, object id)
30-
: base($"Entity '{entityType.GetDisplayName()}' with id '{id}' was not found.")
31-
{
32-
Ensure.Arg.NotNull(entityType, nameof(entityType));
33-
Ensure.Arg.NotNull(id, nameof(id));
24+
/// <summary>
25+
/// Initializes a new instance of the <see cref="EntityNotFoundException"/> class.
26+
/// </summary>
27+
/// <param name="entityType">The <see cref="Type"/> of the entity.</param>
28+
/// <param name="id">The id of the entity.</param>
29+
public EntityNotFoundException(Type entityType, object id)
30+
: base($"Entity '{entityType.GetDisplayName()}' with id '{id}' was not found.")
31+
{
32+
Ensure.Arg.NotNull(entityType);
33+
Ensure.Arg.NotNull(id);
3434

35-
EntityType = entityType;
36-
Id = id;
37-
}
35+
EntityType = entityType;
36+
Id = id;
3837
}
3938
}

0 commit comments

Comments
 (0)