Skip to content

Commit 838492b

Browse files
authored
Merge pull request #14 from rpaschoal/feature/polly-resiliency
Add resiliency and upgrade packages and framework versions
2 parents ed92415 + 1dd08d2 commit 838492b

24 files changed

+1275
-312
lines changed

DynamicRepository.EF/App.config

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<configSections>
44
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
5+
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
56
</configSections>
7+
68
<runtime>
79
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
810
<dependentAssembly>
9-
<assemblyIdentity name="LinqKit" publicKeyToken="bc217f8844052a91" culture="neutral" />
10-
<bindingRedirect oldVersion="0.0.0.0-1.1.16.0" newVersion="1.1.16.0" />
11+
<assemblyIdentity name="LinqKit" publicKeyToken="bc217f8844052a91" culture="neutral"/>
12+
<bindingRedirect oldVersion="0.0.0.0-1.1.16.0" newVersion="1.1.16.0"/>
13+
</dependentAssembly>
14+
<dependentAssembly>
15+
<assemblyIdentity name="LinqKit.Core" publicKeyToken="bc217f8844052a91" culture="neutral"/>
16+
<bindingRedirect oldVersion="0.0.0.0-1.1.17.0" newVersion="1.1.17.0"/>
17+
</dependentAssembly>
18+
<dependentAssembly>
19+
<assemblyIdentity name="System.Linq.Dynamic.Core" publicKeyToken="0f07ec44de6ac832" culture="neutral"/>
20+
<bindingRedirect oldVersion="0.0.0.0-1.0.22.0" newVersion="1.0.22.0"/>
1121
</dependentAssembly>
1222
</assemblyBinding>
1323
</runtime>
14-
</configuration>
24+
<entityFramework>
25+
<providers>
26+
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
27+
</providers>
28+
</entityFramework>
29+
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>

DynamicRepository.EF/DynamicRepository.EF.csproj

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\packages\EntityFramework.6.4.0\build\EntityFramework.props" Condition="Exists('..\packages\EntityFramework.6.4.0\build\EntityFramework.props')" />
34
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
45
<PropertyGroup>
56
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -9,9 +10,12 @@
910
<AppDesignerFolder>Properties</AppDesignerFolder>
1011
<RootNamespace>DynamicRepository.EF</RootNamespace>
1112
<AssemblyName>DynamicRepository.EF</AssemblyName>
12-
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
13+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
1314
<FileAlignment>512</FileAlignment>
1415
<Deterministic>true</Deterministic>
16+
<NuGetPackageImportStamp>
17+
</NuGetPackageImportStamp>
18+
<TargetFrameworkProfile />
1519
</PropertyGroup>
1620
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1721
<DebugSymbols>true</DebugSymbols>
@@ -35,23 +39,22 @@
3539
<HintPath>..\packages\DynamicRepository.1.2.0\lib\netstandard2.0\DynamicRepository.dll</HintPath>
3640
</Reference>
3741
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
38-
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
42+
<HintPath>..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.dll</HintPath>
3943
</Reference>
4044
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
41-
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
45+
<HintPath>..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
4246
</Reference>
43-
<Reference Include="LinqKit, Version=1.1.16.0, Culture=neutral, PublicKeyToken=bc217f8844052a91, processorArchitecture=MSIL">
44-
<HintPath>..\packages\LinqKit.1.1.16\lib\net45\LinqKit.dll</HintPath>
45-
<Private>True</Private>
47+
<Reference Include="LinqKit, Version=1.1.17.0, Culture=neutral, PublicKeyToken=bc217f8844052a91, processorArchitecture=MSIL">
48+
<HintPath>..\packages\LinqKit.1.1.17\lib\net45\LinqKit.dll</HintPath>
4649
</Reference>
47-
<Reference Include="LinqKit.Core, Version=1.1.16.0, Culture=neutral, PublicKeyToken=bc217f8844052a91, processorArchitecture=MSIL">
48-
<HintPath>..\packages\LinqKit.Core.1.1.16\lib\net45\LinqKit.Core.dll</HintPath>
50+
<Reference Include="LinqKit.Core, Version=1.1.17.0, Culture=neutral, PublicKeyToken=bc217f8844052a91, processorArchitecture=MSIL">
51+
<HintPath>..\packages\LinqKit.Core.1.1.17\lib\net45\LinqKit.Core.dll</HintPath>
4952
</Reference>
5053
<Reference Include="System" />
5154
<Reference Include="System.ComponentModel.DataAnnotations" />
5255
<Reference Include="System.Core" />
53-
<Reference Include="System.Linq.Dynamic.Core, Version=1.0.16.0, Culture=neutral, PublicKeyToken=0f07ec44de6ac832, processorArchitecture=MSIL">
54-
<HintPath>..\packages\System.Linq.Dynamic.Core.1.0.16\lib\net46\System.Linq.Dynamic.Core.dll</HintPath>
56+
<Reference Include="System.Linq.Dynamic.Core, Version=1.0.22.0, Culture=neutral, PublicKeyToken=0f07ec44de6ac832, processorArchitecture=MSIL">
57+
<HintPath>..\packages\System.Linq.Dynamic.Core.1.0.22\lib\net46\System.Linq.Dynamic.Core.dll</HintPath>
5558
</Reference>
5659
<Reference Include="System.Xml.Linq" />
5760
<Reference Include="System.Data.DataSetExtensions" />
@@ -69,4 +72,12 @@
6972
<None Include="packages.config" />
7073
</ItemGroup>
7174
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
75+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
76+
<PropertyGroup>
77+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
78+
</PropertyGroup>
79+
<Error Condition="!Exists('..\packages\EntityFramework.6.4.0\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.0\build\EntityFramework.props'))" />
80+
<Error Condition="!Exists('..\packages\EntityFramework.6.4.0\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.0\build\EntityFramework.targets'))" />
81+
</Target>
82+
<Import Project="..\packages\EntityFramework.6.4.0\build\EntityFramework.targets" Condition="Exists('..\packages\EntityFramework.6.4.0\build\EntityFramework.targets')" />
7283
</Project>

DynamicRepository.EF/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.2.0")]
36-
[assembly: AssemblyFileVersion("1.2.0")]
35+
[assembly: AssemblyVersion("1.3.0")]
36+
[assembly: AssemblyFileVersion("1.3.0")]

DynamicRepository.EF/Repository.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public void HasGlobalFilter(Expression<Func<Entity, bool>> filter)
5252
/// Required dependencies are injected.
5353
/// </summary>
5454
/// <param name="context">Current EF context.</param>
55-
/// <param name="account">Current request account identification.</param>
5655
public Repository(DbContext context)
5756
{
5857
Context = context;

DynamicRepository.EF/packages.config

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="DynamicRepository" version="1.2.0" targetFramework="net472" />
4-
<package id="EntityFramework" version="6.2.0" targetFramework="net472" />
5-
<package id="LinqKit" version="1.1.16" targetFramework="net472" />
6-
<package id="LinqKit.Core" version="1.1.16" targetFramework="net472" />
7-
<package id="System.Linq.Dynamic.Core" version="1.0.16" targetFramework="net472" />
3+
<package id="DynamicRepository" version="1.2.0" targetFramework="net48" />
4+
<package id="EntityFramework" version="6.4.0" targetFramework="net472" />
5+
<package id="LinqKit" version="1.1.17" targetFramework="net472" />
6+
<package id="LinqKit.Core" version="1.1.17" targetFramework="net472" />
7+
<package id="System.Linq.Dynamic.Core" version="1.0.22" targetFramework="net472" />
88
</packages>
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
5-
<Version>1.2.0</Version>
4+
<TargetFramework>netstandard2.1</TargetFramework>
5+
<Version>1.3.0</Version>
66
<Authors>Rafael Carvalho</Authors>
77
<PackageProjectUrl>https://github.com/rpaschoal/DynamicRepository</PackageProjectUrl>
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="DynamicRepository" Version="1.2.0" />
12-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.4" />
13-
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.0.17" />
11+
<PackageReference Include="DynamicRepository" Version="1.3.0" />
12+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.3" />
13+
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.0.22" />
1414
</ItemGroup>
1515

1616
</Project>

DynamicRepository.EFCore/Repository.cs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using DynamicRepository.Filter;
1010
using DynamicRepository.Extensions;
1111
using System.Threading.Tasks;
12+
using System.Threading;
1213

1314
namespace DynamicRepository.EFCore
1415
{
@@ -24,7 +25,7 @@ namespace DynamicRepository.EFCore
2425
/// <summary>
2526
/// Current EF DBContext instance.
2627
/// </summary>
27-
protected virtual DbContext Context { get; set; }
28+
protected DbContext Context { get; set; }
2829

2930
/// <summary>
3031
/// DBSet of <see cref="Entity"/> extracted from <see cref="Context"/>.
@@ -36,21 +37,11 @@ namespace DynamicRepository.EFCore
3637
/// </summary>
3738
private Expression<Func<Entity, bool>> GlobalFilter { get; set; }
3839

39-
/// <summary>
40-
/// Adds a global filter expression to all operations which query for data.
41-
/// </summary>
42-
/// <remarks>This method was inspired by "HasQueryFilter" found on EF Core.</remarks>
43-
public void HasGlobalFilter(Expression<Func<Entity, bool>> filter)
44-
{
45-
GlobalFilter = filter;
46-
}
47-
4840
/// <summary>
4941
/// Default constructor of main repository.
5042
/// Required dependencies are injected.
5143
/// </summary>
5244
/// <param name="context">Current EF context.</param>
53-
/// <param name="account">Current request account identification.</param>
5445
public Repository(DbContext context)
5546
{
5647
Context = context;
@@ -61,6 +52,15 @@ public Repository(DbContext context)
6152
_dataSourcePager = new DataPager<Key, Entity>();
6253
}
6354

55+
/// <summary>
56+
/// Adds a global filter expression to all operations which query for data.
57+
/// </summary>
58+
/// <remarks>This method was inspired by "HasQueryFilter" found on EF Core.</remarks>
59+
public void HasGlobalFilter(Expression<Func<Entity, bool>> filter)
60+
{
61+
GlobalFilter = filter;
62+
}
63+
6464
/// <summary>
6565
/// Gets an entity instance based on its <see cref="Key"/>.
6666
/// </summary>
@@ -120,7 +120,8 @@ public virtual void Insert(Entity entity)
120120
/// <param name="entity">The new <see cref="Entity"/> instance to be persisted.</param>
121121
public virtual Task InsertAsync(Entity entity)
122122
{
123-
return DbSet.AddAsync(entity);
123+
// TODO: Cancellation tokens will be implement soon with another PR
124+
return DbSet.AddAsync(entity, CancellationToken.None).AsTask();
124125
}
125126

126127
/// <summary>
@@ -154,9 +155,9 @@ public virtual void Delete(Key id)
154155
/// Deletes an existing entity.
155156
/// </summary>
156157
/// <param name="id">The primary key of the <see cref="Entity"/> to be deleted.</param>
157-
public virtual Task DeleteAsync(Key id)
158+
public virtual async Task DeleteAsync(Key id)
158159
{
159-
return Task.Run(async () => DeleteAsync(await GetAsync(id)));
160+
await DeleteAsync(await GetAsync(id));
160161
}
161162

162163
/// <summary>

DynamicRepository.MongoDB/DataPagerMongoDB.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace DynamicRepository.MongoDB
1919
/// <typeparam name="Entity">
2020
/// The Entity type mapped by the desired collection.
2121
/// </typeparam>
22-
public class DataPagerMongoDB<Key, Entity> : DataPager<Key, Entity> where Entity : class, new()
22+
internal class DataPagerMongoDB<Key, Entity> : DataPager<Key, Entity> where Entity : class, new()
2323
{
2424
/// <summary>
2525
/// Filters paged data based on <see cref="PagedDataSourceSettings"/>.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
5-
<Version>1.2.0</Version>
4+
<TargetFramework>netstandard2.1</TargetFramework>
5+
<Version>1.3.0</Version>
66
<Authors>Rafael Carvalho</Authors>
77
<Description></Description>
88
<PackageProjectUrl>https://github.com/rpaschoal/DynamicRepository</PackageProjectUrl>
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="DynamicRepository" Version="1.2.0" />
13-
<PackageReference Include="MongoDB.Driver" Version="2.8.1" />
14-
<PackageReference Include="MongoDB.Driver.Core" Version="2.8.1" />
12+
<PackageReference Include="DynamicRepository" Version="1.3.0" />
13+
<PackageReference Include="MongoDB.Driver" Version="2.10.2" />
14+
<PackageReference Include="MongoDB.Driver.Core" Version="2.10.2" />
1515
</ItemGroup>
1616

1717
</Project>

0 commit comments

Comments
 (0)