Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9cb35c5881 | |||
| c5390214eb | |||
| ac1fd709a6 | |||
| f6b0aa274b | |||
| 7a82a281fb | |||
| dca01b184c | |||
| b1cda2ac50 | |||
| 8d6b796e7f | |||
| 1a7763a312 | |||
| 77cc85574c | |||
| 846bb16730 | |||
| 5e4cbfa1b3 | |||
| 804dc18c4f | |||
| 182ee0a335 | |||
| bd662d25d6 | |||
| 6c8d4bdafb | |||
| 4d94a1b436 | |||
| d91a644b4a | |||
| 9d1950e9c7 | |||
| 67d0a4c8a3 | |||
| 1826668cea |
@@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
@@ -7,11 +7,13 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.1.2" />
|
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.1.2" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="2.1.2" />
|
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="2.1.2" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
|
<PackageReference Include="MongoDB.Driver" Version="2.9.3" />
|
||||||
<PackageReference Include="MongoDB.Driver" Version="2.7.0" />
|
<PackageReference Include="MongoDbGenericRepository" Version="1.4.3" />
|
||||||
<PackageReference Include="MongoDbGenericRepository" Version="1.3.9" />
|
<PackageReference Include="xunit" Version="2.4.1" />
|
||||||
<PackageReference Include="xunit" Version="2.4.0" />
|
<PackageReference Include="xunit.runner.console" Version="2.4.1">
|
||||||
<PackageReference Include="xunit.runner.console" Version="2.4.0" />
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
||||||
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta4-build3742" />
|
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta4-build3742" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -13,10 +13,6 @@
|
|||||||
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
|
||||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
|
||||||
</dependentAssembly>
|
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="..\packages\NUnit3TestAdapter.3.15.1\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.3.15.1\build\net35\NUnit3TestAdapter.props')" />
|
||||||
|
<Import Project="..\packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -11,6 +13,8 @@
|
|||||||
<AssemblyName>IntegrationTests</AssemblyName>
|
<AssemblyName>IntegrationTests</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
@@ -30,20 +34,32 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<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.2.0.0, Culture=neutral, PublicKeyToken=4574bb5573c51424, processorArchitecture=MSIL">
|
<Reference Include="DnsClient, Version=1.2.0.0, Culture=neutral, PublicKeyToken=4574bb5573c51424, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\DnsClient.1.2.0\lib\net45\DnsClient.dll</HintPath>
|
<HintPath>..\packages\DnsClient.1.2.0\lib\net45\DnsClient.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MongoDB.Bson, Version=2.8.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="MongoDB.Bson, Version=2.9.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\MongoDB.Bson.2.8.0\lib\net452\MongoDB.Bson.dll</HintPath>
|
<HintPath>..\packages\MongoDB.Bson.2.9.3\lib\net452\MongoDB.Bson.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MongoDB.Driver, Version=2.8.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="MongoDB.Driver, Version=2.9.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\MongoDB.Driver.2.8.0\lib\net452\MongoDB.Driver.dll</HintPath>
|
<HintPath>..\packages\MongoDB.Driver.2.9.3\lib\net452\MongoDB.Driver.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MongoDB.Driver.Core, Version=2.8.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="MongoDB.Driver.Core, Version=2.9.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\MongoDB.Driver.Core.2.8.0\lib\net452\MongoDB.Driver.Core.dll</HintPath>
|
<HintPath>..\packages\MongoDB.Driver.Core.2.9.3\lib\net452\MongoDB.Driver.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="nunit.framework, Version=3.9.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
<Reference Include="MongoDbGenericRepository, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\NUnit.3.9.0\lib\net45\nunit.framework.dll</HintPath>
|
<HintPath>..\packages\MongoDbGenericRepository.1.4.3\lib\net452\MongoDbGenericRepository.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\NUnit.3.12.0\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>
|
||||||
|
<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>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
@@ -85,11 +101,11 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\MongoDbGenericRepository\MongoDbGenericRepository.csproj">
|
|
||||||
<Project>{efc776c4-2af3-440c-be80-3fbe335817a5}</Project>
|
|
||||||
<Name>MongoDbGenericRepository</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
<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\NUnit3TestAdapter.3.15.1\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit3TestAdapter.3.15.1\build\net35\NUnit3TestAdapter.props'))" />
|
||||||
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1,11 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
|
<package id="Crc32C.NET" version="1.0.5.0" targetFramework="net461" />
|
||||||
<package id="DnsClient" version="1.2.0" targetFramework="net461" />
|
<package id="DnsClient" version="1.2.0" targetFramework="net461" />
|
||||||
<package id="MongoDB.Bson" version="2.8.0" targetFramework="net461" />
|
<package id="MongoDB.Bson" version="2.9.3" targetFramework="net461" />
|
||||||
<package id="MongoDB.Driver" version="2.8.0" targetFramework="net461" />
|
<package id="MongoDB.Driver" version="2.9.3" targetFramework="net461" />
|
||||||
<package id="MongoDB.Driver.Core" version="2.8.0" targetFramework="net461" />
|
<package id="MongoDB.Driver.Core" version="2.9.3" targetFramework="net461" />
|
||||||
<package id="NUnit" version="3.9.0" targetFramework="net461" />
|
<package id="MongoDbGenericRepository" version="1.4.3" targetFramework="net461" />
|
||||||
<package id="NUnit.ConsoleRunner" version="3.7.0" targetFramework="net461" />
|
<package id="NUnit" version="3.12.0" targetFramework="net461" />
|
||||||
|
<package id="NUnit.ConsoleRunner" version="3.10.0" targetFramework="net461" />
|
||||||
|
<package id="NUnit3TestAdapter" version="3.15.1" targetFramework="net461" />
|
||||||
|
<package id="SharpCompress" version="0.23.0" targetFramework="net461" />
|
||||||
|
<package id="Snappy.NET" version="1.1.1.8" targetFramework="net461" />
|
||||||
<package id="System.Buffers" version="4.4.0" targetFramework="net461" />
|
<package id="System.Buffers" version="4.4.0" targetFramework="net461" />
|
||||||
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" />
|
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
using MongoDB.Driver;
|
||||||
|
using MongoDbGenericRepository.Models;
|
||||||
|
using System;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MongoDbGenericRepository
|
||||||
|
{
|
||||||
|
public interface IBaseMongoRepository_Update : IBaseMongoRepository_Update<Guid>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Asynchronously Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <param name="modifiedDocument">The document with the modifications you want to persist.</param>
|
||||||
|
Task<bool> UpdateOneAsync<TDocument, TKey>(TDocument modifiedDocument)
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <param name="modifiedDocument">The document with the modifications you want to persist.</param>
|
||||||
|
bool UpdateOne<TDocument, TKey>(TDocument modifiedDocument)
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Takes a document you want to modify and applies the update you have defined in MongoDb.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <param name="documentToModify">The document you want to modify.</param>
|
||||||
|
/// <param name="update">The update definition for the document.</param>
|
||||||
|
Task<bool> UpdateOneAsync<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update)
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Takes a document you want to modify and applies the update you have defined in MongoDb.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <param name="documentToModify">The document you want to modify.</param>
|
||||||
|
/// <param name="update">The update definition for the document.</param>
|
||||||
|
bool UpdateOne<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update)
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For the entity selected by the filter, updates the property field with the given value..
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field.</typeparam>
|
||||||
|
/// <param name="filter">The document filter.</param>
|
||||||
|
/// <param name="field">The field selector.</param>
|
||||||
|
/// <param name="value">The new value of the property field.</param>
|
||||||
|
/// <param name="partitionKey">The partition key for the document.</param>
|
||||||
|
bool UpdateOne<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the property field with the given value update a property field in entities.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field.</typeparam>
|
||||||
|
/// <param name="documentToModify">The document you want to modify.</param>
|
||||||
|
/// <param name="field">The field selector.</param>
|
||||||
|
/// <param name="value">The new value of the property field.</param>
|
||||||
|
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value)
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// For the entity selected by the filter, updates the property field with the given value.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field.</typeparam>
|
||||||
|
/// <param name="filter">The document filter.</param>
|
||||||
|
/// <param name="field">The field selector.</param>
|
||||||
|
/// <param name="value">The new value of the property field.</param>
|
||||||
|
/// <param name="partitionKey">The partition key for the document.</param>
|
||||||
|
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the property field with the given value update a property field in entities.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field.</typeparam>
|
||||||
|
/// <param name="documentToModify">The document you want to modify.</param>
|
||||||
|
/// <param name="field">The field selector.</param>
|
||||||
|
/// <param name="value">The new value of the property field.</param>
|
||||||
|
bool UpdateOne<TDocument, TKey, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value)
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the property field with the given value update a property field in entities.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field.</typeparam>
|
||||||
|
/// <param name="filter">The document filter.</param>
|
||||||
|
/// <param name="field">The field selector.</param>
|
||||||
|
/// <param name="value">The new value of the property field.</param>
|
||||||
|
/// <param name="partitionKey">The value of the partition key.</param>
|
||||||
|
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the property field with the given value update a property field in entities.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field.</typeparam>
|
||||||
|
/// <param name="filter">The document filter.</param>
|
||||||
|
/// <param name="field">The field selector.</param>
|
||||||
|
/// <param name="value">The new value of the property field.</param>
|
||||||
|
/// <param name="partitionKey">The value of the partition key.</param>
|
||||||
|
bool UpdateOne<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using MongoDB.Driver;
|
||||||
|
using MongoDbGenericRepository.Models;
|
||||||
|
|
||||||
|
namespace MongoDbGenericRepository.DataAccess.Update
|
||||||
|
{
|
||||||
|
public interface IBaseMongoRepository_Update_ClientSession
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="modifiedDocument">The document with the modifications you want to persist.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="modifiedDocument">The document with the modifications you want to persist.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="documentToModify">The document to modify.</param>
|
||||||
|
/// <param name="update">The update definition.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="documentToModify">The document to modify.</param>
|
||||||
|
/// <param name="update">The update definition.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument modifiedDocument, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field to update.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="documentToModify">The document to modify.</param>
|
||||||
|
/// <param name="field">The field to update.</param>
|
||||||
|
/// <param name="value">The value of the field.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field to update.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="documentToModify">The document to modify.</param>
|
||||||
|
/// <param name="field">The field to update.</param>
|
||||||
|
/// <param name="value">The value of the field.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field to update.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="filter">The filter for the update.</param>
|
||||||
|
/// <param name="field">The field to update.</param>
|
||||||
|
/// <param name="value">The value of the field.</param>
|
||||||
|
/// <param name="partitionKey">The optional partition key.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field to update.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="filter">The filter for the update.</param>
|
||||||
|
/// <param name="field">The field to update.</param>
|
||||||
|
/// <param name="value">The value of the field.</param>
|
||||||
|
/// <param name="partitionKey">The optional partition key.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field to update.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="filter">The filter for the update.</param>
|
||||||
|
/// <param name="field">The field to update.</param>
|
||||||
|
/// <param name="value">The value of the field.</param>
|
||||||
|
/// <param name="partitionKey">The optional partition key.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> UpdateOneAsync<TDocument, TKey>(IClientSessionHandle session, TDocument modifiedDocument, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field to update.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="filter">The filter for the update.</param>
|
||||||
|
/// <param name="field">The field to update.</param>
|
||||||
|
/// <param name="value">The value of the field.</param>
|
||||||
|
/// <param name="partitionKey">The optional partition key.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> UpdateOneAsync<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -335,5 +335,47 @@ namespace MongoDbGenericRepository
|
|||||||
where TProjection : class, new();
|
where TProjection : class, new();
|
||||||
|
|
||||||
#endregion Group By
|
#endregion Group By
|
||||||
|
|
||||||
|
#region Pagination
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Asynchronously returns a paginated list of the documents matching the filter condition.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <param name="filter">A LINQ expression filter.</param>
|
||||||
|
/// <param name="sortSelector">The property selector.</param>
|
||||||
|
/// <param name="ascending">Order of the sorting.</param>
|
||||||
|
/// <param name="skipNumber">The number of documents you want to skip. Default value is 0.</param>
|
||||||
|
/// <param name="takeNumber">The number of documents you want to take. Default value is 50.</param>
|
||||||
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
Task<List<TDocument>> GetSortedPaginatedAsync<TDocument>(
|
||||||
|
Expression<Func<TDocument, bool>> filter,
|
||||||
|
Expression<Func<TDocument, object>> sortSelector,
|
||||||
|
bool ascending = true,
|
||||||
|
int skipNumber = 0,
|
||||||
|
int takeNumber = 50,
|
||||||
|
string partitionKey = null)
|
||||||
|
where TDocument : IDocument<TKey>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Asynchronously returns a paginated list of the documents matching the filter condition.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <param name="filter">A LINQ expression filter.</param>
|
||||||
|
/// <param name="sortDefinition">The sort definition.</param>
|
||||||
|
/// <param name="skipNumber">The number of documents you want to skip. Default value is 0.</param>
|
||||||
|
/// <param name="takeNumber">The number of documents you want to take. Default value is 50.</param>
|
||||||
|
/// <param name="partitionKey">An optional partition key.</param>
|
||||||
|
Task<List<TDocument>> GetSortedPaginatedAsync<TDocument>(
|
||||||
|
Expression<Func<TDocument, bool>> filter,
|
||||||
|
SortDefinition<TDocument> sortDefinition,
|
||||||
|
int skipNumber = 0,
|
||||||
|
int takeNumber = 50,
|
||||||
|
string partitionKey = null)
|
||||||
|
where TDocument : IDocument<TKey>;
|
||||||
|
|
||||||
|
#endregion Pagination
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ namespace MongoDbGenericRepository
|
|||||||
{
|
{
|
||||||
private readonly object _initLock = new object();
|
private readonly object _initLock = new object();
|
||||||
private MongoDbCreator _mongoDbCreator;
|
private MongoDbCreator _mongoDbCreator;
|
||||||
protected MongoDbCreator MongoDbCreator
|
protected virtual MongoDbCreator MongoDbCreator
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -77,6 +77,7 @@ namespace MongoDbGenericRepository
|
|||||||
|
|
||||||
return _mongoDbCreator;
|
return _mongoDbCreator;
|
||||||
}
|
}
|
||||||
|
set { _mongoDbCreator = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ namespace MongoDbGenericRepository
|
|||||||
public abstract partial class BaseMongoRepository : IBaseMongoRepository_Delete
|
public abstract partial class BaseMongoRepository : IBaseMongoRepository_Delete
|
||||||
{
|
{
|
||||||
private MongoDbEraser _mongoDbEraser;
|
private MongoDbEraser _mongoDbEraser;
|
||||||
protected MongoDbEraser MongoDbEraser
|
protected virtual MongoDbEraser MongoDbEraser
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -121,6 +121,7 @@ namespace MongoDbGenericRepository
|
|||||||
|
|
||||||
return _mongoDbEraser;
|
return _mongoDbEraser;
|
||||||
}
|
}
|
||||||
|
set { _mongoDbEraser = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Delete
|
#region Delete
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ namespace MongoDbGenericRepository
|
|||||||
public abstract partial class BaseMongoRepository : IBaseMongoRepository_Index
|
public abstract partial class BaseMongoRepository : IBaseMongoRepository_Index
|
||||||
{
|
{
|
||||||
private MongoDbIndexHandler _mongoDbIndexHandler;
|
private MongoDbIndexHandler _mongoDbIndexHandler;
|
||||||
protected MongoDbIndexHandler MongoDbIndexHandler
|
protected virtual MongoDbIndexHandler MongoDbIndexHandler
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -128,6 +128,7 @@ namespace MongoDbGenericRepository
|
|||||||
}
|
}
|
||||||
return _mongoDbIndexHandler;
|
return _mongoDbIndexHandler;
|
||||||
}
|
}
|
||||||
|
set { _mongoDbIndexHandler = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -0,0 +1,197 @@
|
|||||||
|
using MongoDB.Driver;
|
||||||
|
using MongoDbGenericRepository.DataAccess.Update;
|
||||||
|
using MongoDbGenericRepository.Models;
|
||||||
|
using System;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MongoDbGenericRepository
|
||||||
|
{
|
||||||
|
public abstract partial class BaseMongoRepository : IBaseMongoRepository_Update_ClientSession
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="modifiedDocument">The document with the modifications you want to persist.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(IClientSessionHandle session, TDocument modifiedDocument, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey>(session, modifiedDocument, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="modifiedDocument">The document with the modifications you want to persist.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument modifiedDocument, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
return MongoDbUpdater.UpdateOne<TDocument, TKey>(session, modifiedDocument, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="documentToModify">The document to modify.</param>
|
||||||
|
/// <param name="update">The update definition.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey>(session, documentToModify, update, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="documentToModify">The document to modify.</param>
|
||||||
|
/// <param name="update">The update definition.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
return MongoDbUpdater.UpdateOne<TDocument, TKey>(session, documentToModify, update, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field to update.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="documentToModify">The document to modify.</param>
|
||||||
|
/// <param name="field">The field to update.</param>
|
||||||
|
/// <param name="value">The value of the field.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(session, documentToModify, field, value, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field to update.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="documentToModify">The document to modify.</param>
|
||||||
|
/// <param name="field">The field to update.</param>
|
||||||
|
/// <param name="value">The value of the field.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
return MongoDbUpdater.UpdateOne<TDocument, TKey, TField>(session, documentToModify, field, value, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field to update.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="filter">The filter for the update.</param>
|
||||||
|
/// <param name="field">The field to update.</param>
|
||||||
|
/// <param name="value">The value of the field.</param>
|
||||||
|
/// <param name="partitionKey">The optional partition key.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(session, filter, field, value, partitionKey, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field to update.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="filter">The filter for the update.</param>
|
||||||
|
/// <param name="field">The field to update.</param>
|
||||||
|
/// <param name="value">The value of the field.</param>
|
||||||
|
/// <param name="partitionKey">The optional partition key.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(session, filter, field, value, partitionKey, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field to update.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="filter">The filter for the update.</param>
|
||||||
|
/// <param name="field">The field to update.</param>
|
||||||
|
/// <param name="value">The value of the field.</param>
|
||||||
|
/// <param name="partitionKey">The optional partition key.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
return MongoDbUpdater.UpdateOne<TDocument, TKey, TField>(session, filter, field, value, partitionKey, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field to update.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="filter">The filter for the update.</param>
|
||||||
|
/// <param name="field">The field to update.</param>
|
||||||
|
/// <param name="value">The value of the field.</param>
|
||||||
|
/// <param name="partitionKey">The optional partition key.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
return UpdateOne<TDocument, TKey, TField>(session, Builders<TDocument>.Filter.Where(filter), field, value, partitionKey, cancellationToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,132 +7,6 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace MongoDbGenericRepository
|
namespace MongoDbGenericRepository
|
||||||
{
|
{
|
||||||
public interface IBaseMongoRepository_Update : IBaseMongoRepository_Update<Guid>
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Asynchronously Updates a document.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
|
||||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
|
||||||
/// <param name="modifiedDocument">The document with the modifications you want to persist.</param>
|
|
||||||
Task<bool> UpdateOneAsync<TDocument, TKey>(TDocument modifiedDocument)
|
|
||||||
where TDocument : IDocument<TKey>
|
|
||||||
where TKey : IEquatable<TKey>;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates a document.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
|
||||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
|
||||||
/// <param name="modifiedDocument">The document with the modifications you want to persist.</param>
|
|
||||||
bool UpdateOne<TDocument, TKey>(TDocument modifiedDocument)
|
|
||||||
where TDocument : IDocument<TKey>
|
|
||||||
where TKey : IEquatable<TKey>;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Takes a document you want to modify and applies the update you have defined in MongoDb.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
|
||||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
|
||||||
/// <param name="documentToModify">The document you want to modify.</param>
|
|
||||||
/// <param name="update">The update definition for the document.</param>
|
|
||||||
Task<bool> UpdateOneAsync<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update)
|
|
||||||
where TDocument : IDocument<TKey>
|
|
||||||
where TKey : IEquatable<TKey>;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Takes a document you want to modify and applies the update you have defined in MongoDb.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
|
||||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
|
||||||
/// <param name="documentToModify">The document you want to modify.</param>
|
|
||||||
/// <param name="update">The update definition for the document.</param>
|
|
||||||
bool UpdateOne<TDocument, TKey>(TDocument documentToModify, UpdateDefinition<TDocument> update)
|
|
||||||
where TDocument : IDocument<TKey>
|
|
||||||
where TKey : IEquatable<TKey>;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// For the entity selected by the filter, updates the property field with the given value..
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
|
||||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
|
||||||
/// <typeparam name="TField">The type of the field.</typeparam>
|
|
||||||
/// <param name="filter">The document filter.</param>
|
|
||||||
/// <param name="field">The field selector.</param>
|
|
||||||
/// <param name="value">The new value of the property field.</param>
|
|
||||||
/// <param name="partitionKey">The partition key for the document.</param>
|
|
||||||
bool UpdateOne<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
|
|
||||||
where TDocument : IDocument<TKey>
|
|
||||||
where TKey : IEquatable<TKey>;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the property field with the given value update a property field in entities.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
|
||||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
|
||||||
/// <typeparam name="TField">The type of the field.</typeparam>
|
|
||||||
/// <param name="documentToModify">The document you want to modify.</param>
|
|
||||||
/// <param name="field">The field selector.</param>
|
|
||||||
/// <param name="value">The new value of the property field.</param>
|
|
||||||
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value)
|
|
||||||
where TDocument : IDocument<TKey>
|
|
||||||
where TKey : IEquatable<TKey>;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// For the entity selected by the filter, updates the property field with the given value.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
|
||||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
|
||||||
/// <typeparam name="TField">The type of the field.</typeparam>
|
|
||||||
/// <param name="filter">The document filter.</param>
|
|
||||||
/// <param name="field">The field selector.</param>
|
|
||||||
/// <param name="value">The new value of the property field.</param>
|
|
||||||
/// <param name="partitionKey">The partition key for the document.</param>
|
|
||||||
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
|
|
||||||
where TDocument : IDocument<TKey>
|
|
||||||
where TKey : IEquatable<TKey>;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the property field with the given value update a property field in entities.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
|
||||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
|
||||||
/// <typeparam name="TField">The type of the field.</typeparam>
|
|
||||||
/// <param name="documentToModify">The document you want to modify.</param>
|
|
||||||
/// <param name="field">The field selector.</param>
|
|
||||||
/// <param name="value">The new value of the property field.</param>
|
|
||||||
bool UpdateOne<TDocument, TKey, TField>(TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value)
|
|
||||||
where TDocument : IDocument<TKey>
|
|
||||||
where TKey : IEquatable<TKey>;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the property field with the given value update a property field in entities.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
|
||||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
|
||||||
/// <typeparam name="TField">The type of the field.</typeparam>
|
|
||||||
/// <param name="filter">The document filter.</param>
|
|
||||||
/// <param name="field">The field selector.</param>
|
|
||||||
/// <param name="value">The new value of the property field.</param>
|
|
||||||
/// <param name="partitionKey">The value of the partition key.</param>
|
|
||||||
Task<bool> UpdateOneAsync<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
|
|
||||||
where TDocument : IDocument<TKey>
|
|
||||||
where TKey : IEquatable<TKey>;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the property field with the given value update a property field in entities.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
|
||||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
|
||||||
/// <typeparam name="TField">The type of the field.</typeparam>
|
|
||||||
/// <param name="filter">The document filter.</param>
|
|
||||||
/// <param name="field">The field selector.</param>
|
|
||||||
/// <param name="value">The new value of the property field.</param>
|
|
||||||
/// <param name="partitionKey">The value of the partition key.</param>
|
|
||||||
bool UpdateOne<TDocument, TKey, TField>(FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
|
|
||||||
where TDocument : IDocument<TKey>
|
|
||||||
where TKey : IEquatable<TKey>;
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.
|
/// The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.
|
||||||
/// Its constructor must be given a connection string and a database name.
|
/// Its constructor must be given a connection string and a database name.
|
||||||
@@ -140,7 +14,7 @@ namespace MongoDbGenericRepository
|
|||||||
public abstract partial class BaseMongoRepository : IBaseMongoRepository_Update
|
public abstract partial class BaseMongoRepository : IBaseMongoRepository_Update
|
||||||
{
|
{
|
||||||
private MongoDbUpdater _mongoDbUpdater;
|
private MongoDbUpdater _mongoDbUpdater;
|
||||||
protected MongoDbUpdater MongoDbUpdater
|
protected virtual MongoDbUpdater MongoDbUpdater
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -156,6 +30,7 @@ namespace MongoDbGenericRepository
|
|||||||
|
|
||||||
return _mongoDbUpdater;
|
return _mongoDbUpdater;
|
||||||
}
|
}
|
||||||
|
set { _mongoDbUpdater = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Update
|
#region Update
|
||||||
@@ -451,6 +326,7 @@ namespace MongoDbGenericRepository
|
|||||||
return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(Builders<TDocument>.Filter.Where(filter), field, value, partitionKey);
|
return await MongoDbUpdater.UpdateOneAsync<TDocument, TKey, TField>(Builders<TDocument>.Filter.Where(filter), field, value, partitionKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion Update
|
#endregion Update
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,217 @@
|
|||||||
|
using MongoDB.Driver;
|
||||||
|
using MongoDbGenericRepository.Models;
|
||||||
|
using System;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MongoDbGenericRepository.DataAccess.Update
|
||||||
|
{
|
||||||
|
public partial class MongoDbUpdater
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="modifiedDocument">The document with the modifications you want to persist.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(IClientSessionHandle session, TDocument modifiedDocument, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
var filter = Builders<TDocument>.Filter.Eq("Id", modifiedDocument.Id);
|
||||||
|
var updateRes = await HandlePartitioned<TDocument, TKey>(modifiedDocument)
|
||||||
|
.ReplaceOneAsync(session, filter, modifiedDocument, cancellationToken: cancellationToken)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
return updateRes.ModifiedCount == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="modifiedDocument">The document with the modifications you want to persist.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument modifiedDocument, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
var filter = Builders<TDocument>.Filter.Eq("Id", modifiedDocument.Id);
|
||||||
|
var updateRes = HandlePartitioned<TDocument, TKey>(modifiedDocument).ReplaceOne(session, filter, modifiedDocument, cancellationToken: cancellationToken);
|
||||||
|
return updateRes.ModifiedCount == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="documentToModify">The document to modify.</param>
|
||||||
|
/// <param name="update">The update definition.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
var filter = Builders<TDocument>.Filter.Eq("Id", documentToModify.Id);
|
||||||
|
var updateRes = await HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOneAsync(session, filter, update, new UpdateOptions { IsUpsert = true }, cancellationToken).ConfigureAwait(false);
|
||||||
|
return updateRes.ModifiedCount == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="documentToModify">The document to modify.</param>
|
||||||
|
/// <param name="update">The update definition.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual bool UpdateOne<TDocument, TKey>(IClientSessionHandle session, TDocument documentToModify, UpdateDefinition<TDocument> update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
var filter = Builders<TDocument>.Filter.Eq("Id", documentToModify.Id);
|
||||||
|
var updateRes = HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOne(session, filter, update, new UpdateOptions { IsUpsert = true }, cancellationToken);
|
||||||
|
return updateRes.ModifiedCount == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field to update.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="documentToModify">The document to modify.</param>
|
||||||
|
/// <param name="field">The field to update.</param>
|
||||||
|
/// <param name="value">The value of the field.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
var filter = Builders<TDocument>.Filter.Eq("Id", documentToModify.Id);
|
||||||
|
var updateRes = await HandlePartitioned<TDocument, TKey>(documentToModify)
|
||||||
|
.UpdateOneAsync(session, filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
return updateRes.ModifiedCount == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field to update.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="documentToModify">The document to modify.</param>
|
||||||
|
/// <param name="field">The field to update.</param>
|
||||||
|
/// <param name="value">The value of the field.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, TDocument documentToModify, Expression<Func<TDocument, TField>> field, TField value, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
var filter = Builders<TDocument>.Filter.Eq("Id", documentToModify.Id);
|
||||||
|
var updateRes = HandlePartitioned<TDocument, TKey>(documentToModify).UpdateOne(session, filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken);
|
||||||
|
return updateRes.ModifiedCount == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field to update.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="filter">The filter for the update.</param>
|
||||||
|
/// <param name="field">The field to update.</param>
|
||||||
|
/// <param name="value">The value of the field.</param>
|
||||||
|
/// <param name="partitionKey">The optional partition key.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
var collection = string.IsNullOrEmpty(partitionKey) ? GetCollection<TDocument, TKey>() : GetCollection<TDocument, TKey>(partitionKey);
|
||||||
|
var updateRes = await collection.UpdateOneAsync(session, filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||||
|
return updateRes.ModifiedCount == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field to update.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="filter">The filter for the update.</param>
|
||||||
|
/// <param name="field">The field to update.</param>
|
||||||
|
/// <param name="value">The value of the field.</param>
|
||||||
|
/// <param name="partitionKey">The optional partition key.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual Task<bool> UpdateOneAsync<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
return UpdateOneAsync<TDocument, TKey, TField>(session, Builders<TDocument>.Filter.Where(filter), field, value, partitionKey, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field to update.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="filter">The filter for the update.</param>
|
||||||
|
/// <param name="field">The field to update.</param>
|
||||||
|
/// <param name="value">The value of the field.</param>
|
||||||
|
/// <param name="partitionKey">The optional partition key.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, FilterDefinition<TDocument> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
var collection = string.IsNullOrEmpty(partitionKey) ? GetCollection<TDocument, TKey>() : GetCollection<TDocument, TKey>(partitionKey);
|
||||||
|
var updateRes = collection.UpdateOne(session, filter, Builders<TDocument>.Update.Set(field, value), cancellationToken: cancellationToken);
|
||||||
|
return updateRes.ModifiedCount == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates a document.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||||
|
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||||
|
/// <typeparam name="TField">The type of the field to update.</typeparam>
|
||||||
|
/// <param name="session">The client session.</param>
|
||||||
|
/// <param name="filter">The filter for the update.</param>
|
||||||
|
/// <param name="field">The field to update.</param>
|
||||||
|
/// <param name="value">The value of the field.</param>
|
||||||
|
/// <param name="partitionKey">The optional partition key.</param>
|
||||||
|
/// <param name="cancellationToken">The optional cancellation token.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual bool UpdateOne<TDocument, TKey, TField>(IClientSessionHandle session, Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
where TDocument : IDocument<TKey>
|
||||||
|
where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
return UpdateOne<TDocument, TKey, TField>(session, Builders<TDocument>.Filter.Where(filter), field, value, partitionKey, cancellationToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,17 +1,14 @@
|
|||||||
using MongoDB.Driver;
|
using MongoDB.Driver;
|
||||||
using MongoDB.Driver.Linq;
|
|
||||||
using MongoDbGenericRepository.DataAccess.Base;
|
using MongoDbGenericRepository.DataAccess.Base;
|
||||||
using MongoDbGenericRepository.Models;
|
using MongoDbGenericRepository.Models;
|
||||||
using MongoDbGenericRepository.Utils;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MongoDbGenericRepository.DataAccess.Update
|
namespace MongoDbGenericRepository.DataAccess.Update
|
||||||
{
|
{
|
||||||
public class MongoDbUpdater : DataAccessBase
|
public partial class MongoDbUpdater : DataAccessBase
|
||||||
{
|
{
|
||||||
public MongoDbUpdater(IMongoDbContext mongoDbContext) : base(mongoDbContext)
|
public MongoDbUpdater(IMongoDbContext mongoDbContext) : base(mongoDbContext)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace MongoDbGenericRepository
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The MongoDb accessor to insert data.
|
/// The MongoDb accessor to insert data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected MongoDbCreator MongoDbCreator
|
protected virtual MongoDbCreator MongoDbCreator
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -72,6 +72,7 @@ namespace MongoDbGenericRepository
|
|||||||
}
|
}
|
||||||
return _mongoDbCreator;
|
return _mongoDbCreator;
|
||||||
}
|
}
|
||||||
|
set { _mongoDbCreator = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace MongoDbGenericRepository
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The MongoDb accessor to delete data.
|
/// The MongoDb accessor to delete data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected MongoDbEraser MongoDbEraser
|
protected virtual MongoDbEraser MongoDbEraser
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -113,6 +113,7 @@ namespace MongoDbGenericRepository
|
|||||||
}
|
}
|
||||||
return _mongoDbEraser;
|
return _mongoDbEraser;
|
||||||
}
|
}
|
||||||
|
set { _mongoDbEraser = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ namespace MongoDbGenericRepository
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The MongoDb accessor to manage indexes.
|
/// The MongoDb accessor to manage indexes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected MongoDbIndexHandler MongoDbIndexHandler
|
protected virtual MongoDbIndexHandler MongoDbIndexHandler
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -124,6 +124,7 @@ namespace MongoDbGenericRepository
|
|||||||
}
|
}
|
||||||
return _mongoDbIndexHandler;
|
return _mongoDbIndexHandler;
|
||||||
}
|
}
|
||||||
|
set { _mongoDbIndexHandler = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ namespace MongoDbGenericRepository
|
|||||||
where TKey : IEquatable<TKey>
|
where TKey : IEquatable<TKey>
|
||||||
{
|
{
|
||||||
private MongoDbUpdater _mongoDbUpdater;
|
private MongoDbUpdater _mongoDbUpdater;
|
||||||
protected MongoDbUpdater MongoDbUpdater
|
protected virtual MongoDbUpdater MongoDbUpdater
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -132,6 +132,7 @@ namespace MongoDbGenericRepository
|
|||||||
|
|
||||||
return _mongoDbUpdater;
|
return _mongoDbUpdater;
|
||||||
}
|
}
|
||||||
|
set { _mongoDbUpdater = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -46,6 +46,15 @@ namespace MongoDbGenericRepository
|
|||||||
Database = Client.GetDatabase(databaseName);
|
Database = Client.GetDatabase(databaseName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initialise an instance of a <see cref="IMongoDbContext"/> using a connection string
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="connectionString"></param>
|
||||||
|
public MongoDbContext(string connectionString)
|
||||||
|
: this(connectionString, new MongoUrl(connectionString).DatabaseName)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The constructor of the MongoDbContext, it needs a connection string and a database name.
|
/// The constructor of the MongoDbContext, it needs a connection string and a database name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net45;netstandard2.0;netstandard1.5;</TargetFrameworks>
|
<TargetFrameworks>net452;netstandard2.0;netstandard1.5;</TargetFrameworks>
|
||||||
<PackageId>MongoDbGenericRepository</PackageId>
|
<PackageId>MongoDbGenericRepository</PackageId>
|
||||||
<PackageVersion>1.2.0</PackageVersion>
|
<PackageVersion>1.2.0</PackageVersion>
|
||||||
<Authors>Alexandre Spieser</Authors>
|
<Authors>Alexandre Spieser</Authors>
|
||||||
@@ -16,8 +16,12 @@
|
|||||||
<DocumentationFile>bin\Release\net45\MongoDbGenericRepository.xml</DocumentationFile>
|
<DocumentationFile>bin\Release\net45\MongoDbGenericRepository.xml</DocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net452|AnyCPU'">
|
||||||
|
<DocumentationFile></DocumentationFile>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MongoDB.Driver" Version="2.7.0" />
|
<PackageReference Include="MongoDB.Driver" Version="2.9.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<package >
|
<package >
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MongoDbGenericRepository</id>
|
<id>MongoDbGenericRepository</id>
|
||||||
<version>1.3.9</version>
|
<version>1.4.3</version>
|
||||||
<title>MongoDb Generic Repository</title>
|
<title>MongoDb Generic Repository</title>
|
||||||
<authors>Alexandre Spieser</authors>
|
<authors>Alexandre Spieser</authors>
|
||||||
<owners>Alexandre Spieser</owners>
|
<owners>Alexandre Spieser</owners>
|
||||||
@@ -14,7 +14,15 @@
|
|||||||
<copyright>Copyright 2019 (c) Alexandre Spieser. All rights reserved.</copyright>
|
<copyright>Copyright 2019 (c) Alexandre Spieser. All rights reserved.</copyright>
|
||||||
<tags>MongoDb Repository Generic NoSql</tags>
|
<tags>MongoDb Repository Generic NoSql</tags>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MongoDB.Driver" version="2.7.0" />
|
<group targetFramework=".NETFramework4.5.2">
|
||||||
|
<dependency id="MongoDB.Driver" version="2.9.3" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
<group targetFramework=".NETStandard1.5">
|
||||||
|
<dependency id="MongoDB.Driver" version="2.9.3" exclude="Build,Analyzers" />
|
||||||
|
</group>
|
||||||
|
<group targetFramework=".NETStandard2.0">
|
||||||
|
<dependency id="MongoDB.Driver" version="2.9.3" exclude="Build,Analyzers"/>
|
||||||
|
</group>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
+1226
-793
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"runtimeTarget": {
|
"runtimeTarget": {
|
||||||
"name": ".NETStandard,Version=v1.5/",
|
"name": ".NETStandard,Version=v1.5/",
|
||||||
"signature": "b945d8e228876adfa8e84019c7873fce5baf0c0b"
|
"signature": "89b5d0501e3f13fb98f678ed96fc31de9d7405cf"
|
||||||
},
|
},
|
||||||
"compilationOptions": {},
|
"compilationOptions": {},
|
||||||
"targets": {
|
"targets": {
|
||||||
@@ -9,18 +9,18 @@
|
|||||||
".NETStandard,Version=v1.5/": {
|
".NETStandard,Version=v1.5/": {
|
||||||
"MongoDbGenericRepository/1.0.0": {
|
"MongoDbGenericRepository/1.0.0": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"MongoDB.Driver": "2.7.0",
|
"MongoDB.Driver": "2.9.3",
|
||||||
"NETStandard.Library": "1.6.1"
|
"NETStandard.Library": "1.6.1"
|
||||||
},
|
},
|
||||||
"runtime": {
|
"runtime": {
|
||||||
"MongoDbGenericRepository.dll": {}
|
"MongoDbGenericRepository.dll": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"DnsClient/1.0.7": {
|
"DnsClient/1.2.0": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.Win32.Primitives": "4.3.0",
|
"Microsoft.Win32.Primitives": "4.3.0",
|
||||||
"NETStandard.Library": "1.6.1",
|
"NETStandard.Library": "1.6.1",
|
||||||
"System.Buffers": "4.3.0",
|
"System.Buffers": "4.4.0",
|
||||||
"System.Collections": "4.3.0",
|
"System.Collections": "4.3.0",
|
||||||
"System.Collections.Concurrent": "4.3.0",
|
"System.Collections.Concurrent": "4.3.0",
|
||||||
"System.Globalization.Extensions": "4.3.0",
|
"System.Globalization.Extensions": "4.3.0",
|
||||||
@@ -37,8 +37,8 @@
|
|||||||
},
|
},
|
||||||
"runtime": {
|
"runtime": {
|
||||||
"lib/netstandard1.3/DnsClient.dll": {
|
"lib/netstandard1.3/DnsClient.dll": {
|
||||||
"assemblyVersion": "1.0.7.0",
|
"assemblyVersion": "1.2.0.0",
|
||||||
"fileVersion": "1.0.7.0"
|
"fileVersion": "1.2.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -63,51 +63,55 @@
|
|||||||
"System.Runtime.InteropServices": "4.3.0"
|
"System.Runtime.InteropServices": "4.3.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"MongoDB.Bson/2.7.0": {
|
"MongoDB.Bson/2.9.3": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"NETStandard.Library": "1.6.1",
|
"NETStandard.Library": "1.6.1",
|
||||||
"System.Collections.NonGeneric": "4.0.1",
|
"System.Collections.NonGeneric": "4.0.1",
|
||||||
"System.Diagnostics.Process": "4.1.0",
|
"System.Diagnostics.Process": "4.1.0",
|
||||||
"System.Dynamic.Runtime": "4.0.11",
|
"System.Dynamic.Runtime": "4.0.11",
|
||||||
"System.Reflection.Emit.Lightweight": "4.0.1"
|
"System.Reflection.Emit.Lightweight": "4.3.0",
|
||||||
|
"System.Runtime.Serialization.Formatters": "4.3.0"
|
||||||
},
|
},
|
||||||
"runtime": {
|
"runtime": {
|
||||||
"lib/netstandard1.5/MongoDB.Bson.dll": {
|
"lib/netstandard1.5/MongoDB.Bson.dll": {
|
||||||
"assemblyVersion": "2.7.0.0",
|
"assemblyVersion": "2.9.3.0",
|
||||||
"fileVersion": "2.7.0.0"
|
"fileVersion": "2.9.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"MongoDB.Driver/2.7.0": {
|
"MongoDB.Driver/2.9.3": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"MongoDB.Bson": "2.7.0",
|
"MongoDB.Bson": "2.9.3",
|
||||||
"MongoDB.Driver.Core": "2.7.0",
|
"MongoDB.Driver.Core": "2.9.3",
|
||||||
"NETStandard.Library": "1.6.1",
|
"NETStandard.Library": "1.6.1",
|
||||||
"System.ComponentModel.TypeConverter": "4.1.0",
|
"System.ComponentModel.TypeConverter": "4.1.0",
|
||||||
"System.Linq.Queryable": "4.0.1"
|
"System.Linq.Queryable": "4.0.1"
|
||||||
},
|
},
|
||||||
"runtime": {
|
"runtime": {
|
||||||
"lib/netstandard1.5/MongoDB.Driver.dll": {
|
"lib/netstandard1.5/MongoDB.Driver.dll": {
|
||||||
"assemblyVersion": "2.7.0.0",
|
"assemblyVersion": "2.9.3.0",
|
||||||
"fileVersion": "2.7.0.0"
|
"fileVersion": "2.9.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"MongoDB.Driver.Core/2.7.0": {
|
"MongoDB.Driver.Core/2.9.3": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"DnsClient": "1.0.7",
|
"DnsClient": "1.2.0",
|
||||||
"MongoDB.Bson": "2.7.0",
|
"MongoDB.Bson": "2.9.3",
|
||||||
"NETStandard.Library": "1.6.1",
|
"NETStandard.Library": "1.6.1",
|
||||||
|
"SharpCompress": "0.23.0",
|
||||||
"System.Collections.Specialized": "4.0.1",
|
"System.Collections.Specialized": "4.0.1",
|
||||||
|
"System.Diagnostics.TextWriterTraceListener": "4.0.0",
|
||||||
"System.Diagnostics.TraceSource": "4.0.0",
|
"System.Diagnostics.TraceSource": "4.0.0",
|
||||||
"System.Net.NameResolution": "4.3.0",
|
"System.Net.NameResolution": "4.3.0",
|
||||||
"System.Net.Security": "4.0.0",
|
"System.Net.Security": "4.3.2",
|
||||||
"System.Security.SecureString": "4.0.0"
|
"System.Security.SecureString": "4.0.0",
|
||||||
|
"System.Threading.Thread": "4.3.0"
|
||||||
},
|
},
|
||||||
"runtime": {
|
"runtime": {
|
||||||
"lib/netstandard1.5/MongoDB.Driver.Core.dll": {
|
"lib/netstandard1.5/MongoDB.Driver.Core.dll": {
|
||||||
"assemblyVersion": "2.7.0.0",
|
"assemblyVersion": "2.9.3.0",
|
||||||
"fileVersion": "2.7.0.0"
|
"fileVersion": "2.9.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -195,12 +199,24 @@
|
|||||||
"runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {},
|
"runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {},
|
||||||
"runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {},
|
"runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {},
|
||||||
"runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {},
|
"runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": {},
|
||||||
|
"SharpCompress/0.23.0": {
|
||||||
|
"dependencies": {
|
||||||
|
"NETStandard.Library": "1.6.1",
|
||||||
|
"System.Text.Encoding.CodePages": "4.5.1"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"lib/netstandard1.3/SharpCompress.dll": {
|
||||||
|
"assemblyVersion": "0.23.0.0",
|
||||||
|
"fileVersion": "0.23.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"System.AppContext/4.3.0": {
|
"System.AppContext/4.3.0": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"System.Runtime": "4.3.0"
|
"System.Runtime": "4.3.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"System.Buffers/4.3.0": {
|
"System.Buffers/4.4.0": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"System.Diagnostics.Debug": "4.3.0",
|
"System.Diagnostics.Debug": "4.3.0",
|
||||||
"System.Diagnostics.Tracing": "4.3.0",
|
"System.Diagnostics.Tracing": "4.3.0",
|
||||||
@@ -210,8 +226,8 @@
|
|||||||
},
|
},
|
||||||
"runtime": {
|
"runtime": {
|
||||||
"lib/netstandard1.1/System.Buffers.dll": {
|
"lib/netstandard1.1/System.Buffers.dll": {
|
||||||
"assemblyVersion": "4.0.1.0",
|
"assemblyVersion": "4.0.2.0",
|
||||||
"fileVersion": "4.6.24705.1"
|
"fileVersion": "4.6.25519.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -380,6 +396,22 @@
|
|||||||
"runtime.native.System": "4.3.0"
|
"runtime.native.System": "4.3.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"System.Diagnostics.TextWriterTraceListener/4.0.0": {
|
||||||
|
"dependencies": {
|
||||||
|
"System.Diagnostics.TraceSource": "4.0.0",
|
||||||
|
"System.Globalization": "4.3.0",
|
||||||
|
"System.IO": "4.3.0",
|
||||||
|
"System.Resources.ResourceManager": "4.3.0",
|
||||||
|
"System.Runtime": "4.3.0",
|
||||||
|
"System.Threading": "4.3.0"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"lib/netstandard1.3/System.Diagnostics.TextWriterTraceListener.dll": {
|
||||||
|
"assemblyVersion": "4.0.0.0",
|
||||||
|
"fileVersion": "1.0.24212.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"System.Diagnostics.Tools/4.3.0": {
|
"System.Diagnostics.Tools/4.3.0": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.NETCore.Platforms": "1.1.0",
|
"Microsoft.NETCore.Platforms": "1.1.0",
|
||||||
@@ -417,7 +449,7 @@
|
|||||||
"System.ObjectModel": "4.3.0",
|
"System.ObjectModel": "4.3.0",
|
||||||
"System.Reflection": "4.3.0",
|
"System.Reflection": "4.3.0",
|
||||||
"System.Reflection.Emit": "4.0.1",
|
"System.Reflection.Emit": "4.0.1",
|
||||||
"System.Reflection.Emit.ILGeneration": "4.0.1",
|
"System.Reflection.Emit.ILGeneration": "4.3.0",
|
||||||
"System.Reflection.Primitives": "4.3.0",
|
"System.Reflection.Primitives": "4.3.0",
|
||||||
"System.Reflection.TypeExtensions": "4.1.0",
|
"System.Reflection.TypeExtensions": "4.1.0",
|
||||||
"System.Resources.ResourceManager": "4.3.0",
|
"System.Resources.ResourceManager": "4.3.0",
|
||||||
@@ -469,7 +501,7 @@
|
|||||||
"System.IO.Compression/4.3.0": {
|
"System.IO.Compression/4.3.0": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.NETCore.Platforms": "1.1.0",
|
"Microsoft.NETCore.Platforms": "1.1.0",
|
||||||
"System.Buffers": "4.3.0",
|
"System.Buffers": "4.4.0",
|
||||||
"System.Collections": "4.3.0",
|
"System.Collections": "4.3.0",
|
||||||
"System.Diagnostics.Debug": "4.3.0",
|
"System.Diagnostics.Debug": "4.3.0",
|
||||||
"System.IO": "4.3.0",
|
"System.IO": "4.3.0",
|
||||||
@@ -487,7 +519,7 @@
|
|||||||
},
|
},
|
||||||
"System.IO.Compression.ZipFile/4.3.0": {
|
"System.IO.Compression.ZipFile/4.3.0": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"System.Buffers": "4.3.0",
|
"System.Buffers": "4.4.0",
|
||||||
"System.IO": "4.3.0",
|
"System.IO": "4.3.0",
|
||||||
"System.IO.Compression": "4.3.0",
|
"System.IO.Compression": "4.3.0",
|
||||||
"System.IO.FileSystem": "4.3.0",
|
"System.IO.FileSystem": "4.3.0",
|
||||||
@@ -633,7 +665,7 @@
|
|||||||
"System.Runtime.Handles": "4.3.0"
|
"System.Runtime.Handles": "4.3.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"System.Net.Security/4.0.0": {
|
"System.Net.Security/4.3.2": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.NETCore.Platforms": "1.1.0",
|
"Microsoft.NETCore.Platforms": "1.1.0",
|
||||||
"Microsoft.Win32.Primitives": "4.3.0",
|
"Microsoft.Win32.Primitives": "4.3.0",
|
||||||
@@ -649,6 +681,7 @@
|
|||||||
"System.Runtime.Handles": "4.3.0",
|
"System.Runtime.Handles": "4.3.0",
|
||||||
"System.Runtime.InteropServices": "4.3.0",
|
"System.Runtime.InteropServices": "4.3.0",
|
||||||
"System.Security.Claims": "4.3.0",
|
"System.Security.Claims": "4.3.0",
|
||||||
|
"System.Security.Cryptography.Encoding": "4.3.0",
|
||||||
"System.Security.Cryptography.Primitives": "4.3.0",
|
"System.Security.Cryptography.Primitives": "4.3.0",
|
||||||
"System.Security.Cryptography.X509Certificates": "4.3.0",
|
"System.Security.Cryptography.X509Certificates": "4.3.0",
|
||||||
"System.Security.Principal": "4.3.0",
|
"System.Security.Principal": "4.3.0",
|
||||||
@@ -696,7 +729,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"System.IO": "4.3.0",
|
"System.IO": "4.3.0",
|
||||||
"System.Reflection": "4.3.0",
|
"System.Reflection": "4.3.0",
|
||||||
"System.Reflection.Emit.ILGeneration": "4.0.1",
|
"System.Reflection.Emit.ILGeneration": "4.3.0",
|
||||||
"System.Reflection.Primitives": "4.3.0",
|
"System.Reflection.Primitives": "4.3.0",
|
||||||
"System.Runtime": "4.3.0"
|
"System.Runtime": "4.3.0"
|
||||||
},
|
},
|
||||||
@@ -707,7 +740,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"System.Reflection.Emit.ILGeneration/4.0.1": {
|
"System.Reflection.Emit.ILGeneration/4.3.0": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"System.Reflection": "4.3.0",
|
"System.Reflection": "4.3.0",
|
||||||
"System.Reflection.Primitives": "4.3.0",
|
"System.Reflection.Primitives": "4.3.0",
|
||||||
@@ -715,22 +748,22 @@
|
|||||||
},
|
},
|
||||||
"runtime": {
|
"runtime": {
|
||||||
"lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll": {
|
"lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll": {
|
||||||
"assemblyVersion": "4.0.1.0",
|
"assemblyVersion": "4.0.2.0",
|
||||||
"fileVersion": "1.0.24212.1"
|
"fileVersion": "4.6.24705.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"System.Reflection.Emit.Lightweight/4.0.1": {
|
"System.Reflection.Emit.Lightweight/4.3.0": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"System.Reflection": "4.3.0",
|
"System.Reflection": "4.3.0",
|
||||||
"System.Reflection.Emit.ILGeneration": "4.0.1",
|
"System.Reflection.Emit.ILGeneration": "4.3.0",
|
||||||
"System.Reflection.Primitives": "4.3.0",
|
"System.Reflection.Primitives": "4.3.0",
|
||||||
"System.Runtime": "4.3.0"
|
"System.Runtime": "4.3.0"
|
||||||
},
|
},
|
||||||
"runtime": {
|
"runtime": {
|
||||||
"lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll": {
|
"lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll": {
|
||||||
"assemblyVersion": "4.0.1.0",
|
"assemblyVersion": "4.0.2.0",
|
||||||
"fileVersion": "1.0.24212.1"
|
"fileVersion": "4.6.24705.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -831,6 +864,33 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"System.Runtime.Serialization.Formatters/4.3.0": {
|
||||||
|
"dependencies": {
|
||||||
|
"System.Collections": "4.3.0",
|
||||||
|
"System.Reflection": "4.3.0",
|
||||||
|
"System.Resources.ResourceManager": "4.3.0",
|
||||||
|
"System.Runtime": "4.3.0",
|
||||||
|
"System.Runtime.Serialization.Primitives": "4.3.0"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"lib/netstandard1.4/System.Runtime.Serialization.Formatters.dll": {
|
||||||
|
"assemblyVersion": "4.0.1.0",
|
||||||
|
"fileVersion": "4.6.24705.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"System.Runtime.Serialization.Primitives/4.3.0": {
|
||||||
|
"dependencies": {
|
||||||
|
"System.Resources.ResourceManager": "4.3.0",
|
||||||
|
"System.Runtime": "4.3.0"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"lib/netstandard1.3/System.Runtime.Serialization.Primitives.dll": {
|
||||||
|
"assemblyVersion": "4.1.2.0",
|
||||||
|
"fileVersion": "4.6.24705.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"System.Security.Claims/4.3.0": {
|
"System.Security.Claims/4.3.0": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"System.Collections": "4.3.0",
|
"System.Collections": "4.3.0",
|
||||||
@@ -944,6 +1004,17 @@
|
|||||||
"System.Runtime": "4.3.0"
|
"System.Runtime": "4.3.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"System.Text.Encoding.CodePages/4.5.1": {
|
||||||
|
"dependencies": {
|
||||||
|
"NETStandard.Library": "1.6.1"
|
||||||
|
},
|
||||||
|
"runtime": {
|
||||||
|
"lib/netstandard1.3/System.Text.Encoding.CodePages.dll": {
|
||||||
|
"assemblyVersion": "4.0.2.0",
|
||||||
|
"fileVersion": "4.6.24705.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"System.Text.Encoding.Extensions/4.3.0": {
|
"System.Text.Encoding.Extensions/4.3.0": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.NETCore.Platforms": "1.1.0",
|
"Microsoft.NETCore.Platforms": "1.1.0",
|
||||||
@@ -1082,12 +1153,12 @@
|
|||||||
"serviceable": false,
|
"serviceable": false,
|
||||||
"sha512": ""
|
"sha512": ""
|
||||||
},
|
},
|
||||||
"DnsClient/1.0.7": {
|
"DnsClient/1.2.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"serviceable": true,
|
"serviceable": true,
|
||||||
"sha512": "sha512-f3k5ufhUSL658fy/ac1mReqRIr0jGMyOJFvBqJ+7cASq01NIysYbrrRDjboYKAGrd0Y2mc1A749uQvT8vAA91A==",
|
"sha512": "sha512-P34wUkeqU4FoQiOMV8OjpdeDZKs4d3r+VlHuKJ6eO5feiZgna3+9MF5orHRUn3DAv1g/HPE5hlkGucmxmsFfBw==",
|
||||||
"path": "dnsclient/1.0.7",
|
"path": "dnsclient/1.2.0",
|
||||||
"hashPath": "dnsclient.1.0.7.nupkg.sha512"
|
"hashPath": "dnsclient.1.2.0.nupkg.sha512"
|
||||||
},
|
},
|
||||||
"Microsoft.NETCore.Platforms/1.1.0": {
|
"Microsoft.NETCore.Platforms/1.1.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
@@ -1113,30 +1184,30 @@
|
|||||||
"Microsoft.Win32.Registry/4.0.0": {
|
"Microsoft.Win32.Registry/4.0.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"serviceable": true,
|
"serviceable": true,
|
||||||
"sha512": "sha512-mYUxH/YY9PwvuWY93/qsovFHAh+Lu2CNxNHWxB/x0dnpaEy6oIy/9d7R2J6dFaLZ7jhE7emLjn7A8kSzsP1A+Q==",
|
"sha512": "sha512-UiSp7lTxGtsF6J96wwErFeM0jygj/bWWKvbqwtRP2t6OohgT7TCTpjvQ1+7DLQLH3DR70i6+eRGX/y85WFuz1Q==",
|
||||||
"path": "microsoft.win32.registry/4.0.0",
|
"path": "microsoft.win32.registry/4.0.0",
|
||||||
"hashPath": "microsoft.win32.registry.4.0.0.nupkg.sha512"
|
"hashPath": "microsoft.win32.registry.4.0.0.nupkg.sha512"
|
||||||
},
|
},
|
||||||
"MongoDB.Bson/2.7.0": {
|
"MongoDB.Bson/2.9.3": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"serviceable": true,
|
"serviceable": true,
|
||||||
"sha512": "sha512-vzpTDHYX/X6gF9qtDuKRJiLkqpj5OZuT1bIzJCiBiU8CwJ37becYmaXuy/QSuWnYN6j6ZdVTWILKbWt2MXL8DA==",
|
"sha512": "sha512-iuLdgI/8Q3AnboPR0OTFDpqVAxTskW9IQLhxKt+O4IQ3s9hHVLLp1dGLChrwrcK+3Fa2MFNHvm6W8tEMV4VUmw==",
|
||||||
"path": "mongodb.bson/2.7.0",
|
"path": "mongodb.bson/2.9.3",
|
||||||
"hashPath": "mongodb.bson.2.7.0.nupkg.sha512"
|
"hashPath": "mongodb.bson.2.9.3.nupkg.sha512"
|
||||||
},
|
},
|
||||||
"MongoDB.Driver/2.7.0": {
|
"MongoDB.Driver/2.9.3": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"serviceable": true,
|
"serviceable": true,
|
||||||
"sha512": "sha512-5wP5BBwm5YO6h2Vhw6zQmOwSW9WP2d6kgRM6E7uIbwIJz4+j2trS2Wo7/+IYow5WVN8Jd6O27bIB/4gKNepO1Q==",
|
"sha512": "sha512-nSHXATq6u9CSwfO/xCQSZe6JgJeVmLng0v6fwc6WFTYVnssAZjIaj1BiNu3XshHP+vYCzYZUmbPtRHltaXQiuw==",
|
||||||
"path": "mongodb.driver/2.7.0",
|
"path": "mongodb.driver/2.9.3",
|
||||||
"hashPath": "mongodb.driver.2.7.0.nupkg.sha512"
|
"hashPath": "mongodb.driver.2.9.3.nupkg.sha512"
|
||||||
},
|
},
|
||||||
"MongoDB.Driver.Core/2.7.0": {
|
"MongoDB.Driver.Core/2.9.3": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"serviceable": true,
|
"serviceable": true,
|
||||||
"sha512": "sha512-SepB4KT+zXA3iFaIFwXVKmk6BZIp0EGE/iWqNbDZ1mca9e8EhtqYPwOOzFmEbdKAzmVvF1y86kNI4agWP6I5sg==",
|
"sha512": "sha512-j95XZhXTukZHUnZmEFEJPERscccfa42iLPbPBlwRJMK5XEZ9myCcxnWACvJwYXrU6RoRwUzYCFYoSHj6lHfgmA==",
|
||||||
"path": "mongodb.driver.core/2.7.0",
|
"path": "mongodb.driver.core/2.9.3",
|
||||||
"hashPath": "mongodb.driver.core.2.7.0.nupkg.sha512"
|
"hashPath": "mongodb.driver.core.2.9.3.nupkg.sha512"
|
||||||
},
|
},
|
||||||
"NETStandard.Library/1.6.1": {
|
"NETStandard.Library/1.6.1": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
@@ -1236,6 +1307,13 @@
|
|||||||
"path": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl/4.3.0",
|
"path": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl/4.3.0",
|
||||||
"hashPath": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512"
|
"hashPath": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512"
|
||||||
},
|
},
|
||||||
|
"SharpCompress/0.23.0": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-HBbT47JHvNrsZX2dTBzUBOSzBt+EmIRGLIBkbxcP6Jef7DB4eFWQX5iHWV3Nj7hABFPCjISrZ8s0z72nF2zFHQ==",
|
||||||
|
"path": "sharpcompress/0.23.0",
|
||||||
|
"hashPath": "sharpcompress.0.23.0.nupkg.sha512"
|
||||||
|
},
|
||||||
"System.AppContext/4.3.0": {
|
"System.AppContext/4.3.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"serviceable": true,
|
"serviceable": true,
|
||||||
@@ -1243,12 +1321,12 @@
|
|||||||
"path": "system.appcontext/4.3.0",
|
"path": "system.appcontext/4.3.0",
|
||||||
"hashPath": "system.appcontext.4.3.0.nupkg.sha512"
|
"hashPath": "system.appcontext.4.3.0.nupkg.sha512"
|
||||||
},
|
},
|
||||||
"System.Buffers/4.3.0": {
|
"System.Buffers/4.4.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"serviceable": true,
|
"serviceable": true,
|
||||||
"sha512": "sha512-ratu44uTIHgeBeI0dE8DWvmXVBSo4u7ozRZZHOMmK/JPpYyo0dAfgSiHlpiObMQ5lEtEyIXA40sKRYg5J6A8uQ==",
|
"sha512": "sha512-Ii2bedd4HVzddupdU35n3ygohUPlNn7MDimBOYcwWNce2NizQ1fCSaQJY1Tzv80aMqOGpVcU4wZr/Xe50xcTwg==",
|
||||||
"path": "system.buffers/4.3.0",
|
"path": "system.buffers/4.4.0",
|
||||||
"hashPath": "system.buffers.4.3.0.nupkg.sha512"
|
"hashPath": "system.buffers.4.4.0.nupkg.sha512"
|
||||||
},
|
},
|
||||||
"System.Collections/4.3.0": {
|
"System.Collections/4.3.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
@@ -1323,10 +1401,17 @@
|
|||||||
"System.Diagnostics.Process/4.1.0": {
|
"System.Diagnostics.Process/4.1.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"serviceable": true,
|
"serviceable": true,
|
||||||
"sha512": "sha512-4dlFhzwmI3hl32P+8c9hnytYtV7Xldhsokm5i7Fvv5PmTS68TQCfsuJrREIyF9N1B8zlsSomp7AVrXLe45kKFQ==",
|
"sha512": "sha512-S2YC+MwpWZ6e7h2lqNce/ubMjD4vf2Ea/uOEncYNH1/fFXaXlKDM9ig/zCE1rR+wwYzE8FXtvj+1Nymh6oZ9bg==",
|
||||||
"path": "system.diagnostics.process/4.1.0",
|
"path": "system.diagnostics.process/4.1.0",
|
||||||
"hashPath": "system.diagnostics.process.4.1.0.nupkg.sha512"
|
"hashPath": "system.diagnostics.process.4.1.0.nupkg.sha512"
|
||||||
},
|
},
|
||||||
|
"System.Diagnostics.TextWriterTraceListener/4.0.0": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-oRsXCz76GDDMrwjMjH6keR9erFIofhGaIMc2d4NykI4rdBEuUP5ZswYA30LGPdyCK7DV4bMBEJL3nJFyAJoS/g==",
|
||||||
|
"path": "system.diagnostics.textwritertracelistener/4.0.0",
|
||||||
|
"hashPath": "system.diagnostics.textwritertracelistener.4.0.0.nupkg.sha512"
|
||||||
|
},
|
||||||
"System.Diagnostics.Tools/4.3.0": {
|
"System.Diagnostics.Tools/4.3.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"serviceable": true,
|
"serviceable": true,
|
||||||
@@ -1337,7 +1422,7 @@
|
|||||||
"System.Diagnostics.TraceSource/4.0.0": {
|
"System.Diagnostics.TraceSource/4.0.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"serviceable": true,
|
"serviceable": true,
|
||||||
"sha512": "sha512-bGUeY5wiCHYSWbYZS3QjbaQ1hNoJ1RQBQMB3E0Cgh6AH//4rXfXIOHKIW46HDOsTEDoNfvFNDXphL5W5B/XMwQ==",
|
"sha512": "sha512-q5bGzzvXVi+dIMiPWRhXZV7r+Os3TEOuRW5LHsAUDGpqJHol8XiLokVpsgAfPqHHNkyx1bbv5lRZqRkRrGZKxQ==",
|
||||||
"path": "system.diagnostics.tracesource/4.0.0",
|
"path": "system.diagnostics.tracesource/4.0.0",
|
||||||
"hashPath": "system.diagnostics.tracesource.4.0.0.nupkg.sha512"
|
"hashPath": "system.diagnostics.tracesource.4.0.0.nupkg.sha512"
|
||||||
},
|
},
|
||||||
@@ -1460,12 +1545,12 @@
|
|||||||
"path": "system.net.primitives/4.3.0",
|
"path": "system.net.primitives/4.3.0",
|
||||||
"hashPath": "system.net.primitives.4.3.0.nupkg.sha512"
|
"hashPath": "system.net.primitives.4.3.0.nupkg.sha512"
|
||||||
},
|
},
|
||||||
"System.Net.Security/4.0.0": {
|
"System.Net.Security/4.3.2": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"serviceable": true,
|
"serviceable": true,
|
||||||
"sha512": "sha512-iavC4j5XrRyX3aXbn23jHHF0NTxw9F+2vi3a94VY4BgfrYm5VQBh8OzU1TkNahTSlcKzjGhEc7ZfTfe4b62J6Q==",
|
"sha512": "sha512-xT2jbYpbBo3ha87rViHoTA6WdvqOAW37drmqyx/6LD8p7HEPT2qgdxoimRzWtPg8Jh4X5G9BV2seeTv4x6FYlA==",
|
||||||
"path": "system.net.security/4.0.0",
|
"path": "system.net.security/4.3.2",
|
||||||
"hashPath": "system.net.security.4.0.0.nupkg.sha512"
|
"hashPath": "system.net.security.4.3.2.nupkg.sha512"
|
||||||
},
|
},
|
||||||
"System.Net.Sockets/4.3.0": {
|
"System.Net.Sockets/4.3.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
@@ -1495,19 +1580,19 @@
|
|||||||
"path": "system.reflection.emit/4.0.1",
|
"path": "system.reflection.emit/4.0.1",
|
||||||
"hashPath": "system.reflection.emit.4.0.1.nupkg.sha512"
|
"hashPath": "system.reflection.emit.4.0.1.nupkg.sha512"
|
||||||
},
|
},
|
||||||
"System.Reflection.Emit.ILGeneration/4.0.1": {
|
"System.Reflection.Emit.ILGeneration/4.3.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"serviceable": true,
|
"serviceable": true,
|
||||||
"sha512": "sha512-Ov6dU8Bu15Bc7zuqttgHF12J5lwSWyTf1S+FJouUXVMSqImLZzYaQ+vRr1rQ0OZ0HqsrwWl4dsKHELckQkVpgA==",
|
"sha512": "sha512-59tBslAk9733NXLrUJrwNZEzbMAcu8k344OYo+wfSVygcgZ9lgBdGIzH/nrg3LYhXceynyvTc8t5/GD4Ri0/ng==",
|
||||||
"path": "system.reflection.emit.ilgeneration/4.0.1",
|
"path": "system.reflection.emit.ilgeneration/4.3.0",
|
||||||
"hashPath": "system.reflection.emit.ilgeneration.4.0.1.nupkg.sha512"
|
"hashPath": "system.reflection.emit.ilgeneration.4.3.0.nupkg.sha512"
|
||||||
},
|
},
|
||||||
"System.Reflection.Emit.Lightweight/4.0.1": {
|
"System.Reflection.Emit.Lightweight/4.3.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"serviceable": true,
|
"serviceable": true,
|
||||||
"sha512": "sha512-sSzHHXueZ5Uh0OLpUQprhr+ZYJrLPA2Cmr4gn0wj9+FftNKXx8RIMKvO9qnjk2ebPYUjZ+F2ulGdPOsvj+MEjA==",
|
"sha512": "sha512-oadVHGSMsTmZsAF864QYN1t1QzZjIcuKU3l2S9cZOwDdDueNTrqq1yRj7koFfIGEnKpt6NjpL3rOzRhs4ryOgA==",
|
||||||
"path": "system.reflection.emit.lightweight/4.0.1",
|
"path": "system.reflection.emit.lightweight/4.3.0",
|
||||||
"hashPath": "system.reflection.emit.lightweight.4.0.1.nupkg.sha512"
|
"hashPath": "system.reflection.emit.lightweight.4.3.0.nupkg.sha512"
|
||||||
},
|
},
|
||||||
"System.Reflection.Extensions/4.3.0": {
|
"System.Reflection.Extensions/4.3.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
@@ -1579,6 +1664,20 @@
|
|||||||
"path": "system.runtime.numerics/4.3.0",
|
"path": "system.runtime.numerics/4.3.0",
|
||||||
"hashPath": "system.runtime.numerics.4.3.0.nupkg.sha512"
|
"hashPath": "system.runtime.numerics.4.3.0.nupkg.sha512"
|
||||||
},
|
},
|
||||||
|
"System.Runtime.Serialization.Formatters/4.3.0": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-KT591AkTNFOTbhZlaeMVvfax3RqhH1EJlcwF50Wm7sfnBLuHiOeZRRKrr1ns3NESkM20KPZ5Ol/ueMq5vg4QoQ==",
|
||||||
|
"path": "system.runtime.serialization.formatters/4.3.0",
|
||||||
|
"hashPath": "system.runtime.serialization.formatters.4.3.0.nupkg.sha512"
|
||||||
|
},
|
||||||
|
"System.Runtime.Serialization.Primitives/4.3.0": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-Wz+0KOukJGAlXjtKr+5Xpuxf8+c8739RI1C+A2BoQZT+wMCCoMDDdO8/4IRHfaVINqL78GO8dW8G2lW/e45Mcw==",
|
||||||
|
"path": "system.runtime.serialization.primitives/4.3.0",
|
||||||
|
"hashPath": "system.runtime.serialization.primitives.4.3.0.nupkg.sha512"
|
||||||
|
},
|
||||||
"System.Security.Claims/4.3.0": {
|
"System.Security.Claims/4.3.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"serviceable": true,
|
"serviceable": true,
|
||||||
@@ -1642,6 +1741,13 @@
|
|||||||
"path": "system.text.encoding/4.3.0",
|
"path": "system.text.encoding/4.3.0",
|
||||||
"hashPath": "system.text.encoding.4.3.0.nupkg.sha512"
|
"hashPath": "system.text.encoding.4.3.0.nupkg.sha512"
|
||||||
},
|
},
|
||||||
|
"System.Text.Encoding.CodePages/4.5.1": {
|
||||||
|
"type": "package",
|
||||||
|
"serviceable": true,
|
||||||
|
"sha512": "sha512-4J2JQXbftjPMppIHJ7IC+VXQ9XfEagN92vZZNoG12i+zReYlim5dMoXFC1Zzg7tsnKDM7JPo5bYfFK4Jheq44w==",
|
||||||
|
"path": "system.text.encoding.codepages/4.5.1",
|
||||||
|
"hashPath": "system.text.encoding.codepages.4.5.1.nupkg.sha512"
|
||||||
|
},
|
||||||
"System.Text.Encoding.Extensions/4.3.0": {
|
"System.Text.Encoding.Extensions/4.3.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"serviceable": true,
|
"serviceable": true,
|
||||||
@@ -1666,7 +1772,7 @@
|
|||||||
"System.Threading.Overlapped/4.3.0": {
|
"System.Threading.Overlapped/4.3.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"serviceable": true,
|
"serviceable": true,
|
||||||
"sha512": "sha512-JpukcZA7kre2gQ7GrhtvZu1xv/LVEG5HV9AajQ3XV7l36T6ICalw/llfkBHeK/eqo8UWpMNqkWGCzzlSuqE6pg==",
|
"sha512": "sha512-JWEtWIoYBHzMmgt2I/1e4FFG6veDL4yzA1Y7iuEY2G+GyZyrzqx/GQlM92M+d81D1cH2dp2KRhbZdQebn8Q+RA==",
|
||||||
"path": "system.threading.overlapped/4.3.0",
|
"path": "system.threading.overlapped/4.3.0",
|
||||||
"hashPath": "system.threading.overlapped.4.3.0.nupkg.sha512"
|
"hashPath": "system.threading.overlapped.4.3.0.nupkg.sha512"
|
||||||
},
|
},
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@ An example of generic repository implementation using the MongoDB C# Sharp 2.0 d
|
|||||||
Now available as a nuget package:
|
Now available as a nuget package:
|
||||||
https://www.nuget.org/packages/MongoDbGenericRepository/
|
https://www.nuget.org/packages/MongoDbGenericRepository/
|
||||||
|
|
||||||
Covered by 200+ integration tests and counting.
|
Covered by 400+ integration tests and counting.
|
||||||
|
|
||||||
The MongoDbGenericRepository is also used in [AspNetCore.Identity.MongoDbCore](https://github.com/alexandre-spieser/AspNetCore.Identity.MongoDbCore).
|
The MongoDbGenericRepository is also used in [AspNetCore.Identity.MongoDbCore](https://github.com/alexandre-spieser/AspNetCore.Identity.MongoDbCore).
|
||||||
|
|
||||||
@@ -40,6 +40,18 @@ Here is an example of repository usage, where the TestRepository is implementing
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
If all your documents have the same type of `Id`, you can use the more specific `BaseMongoRepository<TKey>` where `TKey` is the type of the `Id` of your documents.
|
||||||
|
```csharp
|
||||||
|
public class TestTKeyRepository<TKey> : BaseMongoRepository<TKey>, ITestRepository<TKey> where TKey : IEquatable<TKey>
|
||||||
|
{
|
||||||
|
const string connectionString = "mongodb://localhost:27017/MongoDbTests";
|
||||||
|
private static readonly ITestRepository<TKey> _instance = new TestTKeyRepository<TKey>(connectionString);
|
||||||
|
/// <inheritdoc />
|
||||||
|
private TestTKeyRepository(string connectionString) : base(connectionString)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Instantiation
|
## Instantiation
|
||||||
|
|
||||||
@@ -47,6 +59,7 @@ The repository can be instantiated like so:
|
|||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
ITestRepository testRepository = new TestRepository(connectionString, "MongoDbTests");
|
ITestRepository testRepository = new TestRepository(connectionString, "MongoDbTests");
|
||||||
|
ITestRepository<TKey> testTKeyRepository = new TestTKeyRepository<TKey>(connectionString);
|
||||||
```
|
```
|
||||||
|
|
||||||
If you prefer to reuse the same MongoDb database across your application, you can use the `MongoDatabase` from the MongoDb driver implementing the `IMongoDatabase` interface:
|
If you prefer to reuse the same MongoDb database across your application, you can use the `MongoDatabase` from the MongoDb driver implementing the `IMongoDatabase` interface:
|
||||||
@@ -145,7 +158,7 @@ It is now possible to change the collection name by using the `CollectionName` a
|
|||||||
Documents of this type will be inserted into a collection named "MyCollectionName".
|
Documents of this type will be inserted into a collection named "MyCollectionName".
|
||||||
|
|
||||||
## Index Management
|
## Index Management
|
||||||
From version 1.3.8 the `MongoDbGenericRepository` implements the `IMongoDbCollectionIndexRepository` interface.
|
From version 1.3.8 the `MongoDbGenericRepository` implements the `IBaseMongoRepository_Index` and `IBaseMongoRepository_Index<TKey>` interfaces.
|
||||||
This exposes the functionality to programmatically manage indexes against your collections in a generic fashion.
|
This exposes the functionality to programmatically manage indexes against your collections in a generic fashion.
|
||||||
|
|
||||||
The following methods are exposed and fully integration tested:
|
The following methods are exposed and fully integration tested:
|
||||||
|
|||||||
Reference in New Issue
Block a user