Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c48653dc6 | |||
| b083988509 | |||
| 7bd356c7da | |||
| f59cccb3d9 | |||
| 710b7b992f |
@@ -7,7 +7,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.1.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="2.1.2" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.15.0" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.25.0" />
|
||||
<PackageReference Include="xunit" Version="2.5.0" />
|
||||
<PackageReference Include="xunit.runner.console" Version="2.5.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
@@ -30,4 +30,4 @@
|
||||
<ProjectReference Include="..\MongoDbGenericRepository\MongoDbGenericRepository.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -531,8 +531,8 @@ public class UpdateManyAsyncTests : GenericTestContext<MongoDbUpdater>
|
||||
private Mock<IMongoCollection<TestDocument>> SetupCollection(long count, string partitionKey = null)
|
||||
{
|
||||
var replacedId = Fixture.Create<Guid>();
|
||||
var replaceResult = new ReplaceOneResult.Acknowledged(count, count, BsonValue.Create(replacedId));
|
||||
var updateResult = new UpdateResult.Acknowledged(count, count, BsonValue.Create(replacedId));
|
||||
var replaceResult = new ReplaceOneResult.Acknowledged(count, count, new BsonBinaryData(replacedId, GuidRepresentation.Standard));
|
||||
var updateResult = new UpdateResult.Acknowledged(count, count, new BsonBinaryData(replacedId, GuidRepresentation.Standard));
|
||||
|
||||
var collection = MockOf<IMongoCollection<TestDocument>>();
|
||||
collection
|
||||
|
||||
@@ -530,8 +530,8 @@ public class UpdateManyTests : GenericTestContext<MongoDbUpdater>
|
||||
private Mock<IMongoCollection<TestDocument>> SetupCollection(long count, string partitionKey = null)
|
||||
{
|
||||
var replacedId = Fixture.Create<Guid>();
|
||||
var replaceResult = new ReplaceOneResult.Acknowledged(count, count, BsonValue.Create(replacedId));
|
||||
var updateResult = new UpdateResult.Acknowledged(count, count, BsonValue.Create(replacedId));
|
||||
var replaceResult = new ReplaceOneResult.Acknowledged(count, count, new BsonBinaryData(replacedId, GuidRepresentation.Standard));
|
||||
var updateResult = new UpdateResult.Acknowledged(count, count, new BsonBinaryData(replacedId, GuidRepresentation.Standard));
|
||||
|
||||
var collection = MockOf<IMongoCollection<TestDocument>>();
|
||||
collection
|
||||
|
||||
@@ -755,8 +755,8 @@ public class UpdateOneAsyncTests : GenericTestContext<MongoDbUpdater>
|
||||
{
|
||||
var replacedId = Fixture.Create<Guid>();
|
||||
var count = Fixture.Create<long>();
|
||||
var replaceResult = new ReplaceOneResult.Acknowledged(count, 1, BsonValue.Create(replacedId));
|
||||
var updateResult = new UpdateResult.Acknowledged(count, 1, BsonValue.Create(replacedId));
|
||||
var replaceResult = new ReplaceOneResult.Acknowledged(count, 1, new BsonBinaryData(replacedId, GuidRepresentation.Standard));
|
||||
var updateResult = new UpdateResult.Acknowledged(count, 1, new BsonBinaryData(replacedId, GuidRepresentation.Standard));
|
||||
|
||||
var collection = MockOf<IMongoCollection<TestDocument>>();
|
||||
collection
|
||||
|
||||
@@ -754,8 +754,8 @@ public class UpdateOneTests : GenericTestContext<MongoDbUpdater>
|
||||
{
|
||||
var replacedId = Fixture.Create<Guid>();
|
||||
var count = Fixture.Create<long>();
|
||||
var replaceResult = new ReplaceOneResult.Acknowledged(count, 1, BsonValue.Create(replacedId));
|
||||
var updateResult = new UpdateResult.Acknowledged(count, 1, BsonValue.Create(replacedId));
|
||||
var replaceResult = new ReplaceOneResult.Acknowledged(count, 1, new BsonBinaryData(replacedId, GuidRepresentation.Standard));
|
||||
var updateResult = new UpdateResult.Acknowledged(count, 1, new BsonBinaryData(replacedId, GuidRepresentation.Standard));
|
||||
|
||||
var collection = MockOf<IMongoCollection<TestDocument>>();
|
||||
collection
|
||||
|
||||
@@ -11,7 +11,51 @@
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.1.3" newVersion="4.1.1.3" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Win32.Registry" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="MongoDB.Bson" publicKeyToken="null" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.20.0.0" newVersion="2.20.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="MongoDB.Driver.Core" publicKeyToken="null" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.20.0.0" newVersion="2.20.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="MongoDB.Libmongocrypt" publicKeyToken="null" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.9.0.0" newVersion="1.9.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="mscorlib" publicKeyToken="b77a5c561934e089" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Security.AccessControl" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Security.Principal.Windows" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="ZstdSharp" publicKeyToken="8d151af33a4ad5cf" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-0.7.3.0" newVersion="0.7.3.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -23,20 +23,5 @@ namespace IntegrationTests.Infrastructure
|
||||
{
|
||||
MongoDbContext.DropCollection<TDocument>(partitionKey);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the max of a property in a mongodb collections that is satisfying the filter.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The document type.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key.</typeparam>
|
||||
/// <returns></returns>
|
||||
public async Task<TDocument> GetByMaxAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : System.IEquatable<TKey>
|
||||
{
|
||||
return await GetCollection<TDocument, TKey>().Find(Builders<TDocument>.Filter.Where(filter))
|
||||
.SortByDescending(orderByDescending)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,32 +34,48 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="AWSSDK.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AWSSDK.Core.3.7.100.14\lib\net45\AWSSDK.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="AWSSDK.SecurityToken, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AWSSDK.SecurityToken.3.7.100.14\lib\net45\AWSSDK.SecurityToken.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Crc32C.NET, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Crc32C.NET.1.0.5.0\lib\net20\Crc32C.NET.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DnsClient, Version=1.4.0.0, Culture=neutral, PublicKeyToken=4574bb5573c51424, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DnsClient.1.4.0\lib\net45\DnsClient.dll</HintPath>
|
||||
<Reference Include="DnsClient, Version=1.6.1.0, Culture=neutral, PublicKeyToken=4574bb5573c51424, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DnsClient.1.6.1\lib\net471\DnsClient.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MongoDB.Bson, Version=2.13.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MongoDB.Bson.2.13.2\lib\net452\MongoDB.Bson.dll</HintPath>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MongoDB.Driver, Version=2.13.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MongoDB.Driver.2.13.2\lib\net452\MongoDB.Driver.dll</HintPath>
|
||||
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.2.0.0\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MongoDB.Driver.Core, Version=2.13.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MongoDB.Driver.Core.2.13.2\lib\net452\MongoDB.Driver.Core.dll</HintPath>
|
||||
<Reference Include="Microsoft.Win32.Registry, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Win32.Registry.5.0.0\lib\net461\Microsoft.Win32.Registry.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MongoDB.Libmongocrypt, Version=1.2.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MongoDB.Libmongocrypt.1.2.2\lib\net452\MongoDB.Libmongocrypt.dll</HintPath>
|
||||
<Reference Include="MongoDB.Bson, Version=2.20.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MongoDB.Bson.2.20.0\lib\net472\MongoDB.Bson.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MongoDbGenericRepository, Version=1.4.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MongoDbGenericRepository.1.4.8\lib\net452\MongoDbGenericRepository.dll</HintPath>
|
||||
<Reference Include="MongoDB.Driver, Version=2.18.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MongoDB.Driver.2.18.0\lib\net472\MongoDB.Driver.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MongoDB.Driver.Core, Version=2.20.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MongoDB.Driver.Core.2.20.0\lib\net472\MongoDB.Driver.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MongoDB.Libmongocrypt, Version=1.9.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MongoDB.Libmongocrypt.1.9.0\lib\netstandard2.0\MongoDB.Libmongocrypt.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="nunit.framework, Version=3.13.2.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnit.3.13.2\lib\net45\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SharpCompress, Version=0.23.0.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpCompress.0.23.0\lib\net45\SharpCompress.dll</HintPath>
|
||||
<Reference Include="SharpCompress, Version=0.30.1.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpCompress.0.30.1\lib\net461\SharpCompress.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Snappier, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a1b25124e6e13a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Snappier.1.0.0\lib\netstandard2.0\Snappier.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Snappy.NET, Version=1.1.1.8, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Snappy.NET.1.1.1.8\lib\net45\Snappy.NET.dll</HintPath>
|
||||
@@ -68,18 +84,39 @@
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.IO, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.4.3.0\lib\net462\System.IO.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.AccessControl, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.AccessControl.5.0.0\lib\net461\System.Security.AccessControl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -92,9 +129,21 @@
|
||||
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Principal.Windows, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Principal.Windows.5.0.0\lib\net461\System.Security.Principal.Windows.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Encoding.CodePages, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encoding.CodePages.5.0.0\lib\net461\System.Text.Encoding.CodePages.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ZstdSharp, Version=0.7.3.0, Culture=neutral, PublicKeyToken=8d151af33a4ad5cf, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ZstdSharp.Port.0.7.3\lib\net461\ZstdSharp.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CRUDObjectIdTests.cs" />
|
||||
@@ -118,17 +167,23 @@
|
||||
<None Include="App.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="libmongocrypt.dylib" />
|
||||
<None Include="libmongocrypt.so" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Core\Compression\Snappy\lib\win\snappy32.dll" />
|
||||
<Content Include="Core\Compression\Snappy\lib\win\snappy64.dll" />
|
||||
<Content Include="Core\Compression\Zstandard\lib\win\libzstd.dll" />
|
||||
<ProjectReference Include="..\MongoDbGenericRepository\MongoDbGenericRepository.csproj">
|
||||
<Project>{efc776c4-2af3-440c-be80-3fbe335817a5}</Project>
|
||||
<Name>MongoDbGenericRepository</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Analyzer Include="..\packages\AWSSDK.SecurityToken.3.7.100.14\analyzers\dotnet\cs\AWSSDK.SecurityToken.CodeAnalysis.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="libmongocrypt.dylib" />
|
||||
<Content Include="libmongocrypt.so" />
|
||||
<Content Include="mongocrypt.dll" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
@@ -136,11 +191,9 @@
|
||||
<PropertyGroup>
|
||||
<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>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\MongoDB.Libmongocrypt.1.2.2\build\MongoDB.Libmongocrypt.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MongoDB.Libmongocrypt.1.2.2\build\MongoDB.Libmongocrypt.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\NUnit.3.13.2\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.2\build\NUnit.props'))" />
|
||||
<Error Condition="!Exists('..\packages\NUnit3TestAdapter.4.0.0\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit3TestAdapter.4.0.0\build\net35\NUnit3TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\packages\MongoDB.Driver.Core.2.13.2\build\MongoDB.Driver.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MongoDB.Driver.Core.2.13.2\build\MongoDB.Driver.Core.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\MongoDB.Libmongocrypt.1.9.0\build\MongoDB.Libmongocrypt.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MongoDB.Libmongocrypt.1.9.0\build\MongoDB.Libmongocrypt.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\MongoDB.Libmongocrypt.1.2.2\build\MongoDB.Libmongocrypt.targets" Condition="Exists('..\packages\MongoDB.Libmongocrypt.1.2.2\build\MongoDB.Libmongocrypt.targets')" />
|
||||
<Import Project="..\packages\MongoDB.Driver.Core.2.13.2\build\MongoDB.Driver.Core.targets" Condition="Exists('..\packages\MongoDB.Driver.Core.2.13.2\build\MongoDB.Driver.Core.targets')" />
|
||||
<Import Project="..\packages\MongoDB.Libmongocrypt.1.9.0\build\MongoDB.Libmongocrypt.targets" Condition="Exists('..\packages\MongoDB.Libmongocrypt.1.9.0\build\MongoDB.Libmongocrypt.targets')" />
|
||||
</Project>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,24 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MongoDB.Driver.Core" version="2.25.0" targetFramework="net48" />
|
||||
<package id="MongoDB.Libmongocrypt" version="1.9.0" targetFramework="net48" />
|
||||
<package id="AWSSDK.Core" version="3.7.100.14" targetFramework="net48" />
|
||||
<package id="AWSSDK.SecurityToken" version="3.7.100.14" targetFramework="net48" />
|
||||
<package id="Crc32C.NET" version="1.0.5.0" targetFramework="net461" />
|
||||
<package id="DnsClient" version="1.4.0" targetFramework="net461" />
|
||||
<package id="MongoDB.Bson" version="2.13.2" targetFramework="net461" />
|
||||
<package id="MongoDB.Driver" version="2.13.2" targetFramework="net461" />
|
||||
<package id="MongoDB.Driver.Core" version="2.13.2" targetFramework="net461" />
|
||||
<package id="MongoDB.Libmongocrypt" version="1.2.2" targetFramework="net461" />
|
||||
<package id="MongoDbGenericRepository" version="1.4.8" targetFramework="net461" />
|
||||
<package id="DnsClient" version="1.6.1" targetFramework="net48" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net48" />
|
||||
<package id="Microsoft.Extensions.Logging.Abstractions" version="2.0.0" targetFramework="net48" />
|
||||
<package id="Microsoft.Win32.Registry" version="5.0.0" targetFramework="net48" />
|
||||
<package id="MongoDB.Bson" version="2.25.0" targetFramework="net48" />
|
||||
<package id="MongoDB.Driver" version="2.25.0" targetFramework="net48" />
|
||||
<package id="NUnit" version="3.13.2" targetFramework="net461" />
|
||||
<package id="NUnit.ConsoleRunner" version="3.12.0" targetFramework="net461" />
|
||||
<package id="NUnit3TestAdapter" version="4.0.0" targetFramework="net461" />
|
||||
<package id="SharpCompress" version="0.23.0" targetFramework="net461" />
|
||||
<package id="SharpCompress" version="0.30.1" targetFramework="net48" />
|
||||
<package id="Snappier" version="1.0.0" targetFramework="net48" />
|
||||
<package id="Snappy.NET" version="1.1.1.8" targetFramework="net461" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net461" />
|
||||
<package id="System.IO" version="4.3.0" targetFramework="net48" />
|
||||
<package id="System.Memory" version="4.5.5" targetFramework="net48" />
|
||||
<package id="System.Net.Http" version="4.3.4" targetFramework="net461" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
|
||||
<package id="System.Runtime" version="4.3.0" targetFramework="net48" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net461" />
|
||||
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.AccessControl" version="5.0.0" targetFramework="net48" />
|
||||
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.Principal.Windows" version="5.0.0" targetFramework="net48" />
|
||||
<package id="System.Text.Encoding.CodePages" version="5.0.0" targetFramework="net48" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net48" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
|
||||
<package id="ZstdSharp.Port" version="0.7.3" targetFramework="net48" />
|
||||
</packages>
|
||||
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using MongoDB.Bson.Serialization;
|
||||
|
||||
namespace MongoDbGenericRepository.Internals
|
||||
{
|
||||
/// <summary>
|
||||
/// An <see cref="IBsonSerializationProvider"/> that can handle multiple serializer registration calls.
|
||||
/// </summary>
|
||||
internal class RepositorySerializationProvider : IBsonSerializationProvider
|
||||
{
|
||||
private static volatile RepositorySerializationProvider _instance;
|
||||
private static readonly object LockObject = new object();
|
||||
|
||||
private readonly ConcurrentDictionary<Type, IBsonSerializer> _cache;
|
||||
|
||||
private RepositorySerializationProvider()
|
||||
{
|
||||
_cache = new ConcurrentDictionary<Type, IBsonSerializer>();
|
||||
}
|
||||
|
||||
public static RepositorySerializationProvider Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
lock (LockObject)
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = new RepositorySerializationProvider();
|
||||
BsonSerializer.RegisterSerializationProvider(_instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IBsonSerializer GetSerializer(Type type)
|
||||
{
|
||||
if (type == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(type));
|
||||
}
|
||||
|
||||
return _cache.TryGetValue(type, out var serializer) ? serializer : null;
|
||||
}
|
||||
|
||||
internal void RegisterSerializer<T>(IBsonSerializer<T> serializer) =>
|
||||
RegisterSerializer(typeof(T), serializer);
|
||||
|
||||
internal void RegisterSerializer(Type type, IBsonSerializer serializer) =>
|
||||
_cache.TryAdd(type, serializer);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,9 @@ using MongoDbGenericRepository.Attributes;
|
||||
using MongoDbGenericRepository.Utils;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Serializers;
|
||||
using MongoDbGenericRepository.Internals;
|
||||
|
||||
namespace MongoDbGenericRepository
|
||||
{
|
||||
@@ -21,7 +24,6 @@ namespace MongoDbGenericRepository
|
||||
/// </summary>
|
||||
public IMongoDatabase Database { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The constructor of the MongoDbContext, it needs an object implementing <see cref="IMongoDatabase"/>.
|
||||
/// </summary>
|
||||
@@ -90,9 +92,14 @@ namespace MongoDbGenericRepository
|
||||
/// Sets the Guid representation of the MongoDB Driver.
|
||||
/// </summary>
|
||||
/// <param name="guidRepresentation">The new value of the GuidRepresentation</param>
|
||||
public virtual void SetGuidRepresentation(MongoDB.Bson.GuidRepresentation guidRepresentation)
|
||||
public virtual void SetGuidRepresentation(GuidRepresentation guidRepresentation)
|
||||
{
|
||||
MongoDefaults.GuidRepresentation = guidRepresentation;
|
||||
// GuidRepresentation and GuidRepresentationMode will be removed in the next major release of the MongoDB Driver.
|
||||
// We can safely replace this with RepositorySerializationProvider.Instance.RegisterSerializer once we upgrade to the next major release.
|
||||
#pragma warning disable CS0618
|
||||
BsonDefaults.GuidRepresentationMode = GuidRepresentationMode.V3;
|
||||
RepositorySerializationProvider.Instance.RegisterSerializer(new GuidSerializer(guidRepresentation));
|
||||
#pragma warning restore CS0618
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -103,8 +110,8 @@ namespace MongoDbGenericRepository
|
||||
protected virtual string GetAttributeCollectionName<TDocument>()
|
||||
{
|
||||
return (typeof(TDocument).GetTypeInfo()
|
||||
.GetCustomAttributes(typeof(CollectionNameAttribute))
|
||||
.FirstOrDefault() as CollectionNameAttribute)?.Name;
|
||||
.GetCustomAttributes(typeof(CollectionNameAttribute))
|
||||
.FirstOrDefault() as CollectionNameAttribute)?.Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -114,7 +121,7 @@ namespace MongoDbGenericRepository
|
||||
protected virtual void InitializeGuidRepresentation()
|
||||
{
|
||||
// by default, avoid legacy UUID representation: use Binary 0x04 subtype.
|
||||
MongoDefaults.GuidRepresentation = MongoDB.Bson.GuidRepresentation.Standard;
|
||||
SetGuidRepresentation(GuidRepresentation.Standard);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -143,4 +150,4 @@ namespace MongoDbGenericRepository
|
||||
return (typeof(TDocument).Name.Pluralize()).Camelize();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFrameworks>net472;netstandard2.0;</TargetFrameworks>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PackageId>MongoDbGenericRepository</PackageId>
|
||||
<PackageVersion>1.4.8</PackageVersion>
|
||||
<PackageVersion>1.6.0</PackageVersion>
|
||||
<Authors>Alexandre Spieser</Authors>
|
||||
<PackageTitle>MongoDb Generic Repository</PackageTitle>
|
||||
<Description>A generic repository implementation using the MongoDB C# Sharp 2.0 driver.</Description>
|
||||
@@ -12,10 +12,10 @@
|
||||
<PackageProjectUrl>http://www.opensource.org/licenses/mit-license.php</PackageProjectUrl>
|
||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||
<PackageReleaseNotes>Release notes are at https://github.com/alexandre-spieser/mongodb-generic-repository/releases </PackageReleaseNotes>
|
||||
<Copyright>Copyright 2021 (c) Alexandre Spieser. All rights reserved.</Copyright>
|
||||
<Copyright>Copyright 2023 (c) Alexandre Spieser. All rights reserved.</Copyright>
|
||||
<PackageTags>MongoDb Repository Generic NoSql</PackageTags>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<Version>1.4.8</Version>
|
||||
<Version>1.6.0</Version>
|
||||
<RepositoryUrl>https://github.com/alexandre-spieser/mongodb-generic-repository</RepositoryUrl>
|
||||
<RepositoryType>Git</RepositoryType>
|
||||
</PropertyGroup>
|
||||
@@ -25,7 +25,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.15.0" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.25.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user