Compare commits

...

13 Commits

Author SHA1 Message Date
alexandre-spieser e41a73f745 1.3.7 release 2018-09-09 18:55:53 +01:00
alexandre-spieser 526adf0a23 remove unused using statements 2018-09-09 13:31:42 +01:00
alexandre-spieser db4061dc3c cleanup. Removing redundant GetCollection and Drop collection method, removed static constructor, added a virtual initialization method. 2018-09-09 13:05:45 +01:00
alexandre-spieser 72ea6e7999 clean up + full support for bulk insertion and deletion of documents of the same type but with different partitionkey values 2018-09-09 12:14:43 +01:00
alexandre-spieser 7f126a098d support insertion of documents with different PartitionKey values 2018-09-03 21:46:30 +01:00
alexandre-spieser 456af09a84 + Upgraded packages
+ Added GetByMax, GetByMaxAsync, GetByMin, GetByMinAsync, GetMaxValue and GetMaxValueAsync Methods (GetMinValue and GetMinValueAsync will come in another PR)
+ Added tests
2018-08-05 21:10:41 +01:00
Alexandre SPIESER f0af32adca Update copyright year to 2018 2018-05-11 22:53:43 +01:00
alexandre-spieser 345fca2e6e Added summary where needed. 2018-03-06 23:11:33 +00:00
alexandre-spieser 57d332ef2a Add support for ObjectId type for the Id of the document. 2018-03-05 23:07:56 +00:00
Alexandre SPIESER 2f6515a809 Merge pull request #3 from alexandre-spieser/add-license-1
Create LICENSE
2018-02-24 12:22:58 +00:00
Alexandre SPIESER 82dc2f2024 Create LICENSE 2018-02-24 12:22:49 +00:00
Alexandre SPIESER bc992e8c61 Update README.md 2018-02-16 15:11:09 +00:00
Alexandre SPIESER 47e85f1760 Update README.md 2018-02-16 15:10:18 +00:00
36 changed files with 2551 additions and 374 deletions
+22
View File
@@ -0,0 +1,22 @@
using CoreIntegrationTests.Infrastructure;
using MongoDB.Bson;
using System;
namespace CoreIntegrationTests
{
public class CoreObjectIdTestDocument : TestDoc<ObjectId>
{
}
public class CRUDObjectIdTests : MongoDbTKeyDocumentTestBase<CoreObjectIdTestDocument, ObjectId>
{
public CRUDObjectIdTests(MongoDbTestFixture<CoreObjectIdTestDocument, ObjectId> fixture) : base(fixture)
{
}
public override string GetClassName()
{
return "CRUDObjectIdTests";
}
}
}
@@ -18,7 +18,6 @@ namespace CoreIntegrationTests
{
public CRUDPartitionedTests(MongoDbTestFixture<CorePartitionedDoc, Guid> fixture) : base(fixture)
{
}
public override string GetClassName()
@@ -5,14 +5,14 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.0.1" />
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="2.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
<PackageReference Include="MongoDB.Driver" Version="2.5.0" />
<PackageReference Include="MongoDbGenericRepository" Version="1.3.5" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.console" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity" 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.7.0" />
<PackageReference Include="MongoDbGenericRepository" Version="1.3.7" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.console" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta4-build3742" />
</ItemGroup>
+1 -1
View File
@@ -6,7 +6,7 @@ using Xunit;
using Microsoft.AspNetCore.Identity;
using System.Threading.Tasks;
namespace CoreCoreIntegrationTests
namespace CoreIntegrationTests
{
public class MongoIdentityUser<TKey> : IdentityUser<TKey>, IDocument<TKey>
where TKey : IEquatable<TKey>
@@ -1,6 +1,4 @@
using CoreCoreIntegrationTests;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Conventions;
using MongoDB.Bson.Serialization.Conventions;
using System.Threading;
namespace CoreIntegrationTests.Infrastructure
@@ -106,6 +106,32 @@ namespace CoreIntegrationTests.Infrastructure
Assert.True (2 == count, GetTestName());
}
[Fact]
public void AddManyWithDifferentPartitionKey()
{
// only run this test for tests on documents with partition key
if (!string.IsNullOrEmpty(PartitionKey))
{
// Arrange
var documents = new List<T> { new T(), new T(), new T(), new T() };
if(documents.Any(e => e is IPartitionedDocument))
{
var secondPartitionKey = $"{PartitionKey}-2";
((IPartitionedDocument)documents[2]).PartitionKey = secondPartitionKey;
((IPartitionedDocument)documents[3]).PartitionKey = secondPartitionKey;
// Act
SUT.AddMany<T>(documents);
// Assert
long count = SUT.Count<T>(e => e.Id.Equals(documents[0].Id) || e.Id.Equals(documents[1].Id), PartitionKey);
long secondPartitionCount = SUT.Count<T>(e => e.Id.Equals(documents[2].Id) || e.Id.Equals(documents[3].Id), secondPartitionKey);
// Cleanup second partition
SUT.DeleteMany<T>(e => e.Id.Equals(documents[2].Id) || e.Id.Equals(documents[3].Id), secondPartitionKey);
Assert.True(2 == count, GetTestName());
Assert.True(2 == secondPartitionCount, GetTestName());
}
}
}
[Fact]
public async Task AddManyAsync()
{
@@ -121,6 +147,31 @@ namespace CoreIntegrationTests.Infrastructure
Assert.True (2 == count, GetTestName());
}
[Fact]
public async Task AddManyAsyncWithDifferentPartitionKey()
{
// only run this test for tests on documents with partition key
if (!string.IsNullOrEmpty(PartitionKey))
{
// Arrange
var documents = new List<T> { new T(), new T(), new T(), new T() };
if (documents.Any(e => e is IPartitionedDocument))
{
var secondPartitionKey = $"{PartitionKey}-2";
((IPartitionedDocument)documents[2]).PartitionKey = secondPartitionKey;
((IPartitionedDocument)documents[3]).PartitionKey = secondPartitionKey;
// Act
await SUT.AddManyAsync<T>(documents);
// Assert
long count = SUT.Count<T>(e => e.Id.Equals(documents[0].Id) || e.Id.Equals(documents[1].Id), PartitionKey);
long secondPartitionCount = SUT.Count<T>(e => e.Id.Equals(documents[2].Id) || e.Id.Equals(documents[3].Id), secondPartitionKey);
// Cleanup second partition
SUT.DeleteMany<T>(e => e.Id.Equals(documents[2].Id) || e.Id.Equals(documents[3].Id), secondPartitionKey);
Assert.True(2 == count, GetTestName());
Assert.True(2 == secondPartitionCount, GetTestName());
}
}
}
#endregion Add
@@ -523,12 +574,25 @@ namespace CoreIntegrationTests.Infrastructure
var criteria = $"{GetTestName()}.{DocumentTypeName}";
var documents = CreateTestDocuments(5);
documents.ForEach(e => e.SomeContent = criteria);
var canPartition = !string.IsNullOrEmpty(PartitionKey) && documents.Any(e => e is IPartitionedDocument);
string secondKey = null;
if (canPartition)
{
secondKey = $"{PartitionKey}-2";
((IPartitionedDocument)documents[3]).PartitionKey = secondKey;
((IPartitionedDocument)documents[4]).PartitionKey = secondKey;
}
SUT.AddMany<T>(documents);
// Act
var result = await SUT.DeleteManyAsync<T>(documents);
// Assert
Assert.True(5 == result);
Assert.False(SUT.Any<T>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
if (canPartition)
{
Assert.False(SUT.Any<T>(e => e.SomeContent == criteria, secondKey), GetTestName());
}
}
[Fact]
@@ -553,12 +617,25 @@ namespace CoreIntegrationTests.Infrastructure
var criteria = $"{GetTestName()}.{DocumentTypeName}";
var documents = CreateTestDocuments(5);
documents.ForEach(e => e.SomeContent = criteria);
var canPartition = !string.IsNullOrEmpty(PartitionKey) && documents.Any(e => e is IPartitionedDocument);
string secondKey = null;
if (canPartition)
{
secondKey = $"{PartitionKey}-2";
((IPartitionedDocument)documents[3]).PartitionKey = secondKey;
((IPartitionedDocument)documents[4]).PartitionKey = secondKey;
}
SUT.AddMany<T>(documents);
// Act
var result = SUT.DeleteMany<T>(documents);
// Assert
Assert.True(5 == result);
Assert.False(SUT.Any<T>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
if (canPartition)
{
Assert.False(SUT.Any<T>(e => e.SomeContent == criteria, secondKey), GetTestName());
}
}
#endregion Delete
@@ -679,7 +756,188 @@ namespace CoreIntegrationTests.Infrastructure
#endregion Project
#region Max / Min Queries
[Fact]
public async Task GetByMaxAsync()
{
// Arrange
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5);
var i = 1;
documents.ForEach(e => {
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
SUT.AddMany<T>(documents);
var expectedMax = documents.OrderByDescending(e => e.Nested.SomeDate).First();
// Act
var result = await SUT.GetByMaxAsync<T>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);
// Assert
Assert.NotNull(result);
Assert.Equal(expectedMax.Id, result.Id);
}
[Fact]
public void GetByMax()
{
// Arrange
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5);
var i = 1;
documents.ForEach(e => {
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
SUT.AddMany<T>(documents);
var expectedMax = documents.OrderByDescending(e => e.Nested.SomeDate).First();
// Act
var result = SUT.GetByMax<T>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);
// Assert
Assert.NotNull(result);
Assert.Equal(expectedMax.Id, result.Id);
}
[Fact]
public async Task GetByMinAsync()
{
// Arrange
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5);
var i = 1;
documents.ForEach(e => {
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
SUT.AddMany<T>(documents);
var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();
// Act
var result = await SUT.GetByMinAsync<T>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);
// Assert
Assert.NotNull(result);
Assert.Equal(expectedMin.Id, result.Id);
}
[Fact]
public void GetByMin()
{
// Arrange
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5);
var i = 1;
documents.ForEach(e => {
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
SUT.AddMany<T>(documents);
var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();
// Act
var result = SUT.GetByMin<T>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);
// Assert
Assert.NotNull(result);
Assert.Equal(expectedMin.Id, result.Id);
}
[Fact]
public void GetMinValue()
{
// Arrange
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5);
var i = 1;
documents.ForEach(e => {
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
SUT.AddMany<T>(documents);
var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();
// Act
var result = SUT.GetMinValue<T, DateTime>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);
// Assert
Assert.True(result != default(DateTime));
Assert.Equal(expectedMin.Nested.SomeDate.Date, result.Date);
}
[Fact]
public async Task GetMinValueAsync()
{
// Arrange
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5);
var i = 1;
documents.ForEach(e => {
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
SUT.AddMany<T>(documents);
var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();
// Act
var result = await SUT.GetMinValueAsync<T, DateTime>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);
// Assert
Assert.True(result != default(DateTime));
Assert.Equal(expectedMin.Nested.SomeDate.Date, result.Date);
}
[Fact]
public void GetMaxValue()
{
// Arrange
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5);
var i = 1;
documents.ForEach(e => {
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
SUT.AddMany<T>(documents);
var expectedMax = documents.OrderByDescending(e => e.Nested.SomeDate).First();
// Act
var result = SUT.GetMaxValue<T, DateTime>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);
// Assert
Assert.True(result != default(DateTime));
Assert.Equal(expectedMax.Nested.SomeDate.Date, result.Date);
}
[Fact]
public async Task GetMaxValueAsync()
{
// Arrange
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5);
var i = 1;
documents.ForEach(e => {
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
SUT.AddMany<T>(documents);
var expectedMin = documents.OrderByDescending(e => e.Nested.SomeDate).First();
// Act
var result = await SUT.GetMaxValueAsync<T, DateTime>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);
// Assert
Assert.True(result != default(DateTime));
Assert.Equal(expectedMin.Nested.SomeDate.Date, result.Date);
}
#endregion Max / Min Queries
#region Test Utils
[MethodImpl(MethodImplOptions.NoInlining)]
private string GetCurrentMethod()
{
@@ -107,6 +107,32 @@ namespace CoreIntegrationTests.Infrastructure
Assert.True (2 == count, GetTestName());
}
[Fact]
public void AddManyWithDifferentPartitionKey()
{
// only run this test for tests on documents with partition key
if (!string.IsNullOrEmpty(PartitionKey))
{
// Arrange
var documents = new List<T> { new T(), new T(), new T(), new T() };
if (documents.Any(e => e is IPartitionedDocument))
{
var secondPartitionKey = $"{PartitionKey}-2";
((IPartitionedDocument)documents[2]).PartitionKey = secondPartitionKey;
((IPartitionedDocument)documents[3]).PartitionKey = secondPartitionKey;
// Act
SUT.AddMany<T, TKey>(documents);
// Assert
long count = SUT.Count<T, TKey>(e => e.Id.Equals(documents[0].Id) || e.Id.Equals(documents[1].Id), PartitionKey);
long secondPartitionCount = SUT.Count<T, TKey>(e => e.Id.Equals(documents[2].Id) || e.Id.Equals(documents[3].Id), secondPartitionKey);
// Cleanup second partition
SUT.DeleteMany<T, TKey>(e => e.Id.Equals(documents[2].Id) || e.Id.Equals(documents[3].Id), secondPartitionKey);
Assert.True(2 == count, GetTestName());
Assert.True(2 == secondPartitionCount, GetTestName());
}
}
}
[Fact]
public async Task AddManyAsync()
{
@@ -122,6 +148,31 @@ namespace CoreIntegrationTests.Infrastructure
Assert.True (2 == count, GetTestName());
}
[Fact]
public async Task AddManyAsyncWithDifferentPartitionKey()
{
// only run this test for tests on documents with partition key
if (!string.IsNullOrEmpty(PartitionKey))
{
// Arrange
var documents = new List<T> { new T(), new T(), new T(), new T() };
if (documents.Any(e => e is IPartitionedDocument))
{
var secondPartitionKey = $"{PartitionKey}-2";
((IPartitionedDocument)documents[2]).PartitionKey = secondPartitionKey;
((IPartitionedDocument)documents[3]).PartitionKey = secondPartitionKey;
// Act
await SUT.AddManyAsync<T, TKey>(documents);
// Assert
long count = SUT.Count<T, TKey>(e => e.Id.Equals(documents[0].Id) || e.Id.Equals(documents[1].Id), PartitionKey);
long secondPartitionCount = SUT.Count<T, TKey>(e => e.Id.Equals(documents[2].Id) || e.Id.Equals(documents[3].Id), secondPartitionKey);
// Cleanup second partition
SUT.DeleteMany<T, TKey>(e => e.Id.Equals(documents[2].Id) || e.Id.Equals(documents[3].Id), secondPartitionKey);
Assert.True(2 == count, GetTestName());
Assert.True(2 == secondPartitionCount, GetTestName());
}
}
}
#endregion Add
@@ -524,12 +575,25 @@ namespace CoreIntegrationTests.Infrastructure
var criteria = $"{GetTestName()}.{DocumentTypeName}";
var documents = CreateTestDocuments(5);
documents.ForEach(e => e.SomeContent = criteria);
var canPartition = !string.IsNullOrEmpty(PartitionKey) && documents.Any(e => e is IPartitionedDocument);
string secondKey = null;
if (canPartition)
{
secondKey = $"{PartitionKey}-2";
((IPartitionedDocument)documents[3]).PartitionKey = secondKey;
((IPartitionedDocument)documents[4]).PartitionKey = secondKey;
}
SUT.AddMany<T, TKey>(documents);
// Act
var result = await SUT.DeleteManyAsync<T, TKey>(documents);
// Assert
Assert.True(5 == result);
Assert.False(SUT.Any<T, TKey>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
if (canPartition)
{
Assert.False(SUT.Any<T, TKey>(e => e.SomeContent == criteria, secondKey), GetTestName());
}
}
[Fact]
@@ -554,12 +618,25 @@ namespace CoreIntegrationTests.Infrastructure
var criteria = $"{GetTestName()}.{DocumentTypeName}";
var documents = CreateTestDocuments(5);
documents.ForEach(e => e.SomeContent = criteria);
var canPartition = !string.IsNullOrEmpty(PartitionKey) && documents.Any(e => e is IPartitionedDocument);
string secondKey = null;
if (canPartition)
{
secondKey = $"{PartitionKey}-2";
((IPartitionedDocument)documents[3]).PartitionKey = secondKey;
((IPartitionedDocument)documents[4]).PartitionKey = secondKey;
}
SUT.AddMany<T, TKey>(documents);
// Act
var result = SUT.DeleteMany<T, TKey>(documents);
// Assert
Assert.True(5 == result);
Assert.False(SUT.Any<T, TKey>(e => e.SomeContent == criteria, PartitionKey), GetTestName());
if (canPartition)
{
Assert.False(SUT.Any<T, TKey>(e => e.SomeContent == criteria, secondKey), GetTestName());
}
}
#endregion Delete
@@ -680,6 +757,186 @@ namespace CoreIntegrationTests.Infrastructure
#endregion Project
#region Max / Min Queries
[Fact]
public async Task GetByMaxAsync()
{
// Arrange
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5);
var i = 1;
documents.ForEach(e => {
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
SUT.AddMany<T, TKey>(documents);
var expectedMax = documents.OrderByDescending(e => e.Nested.SomeDate).First();
// Act
var result = await SUT.GetByMaxAsync<T, TKey>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);
// Assert
Assert.NotNull(result);
Assert.Equal(expectedMax.Id, result.Id);
}
[Fact]
public void GetByMax()
{
// Arrange
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5);
var i = 1;
documents.ForEach(e => {
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
SUT.AddMany<T, TKey>(documents);
var expectedMax = documents.OrderByDescending(e => e.Nested.SomeDate).First();
// Act
var result = SUT.GetByMax<T, TKey>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);
// Assert
Assert.NotNull(result);
Assert.Equal(expectedMax.Id, result.Id);
}
[Fact]
public void GetMaxValue()
{
// Arrange
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5);
var i = 1;
documents.ForEach(e => {
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
SUT.AddMany<T, TKey>(documents);
var expectedMax = documents.OrderByDescending(e => e.Nested.SomeDate).First();
// Act
var result = SUT.GetMaxValue<T, TKey, DateTime>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);
// Assert
Assert.False(result == default(DateTime));
Assert.Equal(expectedMax.Nested.SomeDate.Date, result.Date);
}
[Fact]
public async Task GetMaxValueAsync()
{
// Arrange
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5);
var i = 1;
documents.ForEach(e => {
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
SUT.AddMany<T, TKey>(documents);
var expectedMax = documents.OrderByDescending(e => e.Nested.SomeDate).First();
// Act
var result = await SUT.GetMaxValueAsync<T, TKey, DateTime>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);
// Assert
Assert.False(result == default(DateTime));
Assert.Equal(expectedMax.Nested.SomeDate.Date, result.Date);
}
[Fact]
public async Task GetByMinAsync()
{
// Arrange
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5);
var i = 1;
documents.ForEach(e => {
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
SUT.AddMany<T, TKey>(documents);
var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();
// Act
var result = await SUT.GetByMinAsync<T, TKey>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);
// Assert
Assert.NotNull(result);
Assert.Equal(expectedMin.Id, result.Id);
}
[Fact]
public void GetByMin()
{
// Arrange
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5);
var i = 1;
documents.ForEach(e => {
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
SUT.AddMany<T, TKey>(documents);
var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();
// Act
var result = SUT.GetByMin<T, TKey>(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);
// Assert
Assert.NotNull(result);
Assert.Equal(expectedMin.Id, result.Id);
}
[Fact]
public void GetMinValue()
{
// Arrange
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5);
var i = 1;
documents.ForEach(e => {
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
SUT.AddMany<T, TKey>(documents);
var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();
// Act
var result = SUT.GetMinValue< T, TKey, DateTime >(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);
// Assert
Assert.True(result != default(DateTime));
Assert.Equal(expectedMin.Nested.SomeDate.Date, result.Date);
}
[Fact]
public async Task GetMinValueAsync()
{
// Arrange
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5);
var i = 1;
documents.ForEach(e => {
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria;
});
SUT.AddMany<T, TKey>(documents);
var expectedMin = documents.OrderBy(e => e.Nested.SomeDate).First();
// Act
var result = await SUT.GetMinValueAsync< T, TKey, DateTime >(e => e.SomeContent == criteria, e => e.Nested.SomeDate, PartitionKey);
// Assert
Assert.True(result != default(DateTime));
Assert.Equal(expectedMin.Nested.SomeDate.Date, result.Date);
}
#endregion Max / Min Queries
#region Test Utils
[MethodImpl(MethodImplOptions.NoInlining)]
private string GetCurrentMethod()
@@ -1,5 +1,6 @@
using MongoDB.Bson.Serialization.Attributes;
using MongoDbGenericRepository.Models;
using MongoDbGenericRepository.Utils;
using System;
using System.Collections.Generic;
@@ -46,6 +47,8 @@ namespace CoreIntegrationTests.Infrastructure
Children = new List<Child>();
}
public int SomeValue { get; set; }
public string SomeContent { get; set; }
public int GroupingKey { get; set; }
@@ -82,22 +85,7 @@ namespace CoreIntegrationTests.Infrastructure
public TId Init<TId>()
{
var idTypeName = typeof(TKey).Name;
switch (idTypeName)
{
case "Guid":
return (TId)(object)Guid.NewGuid();
case "Int16":
return (TId)(object)GlobalVariables.Random.Next(1, short.MaxValue);
case "Int32":
return (TId)(object)GlobalVariables.Random.Next(1, int.MaxValue);
case "Int64":
return (TId)(object)(GlobalVariables.Random.NextLong(1, long.MaxValue));
case "String":
return (TId)(object)Guid.NewGuid().ToString();
default:
throw new NotSupportedException($"{idTypeName} is not supported.");
}
return IdGenerator.GetId<TId>();
}
private void InitializeFields()
+19
View File
@@ -0,0 +1,19 @@
using IntegrationTests.Infrastructure;
using MongoDB.Bson;
using NUnit.Framework;
namespace IntegrationTests
{
public class ObjectIdTestDocument : TestDoc<ObjectId>
{
}
[TestFixture]
public class CRUDObjectIdTests : MongoDbTKeyDocumentTestBase<ObjectIdTestDocument, ObjectId>
{
public override string GetClassName()
{
return "CRUDObjectIdTests";
}
}
}
+2 -16
View File
@@ -1,5 +1,6 @@
using MongoDB.Bson.Serialization.Attributes;
using MongoDbGenericRepository.Models;
using MongoDbGenericRepository.Utils;
using System;
using System.Collections.Generic;
@@ -82,22 +83,7 @@ namespace IntegrationTests.Infrastructure
public TId Init<TId>()
{
var idTypeName = typeof(TKey).Name;
switch (idTypeName)
{
case "Guid":
return (TId)(object)Guid.NewGuid();
case "Int16":
return (TId)(object)GlobalVariables.Random.Next(1, short.MaxValue);
case "Int32":
return (TId)(object)GlobalVariables.Random.Next(1, int.MaxValue);
case "Int64":
return (TId)(object)(GlobalVariables.Random.NextLong(1, long.MaxValue));
case "String":
return (TId)(object)Guid.NewGuid().ToString();
default:
throw new NotSupportedException($"{idTypeName} is not supported.");
}
return IdGenerator.GetId<TId>();
}
private void InitializeFields()
@@ -1,4 +1,9 @@
using MongoDbGenericRepository;
using MongoDB.Driver;
using MongoDbGenericRepository;
using MongoDbGenericRepository.Models;
using System;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace IntegrationTests.Infrastructure
{
@@ -18,5 +23,20 @@ namespace IntegrationTests.Infrastructure
{
MongoDbContext.DropCollection<TDocument>(partitionKey);
}
/// <summary>
/// Gets the max of a property in a mongodb collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <returns></returns>
public async Task<TDocument> GetByMaxAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending)
where TDocument : IDocument<TKey>
where TKey : System.IEquatable<TKey>
{
return await GetCollection<TDocument, TKey>().Find(Builders<TDocument>.Filter.Where(filter))
.SortByDescending(orderByDescending)
.FirstOrDefaultAsync();
}
}
}
+11 -11
View File
@@ -31,36 +31,36 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="DnsClient, Version=1.0.7.0, Culture=neutral, PublicKeyToken=4574bb5573c51424, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDbGenericRepository.1.3.5\lib\net45\DnsClient.dll</HintPath>
<HintPath>..\packages\MongoDbGenericRepository.1.3.7\lib\net45\DnsClient.dll</HintPath>
</Reference>
<Reference Include="MongoDB.Bson, Version=2.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDbGenericRepository.1.3.5\lib\net45\MongoDB.Bson.dll</HintPath>
<Reference Include="MongoDB.Bson, Version=2.7.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDbGenericRepository.1.3.7\lib\net45\MongoDB.Bson.dll</HintPath>
</Reference>
<Reference Include="MongoDB.Driver, Version=2.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDbGenericRepository.1.3.5\lib\net45\MongoDB.Driver.dll</HintPath>
<Reference Include="MongoDB.Driver, Version=2.7.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDbGenericRepository.1.3.7\lib\net45\MongoDB.Driver.dll</HintPath>
</Reference>
<Reference Include="MongoDB.Driver.Core, Version=2.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDbGenericRepository.1.3.5\lib\net45\MongoDB.Driver.Core.dll</HintPath>
<Reference Include="MongoDB.Driver.Core, Version=2.7.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDbGenericRepository.1.3.7\lib\net45\MongoDB.Driver.Core.dll</HintPath>
</Reference>
<Reference Include="MongoDbGenericRepository, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDbGenericRepository.1.3.5\lib\net45\MongoDbGenericRepository.dll</HintPath>
<HintPath>..\packages\MongoDbGenericRepository.1.3.7\lib\net45\MongoDbGenericRepository.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.9.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.9.0\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDbGenericRepository.1.3.5\lib\net45\System.Buffers.dll</HintPath>
<HintPath>..\packages\MongoDbGenericRepository.1.3.7\lib\net45\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDbGenericRepository.1.3.5\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
<Private>True</Private>
<HintPath>..\packages\MongoDbGenericRepository.1.3.7\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CRUDObjectIdTests.cs" />
<Compile Include="CRUDPartitionedTests.cs" />
<Compile Include="CRUDTKeyPartitionedCollectionNameAttributeTests.cs" />
<Compile Include="CRUDTests.cs" />
+4 -4
View File
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DnsClient" version="1.0.7" targetFramework="net461" />
<package id="MongoDB.Bson" version="2.5.0" targetFramework="net461" />
<package id="MongoDB.Driver" version="2.5.0" targetFramework="net461" />
<package id="MongoDB.Driver.Core" version="2.5.0" targetFramework="net461" />
<package id="MongoDbGenericRepository" version="1.3.5" targetFramework="net461" />
<package id="MongoDB.Bson" version="2.7.0" targetFramework="net461" />
<package id="MongoDB.Driver" version="2.7.0" targetFramework="net461" />
<package id="MongoDB.Driver.Core" version="2.7.0" targetFramework="net461" />
<package id="MongoDbGenericRepository" version="1.3.7" targetFramework="net461" />
<package id="NUnit" version="3.9.0" targetFramework="net461" />
<package id="NUnit.ConsoleRunner" version="3.7.0" targetFramework="net461" />
<package id="System.Buffers" version="4.3.0" targetFramework="net461" />
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 Alexandre SPIESER
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -167,6 +167,7 @@ namespace MongoDbGenericRepository
/// <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, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
where TDocument : IDocument;
@@ -183,11 +184,11 @@ namespace MongoDbGenericRepository
/// 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, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
where TDocument : IDocument;
@@ -255,6 +256,7 @@ namespace MongoDbGenericRepository
/// <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>;
@@ -281,6 +283,7 @@ namespace MongoDbGenericRepository
/// <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>;
@@ -24,29 +24,13 @@ namespace MongoDbGenericRepository
/// </summary>
/// <typeparam name="TDocument"></typeparam>
/// <param name="partitionKey">The value of the partition key.</param>
IMongoCollection<TDocument> GetCollection<TDocument>(string partitionKey = null) where TDocument : IDocument;
/// <summary>
/// Returns a collection for a document type that has a partition key.
/// </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="partitionKey">The value of the partition key.</param>
IMongoCollection<TDocument> GetCollection<TDocument, TKey>(string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Drops a collection, use very carefully.
/// </summary>
/// <typeparam name="TDocument"></typeparam>
void DropCollection<TDocument>();
IMongoCollection<TDocument> GetCollection<TDocument>(string partitionKey = null);
/// <summary>
/// Drops a collection having a partitionkey, use very carefully.
/// </summary>
/// <typeparam name="TDocument"></typeparam>
void DropCollection<TDocument>(string partitionKey);
void DropCollection<TDocument>(string partitionKey = null);
/// <summary>
/// Sets the Guid representation of the MongoDb Driver.
@@ -159,7 +159,6 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Returns a collection cursor.
/// </summary>
@@ -239,6 +238,193 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey>;
#endregion
#region Min / Max
/// <summary>
/// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByDescending">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
Task<TDocument> GetByMaxAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, string partitionKey = null)
where TDocument : IDocument;
/// <summary>
/// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByDescending">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
/// <returns></returns>
TDocument GetByMax<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, string partitionKey = null)
where TDocument : IDocument;
/// <summary>
/// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByAscending">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
Task<TDocument> GetByMinAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByAscending, string partitionKey = null)
where TDocument : IDocument;
/// <summary>
/// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByAscending">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
TDocument GetByMin<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByAscending, string partitionKey = null)
where TDocument : IDocument;
/// <summary>
/// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByAscending">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
Task<TDocument> GetByMaxAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByAscending">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
TDocument GetByMax<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByDescending, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByAscending">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
Task<TDocument> GetByMinAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByAscending, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByAscending">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
TDocument GetByMin<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByAscending, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TValue">The type of the value used to order the query.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
Task<TValue> GetMaxValueAsync<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey = null)
where TDocument : IDocument;
/// <summary>
/// Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByAscending">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TValue">The type of the value used to order the query.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
TValue GetMaxValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey = null)
where TDocument : IDocument;
/// <summary>
/// Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByAscending">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
TValue GetMaxValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> orderByDescending, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TValue">The type of the value used to order the query.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param>
Task<TValue> GetMinValueAsync<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey = null)
where TDocument : IDocument;
/// <summary>
/// Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <typeparam name="TValue">The type of the value used to order the query.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param>
Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TValue">The type of the value used to order the query.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param>
TValue GetMinValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey = null)
where TDocument : IDocument;
/// <summary>
/// Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <typeparam name="TValue">The type of the value used to order the query.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param>
TValue GetMinValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
#endregion
}
}
@@ -17,6 +17,10 @@ namespace MongoDbGenericRepository.Attributes
/// </summary>
public string Name { get; set; }
/// <summary>
/// The constructor.
/// </summary>
/// <param name="name">The name of the collection.</param>
public CollectionNameAttribute(string name)
{
this.Name = name;
@@ -15,7 +15,6 @@ namespace MongoDbGenericRepository
/// </summary>
public abstract class BaseMongoRepository : ReadOnlyMongoRepository, IBaseMongoRepository
{
private static readonly Random Random = new Random();
/// <summary>
/// The constructor taking a connection string and a database name.
@@ -83,11 +82,22 @@ namespace MongoDbGenericRepository
{
return;
}
foreach (var doc in documents)
foreach (var document in documents)
{
FormatDocument(doc);
FormatDocument(document);
}
// cannot use typeof(IPartitionedDocument).IsAssignableFrom(typeof(TDocument)), not available in netstandard 1.5
if (documents.Any(e => e is IPartitionedDocument))
{
foreach (var group in documents.GroupBy(e => ((IPartitionedDocument)e).PartitionKey))
{
await HandlePartitioned(group.FirstOrDefault()).InsertManyAsync(group.ToList());
}
}
else
{
await GetCollection<TDocument>().InsertManyAsync(documents.ToList());
}
await HandlePartitioned(documents.FirstOrDefault()).InsertManyAsync(documents);
}
/// <summary>
@@ -106,7 +116,18 @@ namespace MongoDbGenericRepository
{
FormatDocument(document);
}
HandlePartitioned(documents.FirstOrDefault()).InsertMany(documents.ToList());
// cannot use typeof(IPartitionedDocument).IsAssignableFrom(typeof(TDocument)), not available in netstandard 1.5
if (documents.Any(e => e is IPartitionedDocument))
{
foreach (var group in documents.GroupBy(e => ((IPartitionedDocument)e).PartitionKey))
{
HandlePartitioned(group.FirstOrDefault()).InsertMany(group.ToList());
}
}
else
{
GetCollection<TDocument>().InsertMany(documents.ToList());
}
}
#endregion Create
@@ -158,11 +179,22 @@ namespace MongoDbGenericRepository
{
return;
}
foreach (var doc in documents)
foreach (var document in documents)
{
FormatDocument<TDocument, TKey>(doc);
FormatDocument<TDocument, TKey>(document);
}
// cannot use typeof(IPartitionedDocument).IsAssignableFrom(typeof(TDocument)), not available in netstandard 1.5
if (documents.Any(e => e is IPartitionedDocument))
{
foreach (var group in documents.GroupBy(e => ((IPartitionedDocument)e).PartitionKey))
{
await HandlePartitioned<TDocument, TKey>(group.FirstOrDefault()).InsertManyAsync(group.ToList());
}
}
else
{
await GetCollection<TDocument, TKey>().InsertManyAsync(documents.ToList());
}
await HandlePartitioned<TDocument, TKey>(documents.FirstOrDefault()).InsertManyAsync(documents);
}
/// <summary>
@@ -184,7 +216,18 @@ namespace MongoDbGenericRepository
{
FormatDocument<TDocument, TKey>(document);
}
HandlePartitioned<TDocument, TKey>(documents.FirstOrDefault()).InsertMany(documents.ToList());
// cannot use typeof(IPartitionedDocument).IsAssignableFrom(typeof(TDocument)), not available in netstandard 1.5
if (documents.Any(e => e is IPartitionedDocument))
{
foreach (var group in documents.GroupBy(e => ((IPartitionedDocument)e).PartitionKey))
{
HandlePartitioned<TDocument, TKey>(group.FirstOrDefault()).InsertMany(group.ToList());
}
}
else
{
GetCollection<TDocument, TKey>().InsertMany(documents.ToList());
}
}
@@ -285,6 +328,7 @@ namespace MongoDbGenericRepository
/// <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>
public virtual bool UpdateOne<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
where TDocument : IDocument
{
@@ -314,11 +358,11 @@ namespace MongoDbGenericRepository
/// 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>
public virtual async Task<bool> UpdateOneAsync<TDocument, TField>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TField>> field, TField value, string partitionKey = null)
where TDocument : IDocument
{
@@ -471,13 +515,12 @@ namespace MongoDbGenericRepository
/// <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>
public virtual async 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>
{
var collection = string.IsNullOrEmpty(partitionKey) ? GetCollection<TDocument, TKey>() : GetCollection<TDocument, TKey>(partitionKey);
var updateRes = await collection.UpdateOneAsync(Builders<TDocument>.Filter.Where(filter), Builders<TDocument>.Update.Set(field, value));
return updateRes.ModifiedCount == 1;
return await UpdateOneAsync<TDocument, TKey, TField>(Builders<TDocument>.Filter.Where(filter), field, value, partitionKey);
}
/// <summary>
@@ -508,13 +551,12 @@ namespace MongoDbGenericRepository
/// <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>
public virtual 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>
{
var collection = string.IsNullOrEmpty(partitionKey) ? GetCollection<TDocument, TKey>() : GetCollection<TDocument, TKey>(partitionKey);
var updateRes = collection.UpdateOne(Builders<TDocument>.Filter.Where(filter), Builders<TDocument>.Update.Set(field, value));
return updateRes.ModifiedCount == 1;
return UpdateOne<TDocument, TKey, TField>(Builders<TDocument>.Filter.Where(filter), field, value, partitionKey);
}
#endregion Update
@@ -529,7 +571,7 @@ namespace MongoDbGenericRepository
/// <returns>The number of documents deleted.</returns>
public virtual async Task<long> DeleteOneAsync<TDocument>(TDocument document) where TDocument : IDocument
{
return (await HandlePartitioned(document).DeleteOneAsync(x => x.Id == document.Id)).DeletedCount;
return await DeleteOneAsync<TDocument, Guid>(document);
}
/// <summary>
@@ -540,7 +582,7 @@ namespace MongoDbGenericRepository
/// <returns>The number of documents deleted.</returns>
public virtual long DeleteOne<TDocument>(TDocument document) where TDocument : IDocument
{
return HandlePartitioned(document).DeleteOne(x => x.Id == document.Id).DeletedCount;
return DeleteOne<TDocument, Guid>(document);
}
/// <summary>
@@ -552,7 +594,7 @@ namespace MongoDbGenericRepository
/// <returns>The number of documents deleted.</returns>
public virtual long DeleteOne<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument
{
return HandlePartitioned<TDocument>(partitionKey).DeleteOne(filter).DeletedCount;
return DeleteOne<TDocument, Guid>(filter, partitionKey);
}
/// <summary>
@@ -564,7 +606,7 @@ namespace MongoDbGenericRepository
/// <returns>The number of documents deleted.</returns>
public virtual async Task<long> DeleteOneAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument
{
return (await HandlePartitioned<TDocument>(partitionKey).DeleteOneAsync(filter)).DeletedCount;
return await DeleteOneAsync<TDocument, Guid>(filter, partitionKey);
}
/// <summary>
@@ -587,12 +629,7 @@ namespace MongoDbGenericRepository
/// <returns>The number of documents deleted.</returns>
public virtual async Task<long> DeleteManyAsync<TDocument>(IEnumerable<TDocument> documents) where TDocument : IDocument
{
if (!documents.Any())
{
return 0;
}
var idsTodelete = documents.Select(e => e.Id).ToArray();
return (await HandlePartitioned(documents.FirstOrDefault()).DeleteManyAsync(x => idsTodelete.Contains(x.Id))).DeletedCount;
return await DeleteManyAsync<TDocument, Guid>(documents);
}
/// <summary>
@@ -603,12 +640,7 @@ namespace MongoDbGenericRepository
/// <returns>The number of documents deleted.</returns>
public virtual long DeleteMany<TDocument>(IEnumerable<TDocument> documents) where TDocument : IDocument
{
if (!documents.Any())
{
return 0;
}
var idsTodelete = documents.Select(e => e.Id).ToArray();
return HandlePartitioned(documents.FirstOrDefault()).DeleteMany(x => idsTodelete.Contains(x.Id)).DeletedCount;
return DeleteMany<TDocument, Guid>(documents);
}
/// <summary>
@@ -717,8 +749,22 @@ namespace MongoDbGenericRepository
{
return 0;
}
var idsTodelete = documents.Select(e => e.Id).ToArray();
return (await HandlePartitioned<TDocument, TKey>(documents.FirstOrDefault()).DeleteManyAsync(x => idsTodelete.Contains(x.Id))).DeletedCount;
// cannot use typeof(IPartitionedDocument).IsAssignableFrom(typeof(TDocument)), not available in netstandard 1.5
if (documents.Any(e => e is IPartitionedDocument))
{
long deleteCount = 0;
foreach (var group in documents.GroupBy(e => ((IPartitionedDocument)e).PartitionKey))
{
var groupIdsTodelete = group.Select(e => e.Id).ToArray();
deleteCount += (await HandlePartitioned<TDocument, TKey>(group.FirstOrDefault()).DeleteManyAsync(x => groupIdsTodelete.Contains(x.Id))).DeletedCount;
}
return deleteCount;
}
else
{
var idsTodelete = documents.Select(e => e.Id).ToArray();
return (await HandlePartitioned<TDocument, TKey>(documents.FirstOrDefault()).DeleteManyAsync(x => idsTodelete.Contains(x.Id))).DeletedCount;
}
}
/// <summary>
@@ -736,8 +782,22 @@ namespace MongoDbGenericRepository
{
return 0;
}
var idsTodelete = documents.Select(e => e.Id).ToArray();
return HandlePartitioned<TDocument, TKey>(documents.FirstOrDefault()).DeleteMany(x => idsTodelete.Contains(x.Id)).DeletedCount;
// cannot use typeof(IPartitionedDocument).IsAssignableFrom(typeof(TDocument)), not available in netstandard 1.5
if (documents.Any(e => e is IPartitionedDocument))
{
long deleteCount = 0;
foreach (var group in documents.GroupBy(e => ((IPartitionedDocument)e).PartitionKey))
{
var groupIdsTodelete = group.Select(e => e.Id).ToArray();
deleteCount += (HandlePartitioned<TDocument, TKey>(group.FirstOrDefault()).DeleteMany(x => groupIdsTodelete.Contains(x.Id))).DeletedCount;
}
return deleteCount;
}
else
{
var idsTodelete = documents.Select(e => e.Id).ToArray();
return (HandlePartitioned<TDocument, TKey>(documents.FirstOrDefault()).DeleteMany(x => idsTodelete.Contains(x.Id))).DeletedCount;
}
}
/// <summary>
@@ -1022,26 +1082,6 @@ namespace MongoDbGenericRepository
#endregion Find And Update
private TKey SetIdField<TKey>()
{
var idTypeName = typeof(TKey).Name;
switch (idTypeName)
{
case "Guid":
return (TKey)(object)Guid.NewGuid();
case "Int16":
return (TKey)(object)Random.Next(1, short.MaxValue);
case "Int32":
return (TKey)(object)Random.Next(1, int.MaxValue);
case "Int64":
return (TKey)(object)(Random.NextLong(1, long.MaxValue));
case "String":
return (TKey)(object)Guid.NewGuid().ToString();
}
throw new ArgumentException($"{idTypeName} is not a supported Id type, the Id of the document cannot be set.");
}
/// <summary>
/// Sets the value of the document Id if it is not set already.
/// </summary>
@@ -1061,7 +1101,7 @@ namespace MongoDbGenericRepository
|| (defaultTKey != null
&& defaultTKey.Equals(document.Id)))
{
document.Id = SetIdField<TKey>();
document.Id = IdGenerator.GetId<TKey>();
}
}
+31 -40
View File
@@ -1,8 +1,6 @@
using MongoDB.Driver;
using MongoDbGenericRepository.Attributes;
using MongoDbGenericRepository.Models;
using MongoDbGenericRepository.Utils;
using System;
using System.Linq;
using System.Reflection;
@@ -23,27 +21,33 @@ namespace MongoDbGenericRepository
/// </summary>
public IMongoDatabase Database { get; }
static MongoDbContext()
{
// Avoid legacy UUID representation: use Binary 0x04 subtype.
MongoDefaults.GuidRepresentation = MongoDB.Bson.GuidRepresentation.Standard;
}
/// <summary>
/// Sets the Guid representation of the MongoDb Driver.
/// </summary>
/// <param name="guidRepresentation">The new value of the GuidRepresentation</param>
public void SetGuidRepresentation(MongoDB.Bson.GuidRepresentation guidRepresentation)
public virtual void SetGuidRepresentation(MongoDB.Bson.GuidRepresentation guidRepresentation)
{
MongoDefaults.GuidRepresentation = guidRepresentation;
}
/// <summary>
/// Initialize the Guid representation of the MongoDb Driver.
/// Override this method to change the default GuidRepresentation.
/// </summary>
protected virtual void InitializeGuidRepresentation()
{
// by default, avoid lefacy UUID representation: use Binary 0x04 subtype.
MongoDefaults.GuidRepresentation = MongoDB.Bson.GuidRepresentation.Standard;
}
/// <summary>
/// The constructor of the MongoDbContext, it needs a an object implementing <see cref="IMongoDatabase"/>.
/// </summary>
/// <param name="mongoDatabase">An object implementing IMongoDatabase</param>
public MongoDbContext(IMongoDatabase mongoDatabase)
{
// Avoid legacy UUID representation: use Binary 0x04 subtype.
InitializeGuidRepresentation();
Database = mongoDatabase;
Client = Database.Client;
}
@@ -55,6 +59,7 @@ namespace MongoDbGenericRepository
/// <param name="databaseName">The name of your database.</param>
public MongoDbContext(string connectionString, string databaseName)
{
InitializeGuidRepresentation();
Client = new MongoClient(connectionString);
Database = Client.GetDatabase(databaseName);
}
@@ -72,59 +77,45 @@ namespace MongoDbGenericRepository
}
/// <summary>
/// Returns a collection for a document type that has a partition key.
/// Returns a collection for a document type. Also handles document types with a partition key.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="partitionKey">The value of the partition key.</param>
public IMongoCollection<TDocument> GetCollection<TDocument>(string partitionKey = null) where TDocument : IDocument
/// <param name="partitionKey">The optional value of the partition key.</param>
public IMongoCollection<TDocument> GetCollection<TDocument>(string partitionKey = null)
{
if (string.IsNullOrEmpty(partitionKey))
{
return Database.GetCollection<TDocument>(GetAttributeCollectionName<TDocument>() ?? Pluralize<TDocument>());
}
return Database.GetCollection<TDocument>(partitionKey + "-" + GetAttributeCollectionName<TDocument>() ?? Pluralize<TDocument>());
}
/// <summary>
/// Returns a collection for a document type that has a partition key.
/// </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="partitionKey">The value of the partition key.</param>
public IMongoCollection<TDocument> GetCollection<TDocument, TKey>(string partitionKey)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
if (string.IsNullOrEmpty(partitionKey))
{
return Database.GetCollection<TDocument>(GetAttributeCollectionName<TDocument>() ?? Pluralize<TDocument>());
}
return Database.GetCollection<TDocument>(partitionKey + "-" + GetAttributeCollectionName<TDocument>() ?? Pluralize<TDocument>());
return Database.GetCollection<TDocument>(GetCollectionName<TDocument>(partitionKey));
}
/// <summary>
/// Drops a collection, use very carefully.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
public void DropCollection<TDocument>()
public void DropCollection<TDocument>(string partitionKey = null)
{
Database.DropCollection(GetAttributeCollectionName<TDocument>() ?? Pluralize<TDocument>());
Database.DropCollection(GetCollectionName<TDocument>(partitionKey));
}
/// <summary>
/// Drops a collection having a partitionkey, use very carefully.
/// Given the docmuent type and the partition key, returns the name of the collection it belongs to.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
public void DropCollection<TDocument>(string partitionKey)
/// <param name="partitionKey">The value of the partition key.</param>
/// <returns>The name of the collection.</returns>
private string GetCollectionName<TDocument>(string partitionKey)
{
Database.DropCollection(partitionKey + "-" + GetAttributeCollectionName<TDocument>() ?? Pluralize<TDocument>());
var collectionName = GetAttributeCollectionName<TDocument>() ?? Pluralize<TDocument>();
if (string.IsNullOrEmpty(partitionKey))
{
return collectionName;
}
return $"{partitionKey}-{collectionName}";
}
/// <summary>
/// Very naively pluralizes a TDocument type name.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <returns></returns>
/// <returns>The pluralized document name.</returns>
private string Pluralize<TDocument>()
{
return (typeof(TDocument).Name.Pluralize()).Camelize();
@@ -17,7 +17,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MongoDB.Driver" Version="2.5.0" />
<PackageReference Include="MongoDB.Driver" Version="2.7.0" />
</ItemGroup>
</Project>
@@ -2,7 +2,7 @@
<package >
<metadata>
<id>MongoDbGenericRepository</id>
<version>1.3.5</version>
<version>1.3.7</version>
<title>MongoDb Generic Repository</title>
<authors>Alexandre Spieser</authors>
<owners>Alexandre Spieser</owners>
@@ -10,11 +10,11 @@
<projectUrl>https://github.com/alexandre-spieser/mongodb-generic-repository</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>A generic repository implementation using the MongoDB C# Sharp 2.0 driver.</description>
<releaseNotes>Adding CollectionName attribute to specify alternate collection name (thanks Etchelon).</releaseNotes>
<copyright>Copyright 2017 (c) Alexandre Spieser. All rights reserved.</copyright>
<releaseNotes>Upgraded dependencies. Full support for bulk insertion and deletion of documents of the same type but with different partitionkey values. Added methods for Min and Max queries.</releaseNotes>
<copyright>Copyright 2018 (c) Alexandre Spieser. All rights reserved.</copyright>
<tags>MongoDb Repository Generic NoSql</tags>
<dependencies>
<dependency id="MongoDB.Driver" version="2.5.0" />
<dependency id="MongoDB.Driver" version="2.7.0" />
</dependencies>
</metadata>
<files>
@@ -123,7 +123,7 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param>
public async Task<bool> AnyAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument
{
var count = await HandlePartitioned<TDocument>(partitionKey).CountAsync(filter);
var count = await HandlePartitioned<TDocument>(partitionKey).CountDocumentsAsync(filter);
return (count > 0);
}
@@ -135,7 +135,7 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partition key.</param>
public bool Any<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument
{
var count = HandlePartitioned<TDocument>(partitionKey).Count(filter);
var count = HandlePartitioned<TDocument>(partitionKey).CountDocuments(filter);
return (count > 0);
}
@@ -169,7 +169,7 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partitionKey</param>
public async Task<long> CountAsync<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument
{
return await HandlePartitioned<TDocument>(partitionKey).CountAsync(filter);
return await HandlePartitioned<TDocument>(partitionKey).CountDocumentsAsync(filter);
}
/// <summary>
@@ -180,7 +180,60 @@ namespace MongoDbGenericRepository
/// <param name="partitionKey">An optional partitionKey</param>
public long Count<TDocument>(Expression<Func<TDocument, bool>> filter, string partitionKey = null) where TDocument : IDocument
{
return HandlePartitioned<TDocument>(partitionKey).Find(filter).Count();
return HandlePartitioned<TDocument>(partitionKey).Find(filter).CountDocuments();
}
/// <summary>
/// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
public async Task<TDocument> GetByMaxAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> maxValueSelector, string partitionKey = null)
where TDocument : IDocument
{
return await GetByMaxAsync<TDocument, Guid>(filter, maxValueSelector, partitionKey);
}
/// <summary>
/// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
/// <returns></returns>
public TDocument GetByMax<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> maxValueSelector, string partitionKey = null)
where TDocument : IDocument
{
return GetByMax<TDocument, Guid>(filter, maxValueSelector, partitionKey);
}
/// <summary>
/// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
public async Task<TDocument> GetByMinAsync<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector, string partitionKey = null)
where TDocument : IDocument
{
return await GetByMinAsync<TDocument, Guid>(filter, minValueSelector, partitionKey);
}
/// <summary>
/// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByAscending">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
public TDocument GetByMin<TDocument>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> orderByAscending, string partitionKey = null)
where TDocument : IDocument
{
return GetByMin<TDocument, Guid>(filter, orderByAscending, partitionKey);
}
#endregion
@@ -270,7 +323,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
var count = await HandlePartitioned<TDocument, TKey>(partitionKey).CountAsync(filter);
var count = await HandlePartitioned<TDocument, TKey>(partitionKey).CountDocumentsAsync(filter);
return (count > 0);
}
@@ -285,7 +338,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
var count = HandlePartitioned<TDocument, TKey>(partitionKey).Count(filter);
var count = HandlePartitioned<TDocument, TKey>(partitionKey).CountDocuments(filter);
return (count > 0);
}
@@ -328,7 +381,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return await HandlePartitioned<TDocument, TKey>(partitionKey).CountAsync(filter);
return await HandlePartitioned<TDocument, TKey>(partitionKey).CountDocumentsAsync(filter);
}
/// <summary>
@@ -342,7 +395,239 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return HandlePartitioned<TDocument, TKey>(partitionKey).Find(filter).Count();
return HandlePartitioned<TDocument, TKey>(partitionKey).Find(filter).CountDocuments();
}
/// <summary>
/// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
public async Task<TDocument> GetByMaxAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> maxValueSelector, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return await GetCollection<TDocument, TKey>(partitionKey).Find(Builders<TDocument>.Filter.Where(filter))
.SortByDescending(maxValueSelector)
.Limit(1)
.FirstOrDefaultAsync();
}
/// <summary>
/// Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
public TDocument GetByMax<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> maxValueSelector, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return GetCollection<TDocument, TKey>(partitionKey).Find(Builders<TDocument>.Filter.Where(filter))
.SortByDescending(maxValueSelector)
.Limit(1)
.FirstOrDefault();
}
/// <summary>
/// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
public async Task<TDocument> GetByMinAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return await GetCollection<TDocument, TKey>(partitionKey).Find(Builders<TDocument>.Filter.Where(filter))
.SortBy(minValueSelector)
.Limit(1)
.FirstOrDefaultAsync();
}
/// <summary>
/// Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
public TDocument GetByMin<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, object>> minValueSelector, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return GetCollection<TDocument, TKey>(partitionKey).Find(Builders<TDocument>.Filter.Where(filter))
.SortBy(minValueSelector)
.Limit(1)
.FirstOrDefault();
}
/// <summary>
/// Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <typeparam name="TValue">The type of the value used to order the query.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param>
private IFindFluent<TDocument, TDocument> GetMinMongoQuery<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return GetCollection<TDocument, TKey>(partitionKey).Find(Builders<TDocument>.Filter.Where(filter))
.SortBy(ConvertExpression(minValueSelector))
.Limit(1);
}
/// <summary>
/// Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <typeparam name="TValue">The type of the value used to order the query.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by descending.</param>
/// <param name="partitionKey">An optional partition key.</param>
private IFindFluent<TDocument, TDocument> GetMaxMongoQuery<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return GetCollection<TDocument, TKey>(partitionKey).Find(Builders<TDocument>.Filter.Where(filter))
.SortByDescending(ConvertExpression(maxValueSelector))
.Limit(1);
}
/// <summary>
/// Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TValue">The type of the value used to order the query.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
public async Task<TValue> GetMaxValueAsync<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey = null)
where TDocument : IDocument
{
return await GetMaxValueAsync<TDocument, Guid, TValue>(filter, maxValueSelector, partitionKey);
}
/// <summary>
/// Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="orderByAscending">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
public async Task<TValue> GetMaxValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return await GetMaxMongoQuery<TDocument, TKey, TValue>(filter, maxValueSelector, partitionKey)
.Project(maxValueSelector)
.FirstOrDefaultAsync();
}
/// <summary>
/// Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TValue">The type of the value used to order the query.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
public TValue GetMaxValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey = null)
where TDocument : IDocument
{
return GetMaxValue<TDocument, Guid, TValue>(filter, maxValueSelector, partitionKey);
}
/// <summary>
/// Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <typeparam name="TValue">The type of the value used to order the query.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="maxValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partitionKey.</param>
public TValue GetMaxValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> maxValueSelector, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return GetMaxMongoQuery<TDocument, TKey, TValue>(filter, maxValueSelector, partitionKey)
.Project(maxValueSelector)
.FirstOrDefault();
}
/// <summary>
/// Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TValue">The type of the value used to order the query.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param>
public async Task<TValue> GetMinValueAsync<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey = null)
where TDocument : IDocument
{
return await GetMinValueAsync<TDocument, Guid, TValue>(filter, minValueSelector, partitionKey);
}
/// <summary>
/// Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <typeparam name="TValue">The type of the value used to order the query.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param>
public async Task<TValue> GetMinValueAsync<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return await GetMinMongoQuery<TDocument, TKey, TValue>(filter, minValueSelector, partitionKey).Project(minValueSelector).FirstOrDefaultAsync();
}
/// <summary>
/// Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TValue">The type of the value used to order the query.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param>
public TValue GetMinValue<TDocument, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey = null)
where TDocument : IDocument
{
return GetMinValue<TDocument, Guid, TValue>(filter, minValueSelector, partitionKey);
}
/// <summary>
/// Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TKey">The type of the primary key.</typeparam>
/// <typeparam name="TValue">The type of the value used to order the query.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="minValueSelector">A property selector to order by ascending.</param>
/// <param name="partitionKey">An optional partition key.</param>
public TValue GetMinValue<TDocument, TKey, TValue>(Expression<Func<TDocument, bool>> filter, Expression<Func<TDocument, TValue>> minValueSelector, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return GetMinMongoQuery<TDocument, TKey, TValue>(filter, minValueSelector, partitionKey).Project(minValueSelector).FirstOrDefault();
}
#endregion
@@ -350,26 +635,16 @@ namespace MongoDbGenericRepository
#region Utility Methods
/// <summary>
/// Gets a collections for the type TDocument with the matching partition key.
/// Gets a collections for the type TDocument with the matching partition key (if any).
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <param name="partitionKey">The partion key.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>An <see cref="IMongoCollection{TDocument}"/></returns>
protected IMongoCollection<TDocument> GetCollection<TDocument>(string partitionKey) where TDocument : IDocument
protected IMongoCollection<TDocument> GetCollection<TDocument>(string partitionKey = null) where TDocument : IDocument
{
return MongoDbContext.GetCollection<TDocument>(partitionKey);
}
/// <summary>
/// Gets a collections for the type TDocument
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <returns></returns>
protected IMongoCollection<TDocument> GetCollection<TDocument>() where TDocument : IDocument
{
return MongoDbContext.GetCollection<TDocument>();
}
/// <summary>
/// Gets a collections for the type TDocument
/// </summary>
@@ -429,7 +704,7 @@ namespace MongoDbGenericRepository
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return MongoDbContext.GetCollection<TDocument, TKey>(partitionKey);
return MongoDbContext.GetCollection<TDocument>(partitionKey);
}
/// <summary>
@@ -450,6 +725,20 @@ namespace MongoDbGenericRepository
return GetCollection<TDocument, TKey>();
}
/// <summary>
/// Converts a LINQ expression of TDocument, TValue to a LINQ expression of TDocument, object
/// </summary>
/// <typeparam name="TDocument">The document type.</typeparam>
/// <typeparam name="TValue">The type of the value.</typeparam>
/// <param name="expression">The expression to convert</param>
protected static Expression<Func<TDocument, object>> ConvertExpression<TDocument, TValue>(Expression<Func<TDocument, TValue>> expression)
{
var param = expression.Parameters[0];
Expression body = expression.Body;
var convert = Expression.Convert(body, typeof(object));
return Expression.Lambda<Func<TDocument, object>>(convert, param);
}
#endregion
}
@@ -0,0 +1,39 @@
using MongoDB.Bson;
using System;
namespace MongoDbGenericRepository.Utils
{
/// <summary>
/// The IdGenerator instance, used to generate Ids of different types.
/// </summary>
public static class IdGenerator
{
private static readonly Random Random = new Random();
/// <summary>
/// Generates a random value of a given type.
/// </summary>
/// <typeparam name="TKey">The type of the value to generate.</typeparam>
/// <returns>A value of type TKey.</returns>
public static TKey GetId<TKey>()
{
var idTypeName = typeof(TKey).Name;
switch (idTypeName)
{
case "Guid":
return (TKey)(object)Guid.NewGuid();
case "Int16":
return (TKey)(object)Random.Next(1, short.MaxValue);
case "Int32":
return (TKey)(object)Random.Next(1, int.MaxValue);
case "Int64":
return (TKey)(object)(Random.NextLong(1, long.MaxValue));
case "String":
return (TKey)(object)Guid.NewGuid().ToString();
case "ObjectId":
return (TKey)(object)ObjectId.GenerateNewId();
}
throw new ArgumentException($"{idTypeName} is not a supported Id type, the Id of the document cannot be set.");
}
}
}
Binary file not shown.
@@ -141,6 +141,7 @@
<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>
</member>
<member name="M:MongoDbGenericRepository.IBaseMongoRepository.UpdateOneAsync``1(``0,MongoDB.Driver.UpdateDefinition{``0})">
<summary>
@@ -155,11 +156,11 @@
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>
</member>
<member name="M:MongoDbGenericRepository.IBaseMongoRepository.UpdateOne``1(``0,MongoDB.Driver.UpdateDefinition{``0})">
<summary>
@@ -213,6 +214,7 @@
<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>
</member>
<member name="M:MongoDbGenericRepository.IBaseMongoRepository.UpdateOneAsync``3(``0,System.Linq.Expressions.Expression{System.Func{``0,``2}},``2)">
<summary>
@@ -235,6 +237,7 @@
<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>
</member>
<member name="M:MongoDbGenericRepository.IBaseMongoRepository.UpdateOne``3(``0,System.Linq.Expressions.Expression{System.Func{``0,``2}},``2)">
<summary>
@@ -588,20 +591,6 @@
<typeparam name="TDocument"></typeparam>
<param name="partitionKey">The value of the partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbContext.GetCollection``2(System.String)">
<summary>
Returns a collection for a document type that has a partition key.
</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="partitionKey">The value of the partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbContext.DropCollection``1">
<summary>
Drops a collection, use very carefully.
</summary>
<typeparam name="TDocument"></typeparam>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbContext.DropCollection``1(System.String)">
<summary>
Drops a collection having a partitionkey, use very carefully.
@@ -816,6 +805,165 @@
<param name="filter">A LINQ expression filter.</param>
<param name="partitionKey">An optional partitionKey</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMaxAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByDescending">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMax``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByDescending">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
<returns></returns>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMinAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMin``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMaxAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMax``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMinAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMin``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMaxValueAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMaxValueAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMaxValue``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMaxValue``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMinValueAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMinValueAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMinValue``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMinValue``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="T:MongoDbGenericRepository.Attributes.CollectionNameAttribute">
<summary>
This attribute allows you to specify of the name of the collection.
@@ -830,6 +978,12 @@
The name of the collection in which your documents are stored.
</summary>
</member>
<member name="M:MongoDbGenericRepository.Attributes.CollectionNameAttribute.#ctor(System.String)">
<summary>
The constructor.
</summary>
<param name="name">The name of the collection.</param>
</member>
<member name="T:MongoDbGenericRepository.BaseMongoRepository">
<summary>
The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.
@@ -985,6 +1139,7 @@
<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>
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.UpdateOneAsync``2(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)">
<summary>
@@ -1002,11 +1157,11 @@
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>
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``1(``0,MongoDB.Driver.UpdateDefinition{``0})">
<summary>
@@ -1094,6 +1249,7 @@
<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>
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``3(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)">
<summary>
@@ -1117,6 +1273,7 @@
<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>
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.DeleteOneAsync``1(``0)">
<summary>
@@ -1532,6 +1689,12 @@
</summary>
<param name="guidRepresentation">The new value of the GuidRepresentation</param>
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.InitializeGuidRepresentation">
<summary>
Initialize the Guid representation of the MongoDb Driver.
Override this method to change the default GuidRepresentation.
</summary>
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.#ctor(MongoDB.Driver.IMongoDatabase)">
<summary>
The constructor of the MongoDbContext, it needs a an object implementing <see cref="T:MongoDB.Driver.IMongoDatabase"/>.
@@ -1554,37 +1717,31 @@
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.GetCollection``1(System.String)">
<summary>
Returns a collection for a document type that has a partition key.
Returns a collection for a document type. Also handles document types with a partition key.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="partitionKey">The value of the partition key.</param>
<param name="partitionKey">The optional value of the partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.GetCollection``2(System.String)">
<summary>
Returns a collection for a document type that has a partition key.
</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="partitionKey">The value of the partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.DropCollection``1">
<member name="M:MongoDbGenericRepository.MongoDbContext.DropCollection``1(System.String)">
<summary>
Drops a collection, use very carefully.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.DropCollection``1(System.String)">
<member name="M:MongoDbGenericRepository.MongoDbContext.GetCollectionName``1(System.String)">
<summary>
Drops a collection having a partitionkey, use very carefully.
Given the docmuent type and the partition key, returns the name of the collection it belongs to.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="partitionKey">The value of the partition key.</param>
<returns>The name of the collection.</returns>
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.Pluralize``1">
<summary>
Very naively pluralizes a TDocument type name.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<returns></returns>
<returns>The pluralized document name.</returns>
</member>
<member name="T:MongoDbGenericRepository.ReadOnlyMongoRepository">
<summary>
@@ -1713,6 +1870,43 @@
<param name="filter">A LINQ expression filter.</param>
<param name="partitionKey">An optional partitionKey</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMaxAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMax``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
<returns></returns>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMinAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMin``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByIdAsync``2(``1,System.String)">
<summary>
Asynchronously returns one document given its id.
@@ -1812,21 +2006,159 @@
<param name="filter">A LINQ expression filter.</param>
<param name="partitionKey">An optional partitionKey</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMaxAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMax``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMinAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMin``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMinMongoQuery``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMaxMongoQuery``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by descending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMaxValueAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMaxValueAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMaxValue``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMaxValue``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMinValueAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMinValueAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMinValue``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMinValue``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetCollection``1(System.String)">
<summary>
Gets a collections for the type TDocument with the matching partition key.
Gets a collections for the type TDocument with the matching partition key (if any).
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="partitionKey">The partion key.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>An <see cref="T:MongoDB.Driver.IMongoCollection`1"/></returns>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetCollection``1">
<summary>
Gets a collections for the type TDocument
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<returns></returns>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.HandlePartitioned``1(``0)">
<summary>
Gets a collections for the type TDocument
@@ -1870,6 +2202,26 @@
<param name="partitionKey">The collection partition key.</param>
<returns></returns>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.ConvertExpression``2(System.Linq.Expressions.Expression{System.Func{``0,``1}})">
<summary>
Converts a LINQ expression of TDocument, TValue to a LINQ expression of TDocument, object
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value.</typeparam>
<param name="expression">The expression to convert</param>
</member>
<member name="T:MongoDbGenericRepository.Utils.IdGenerator">
<summary>
The IdGenerator instance, used to generate Ids of different types.
</summary>
</member>
<member name="M:MongoDbGenericRepository.Utils.IdGenerator.GetId``1">
<summary>
Generates a random value of a given type.
</summary>
<typeparam name="TKey">The type of the value to generate.</typeparam>
<returns>A value of type TKey.</returns>
</member>
<member name="T:MongoDbGenericRepository.Utils.Vocabularies">
<summary>
Container for registered Vocabularies. At present, only a single vocabulary is supported: Default.
@@ -1,7 +1,7 @@
{
"runtimeTarget": {
"name": ".NETStandard,Version=v1.5/",
"signature": "795a70ab1bbc13177859af16f1887befe3221c54"
"signature": "b945d8e228876adfa8e84019c7873fce5baf0c0b"
},
"compilationOptions": {},
"targets": {
@@ -9,7 +9,7 @@
".NETStandard,Version=v1.5/": {
"MongoDbGenericRepository/1.0.0": {
"dependencies": {
"MongoDB.Driver": "2.5.0",
"MongoDB.Driver": "2.7.0",
"NETStandard.Library": "1.6.1"
},
"runtime": {
@@ -60,7 +60,7 @@
"System.Runtime.InteropServices": "4.3.0"
}
},
"MongoDB.Bson/2.5.0": {
"MongoDB.Bson/2.7.0": {
"dependencies": {
"NETStandard.Library": "1.6.1",
"System.Collections.NonGeneric": "4.0.1",
@@ -72,10 +72,10 @@
"lib/netstandard1.5/MongoDB.Bson.dll": {}
}
},
"MongoDB.Driver/2.5.0": {
"MongoDB.Driver/2.7.0": {
"dependencies": {
"MongoDB.Bson": "2.5.0",
"MongoDB.Driver.Core": "2.5.0",
"MongoDB.Bson": "2.7.0",
"MongoDB.Driver.Core": "2.7.0",
"NETStandard.Library": "1.6.1",
"System.ComponentModel.TypeConverter": "4.1.0",
"System.Linq.Queryable": "4.0.1"
@@ -84,10 +84,10 @@
"lib/netstandard1.5/MongoDB.Driver.dll": {}
}
},
"MongoDB.Driver.Core/2.5.0": {
"MongoDB.Driver.Core/2.7.0": {
"dependencies": {
"DnsClient": "1.0.7",
"MongoDB.Bson": "2.5.0",
"MongoDB.Bson": "2.7.0",
"NETStandard.Library": "1.6.1",
"System.Collections.Specialized": "4.0.1",
"System.Diagnostics.TraceSource": "4.0.0",
@@ -1021,26 +1021,26 @@
"path": "microsoft.win32.registry/4.0.0",
"hashPath": "microsoft.win32.registry.4.0.0.nupkg.sha512"
},
"MongoDB.Bson/2.5.0": {
"MongoDB.Bson/2.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-b7zQAUdSdfJ4kmGzAA+hv89N2Q6jm1td9WfTimgp8xWAsN4qbtIjA/JkAY1HA0Z8xfXQE3EmdUcDEwT8bkXfXg==",
"path": "mongodb.bson/2.5.0",
"hashPath": "mongodb.bson.2.5.0.nupkg.sha512"
"sha512": "sha512-vzpTDHYX/X6gF9qtDuKRJiLkqpj5OZuT1bIzJCiBiU8CwJ37becYmaXuy/QSuWnYN6j6ZdVTWILKbWt2MXL8DA==",
"path": "mongodb.bson/2.7.0",
"hashPath": "mongodb.bson.2.7.0.nupkg.sha512"
},
"MongoDB.Driver/2.5.0": {
"MongoDB.Driver/2.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-VbHVV8Xdl3PcPU3XxdOUE/yc4BnPokg7k1XHU/3fEM/UdfCy0Ie0eXVE+U2HJXVcM3TQuuyVn+B1La2YY7X8dA==",
"path": "mongodb.driver/2.5.0",
"hashPath": "mongodb.driver.2.5.0.nupkg.sha512"
"sha512": "sha512-5wP5BBwm5YO6h2Vhw6zQmOwSW9WP2d6kgRM6E7uIbwIJz4+j2trS2Wo7/+IYow5WVN8Jd6O27bIB/4gKNepO1Q==",
"path": "mongodb.driver/2.7.0",
"hashPath": "mongodb.driver.2.7.0.nupkg.sha512"
},
"MongoDB.Driver.Core/2.5.0": {
"MongoDB.Driver.Core/2.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-/JYwBTEoWZDHiSePk0AF775c0YkSGSsHTA2+hWt9/UOCkYV/QOFujAWDdpFzBMCDpmQewbLRR1knYj76YOxffA==",
"path": "mongodb.driver.core/2.5.0",
"hashPath": "mongodb.driver.core.2.5.0.nupkg.sha512"
"sha512": "sha512-SepB4KT+zXA3iFaIFwXVKmk6BZIp0EGE/iWqNbDZ1mca9e8EhtqYPwOOzFmEbdKAzmVvF1y86kNI4agWP6I5sg==",
"path": "mongodb.driver.core/2.7.0",
"hashPath": "mongodb.driver.core.2.7.0.nupkg.sha512"
},
"NETStandard.Library/1.6.1": {
"type": "package",
@@ -141,6 +141,7 @@
<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>
</member>
<member name="M:MongoDbGenericRepository.IBaseMongoRepository.UpdateOneAsync``1(``0,MongoDB.Driver.UpdateDefinition{``0})">
<summary>
@@ -155,11 +156,11 @@
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>
</member>
<member name="M:MongoDbGenericRepository.IBaseMongoRepository.UpdateOne``1(``0,MongoDB.Driver.UpdateDefinition{``0})">
<summary>
@@ -213,6 +214,7 @@
<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>
</member>
<member name="M:MongoDbGenericRepository.IBaseMongoRepository.UpdateOneAsync``3(``0,System.Linq.Expressions.Expression{System.Func{``0,``2}},``2)">
<summary>
@@ -235,6 +237,7 @@
<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>
</member>
<member name="M:MongoDbGenericRepository.IBaseMongoRepository.UpdateOne``3(``0,System.Linq.Expressions.Expression{System.Func{``0,``2}},``2)">
<summary>
@@ -588,20 +591,6 @@
<typeparam name="TDocument"></typeparam>
<param name="partitionKey">The value of the partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbContext.GetCollection``2(System.String)">
<summary>
Returns a collection for a document type that has a partition key.
</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="partitionKey">The value of the partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbContext.DropCollection``1">
<summary>
Drops a collection, use very carefully.
</summary>
<typeparam name="TDocument"></typeparam>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbContext.DropCollection``1(System.String)">
<summary>
Drops a collection having a partitionkey, use very carefully.
@@ -816,6 +805,165 @@
<param name="filter">A LINQ expression filter.</param>
<param name="partitionKey">An optional partitionKey</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMaxAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByDescending">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMax``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByDescending">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
<returns></returns>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMinAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMin``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMaxAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMax``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMinAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMin``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMaxValueAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMaxValueAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMaxValue``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMaxValue``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMinValueAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMinValueAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMinValue``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMinValue``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="T:MongoDbGenericRepository.Attributes.CollectionNameAttribute">
<summary>
This attribute allows you to specify of the name of the collection.
@@ -830,6 +978,12 @@
The name of the collection in which your documents are stored.
</summary>
</member>
<member name="M:MongoDbGenericRepository.Attributes.CollectionNameAttribute.#ctor(System.String)">
<summary>
The constructor.
</summary>
<param name="name">The name of the collection.</param>
</member>
<member name="T:MongoDbGenericRepository.BaseMongoRepository">
<summary>
The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.
@@ -985,6 +1139,7 @@
<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>
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.UpdateOneAsync``2(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)">
<summary>
@@ -1002,11 +1157,11 @@
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>
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``1(``0,MongoDB.Driver.UpdateDefinition{``0})">
<summary>
@@ -1094,6 +1249,7 @@
<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>
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``3(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)">
<summary>
@@ -1117,6 +1273,7 @@
<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>
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.DeleteOneAsync``1(``0)">
<summary>
@@ -1532,6 +1689,12 @@
</summary>
<param name="guidRepresentation">The new value of the GuidRepresentation</param>
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.InitializeGuidRepresentation">
<summary>
Initialize the Guid representation of the MongoDb Driver.
Override this method to change the default GuidRepresentation.
</summary>
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.#ctor(MongoDB.Driver.IMongoDatabase)">
<summary>
The constructor of the MongoDbContext, it needs a an object implementing <see cref="T:MongoDB.Driver.IMongoDatabase"/>.
@@ -1554,37 +1717,31 @@
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.GetCollection``1(System.String)">
<summary>
Returns a collection for a document type that has a partition key.
Returns a collection for a document type. Also handles document types with a partition key.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="partitionKey">The value of the partition key.</param>
<param name="partitionKey">The optional value of the partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.GetCollection``2(System.String)">
<summary>
Returns a collection for a document type that has a partition key.
</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="partitionKey">The value of the partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.DropCollection``1">
<member name="M:MongoDbGenericRepository.MongoDbContext.DropCollection``1(System.String)">
<summary>
Drops a collection, use very carefully.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.DropCollection``1(System.String)">
<member name="M:MongoDbGenericRepository.MongoDbContext.GetCollectionName``1(System.String)">
<summary>
Drops a collection having a partitionkey, use very carefully.
Given the docmuent type and the partition key, returns the name of the collection it belongs to.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="partitionKey">The value of the partition key.</param>
<returns>The name of the collection.</returns>
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.Pluralize``1">
<summary>
Very naively pluralizes a TDocument type name.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<returns></returns>
<returns>The pluralized document name.</returns>
</member>
<member name="T:MongoDbGenericRepository.ReadOnlyMongoRepository">
<summary>
@@ -1713,6 +1870,43 @@
<param name="filter">A LINQ expression filter.</param>
<param name="partitionKey">An optional partitionKey</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMaxAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMax``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
<returns></returns>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMinAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMin``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByIdAsync``2(``1,System.String)">
<summary>
Asynchronously returns one document given its id.
@@ -1812,21 +2006,159 @@
<param name="filter">A LINQ expression filter.</param>
<param name="partitionKey">An optional partitionKey</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMaxAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMax``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMinAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMin``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMinMongoQuery``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMaxMongoQuery``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by descending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMaxValueAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMaxValueAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMaxValue``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMaxValue``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMinValueAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMinValueAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMinValue``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMinValue``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetCollection``1(System.String)">
<summary>
Gets a collections for the type TDocument with the matching partition key.
Gets a collections for the type TDocument with the matching partition key (if any).
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="partitionKey">The partion key.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>An <see cref="T:MongoDB.Driver.IMongoCollection`1"/></returns>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetCollection``1">
<summary>
Gets a collections for the type TDocument
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<returns></returns>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.HandlePartitioned``1(``0)">
<summary>
Gets a collections for the type TDocument
@@ -1870,6 +2202,26 @@
<param name="partitionKey">The collection partition key.</param>
<returns></returns>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.ConvertExpression``2(System.Linq.Expressions.Expression{System.Func{``0,``1}})">
<summary>
Converts a LINQ expression of TDocument, TValue to a LINQ expression of TDocument, object
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value.</typeparam>
<param name="expression">The expression to convert</param>
</member>
<member name="T:MongoDbGenericRepository.Utils.IdGenerator">
<summary>
The IdGenerator instance, used to generate Ids of different types.
</summary>
</member>
<member name="M:MongoDbGenericRepository.Utils.IdGenerator.GetId``1">
<summary>
Generates a random value of a given type.
</summary>
<typeparam name="TKey">The type of the value to generate.</typeparam>
<returns>A value of type TKey.</returns>
</member>
<member name="T:MongoDbGenericRepository.Utils.Vocabularies">
<summary>
Container for registered Vocabularies. At present, only a single vocabulary is supported: Default.
@@ -1,7 +1,7 @@
{
"runtimeTarget": {
"name": ".NETStandard,Version=v2.0/",
"signature": "c7b8ca9e84d3f282de57dfcebff465cb47d24ac8"
"signature": "af81df2668beb4b8f166ddd0c4c0f1882e8ec745"
},
"compilationOptions": {},
"targets": {
@@ -9,8 +9,8 @@
".NETStandard,Version=v2.0/": {
"MongoDbGenericRepository/1.0.0": {
"dependencies": {
"MongoDB.Driver": "2.5.0",
"NETStandard.Library": "2.0.1"
"MongoDB.Driver": "2.7.0",
"NETStandard.Library": "2.0.3"
},
"runtime": {
"MongoDbGenericRepository.dll": {}
@@ -19,7 +19,7 @@
"DnsClient/1.0.7": {
"dependencies": {
"Microsoft.Win32.Primitives": "4.3.0",
"NETStandard.Library": "2.0.1",
"NETStandard.Library": "2.0.3",
"System.Buffers": "4.3.0",
"System.Collections": "4.3.0",
"System.Collections.Concurrent": "4.3.0",
@@ -60,9 +60,9 @@
"System.Runtime.InteropServices": "4.3.0"
}
},
"MongoDB.Bson/2.5.0": {
"MongoDB.Bson/2.7.0": {
"dependencies": {
"NETStandard.Library": "2.0.1",
"NETStandard.Library": "2.0.3",
"System.Collections.NonGeneric": "4.0.1",
"System.Diagnostics.Process": "4.1.0",
"System.Dynamic.Runtime": "4.0.11",
@@ -72,11 +72,11 @@
"lib/netstandard1.5/MongoDB.Bson.dll": {}
}
},
"MongoDB.Driver/2.5.0": {
"MongoDB.Driver/2.7.0": {
"dependencies": {
"MongoDB.Bson": "2.5.0",
"MongoDB.Driver.Core": "2.5.0",
"NETStandard.Library": "2.0.1",
"MongoDB.Bson": "2.7.0",
"MongoDB.Driver.Core": "2.7.0",
"NETStandard.Library": "2.0.3",
"System.ComponentModel.TypeConverter": "4.1.0",
"System.Linq.Queryable": "4.0.1"
},
@@ -84,11 +84,11 @@
"lib/netstandard1.5/MongoDB.Driver.dll": {}
}
},
"MongoDB.Driver.Core/2.5.0": {
"MongoDB.Driver.Core/2.7.0": {
"dependencies": {
"DnsClient": "1.0.7",
"MongoDB.Bson": "2.5.0",
"NETStandard.Library": "2.0.1",
"MongoDB.Bson": "2.7.0",
"NETStandard.Library": "2.0.3",
"System.Collections.Specialized": "4.0.1",
"System.Diagnostics.TraceSource": "4.0.0",
"System.Net.NameResolution": "4.3.0",
@@ -99,7 +99,7 @@
"lib/netstandard1.5/MongoDB.Driver.Core.dll": {}
}
},
"NETStandard.Library/2.0.1": {
"NETStandard.Library/2.0.3": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.1.0"
}
@@ -926,33 +926,33 @@
"path": "microsoft.win32.registry/4.0.0",
"hashPath": "microsoft.win32.registry.4.0.0.nupkg.sha512"
},
"MongoDB.Bson/2.5.0": {
"MongoDB.Bson/2.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-b7zQAUdSdfJ4kmGzAA+hv89N2Q6jm1td9WfTimgp8xWAsN4qbtIjA/JkAY1HA0Z8xfXQE3EmdUcDEwT8bkXfXg==",
"path": "mongodb.bson/2.5.0",
"hashPath": "mongodb.bson.2.5.0.nupkg.sha512"
"sha512": "sha512-vzpTDHYX/X6gF9qtDuKRJiLkqpj5OZuT1bIzJCiBiU8CwJ37becYmaXuy/QSuWnYN6j6ZdVTWILKbWt2MXL8DA==",
"path": "mongodb.bson/2.7.0",
"hashPath": "mongodb.bson.2.7.0.nupkg.sha512"
},
"MongoDB.Driver/2.5.0": {
"MongoDB.Driver/2.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-VbHVV8Xdl3PcPU3XxdOUE/yc4BnPokg7k1XHU/3fEM/UdfCy0Ie0eXVE+U2HJXVcM3TQuuyVn+B1La2YY7X8dA==",
"path": "mongodb.driver/2.5.0",
"hashPath": "mongodb.driver.2.5.0.nupkg.sha512"
"sha512": "sha512-5wP5BBwm5YO6h2Vhw6zQmOwSW9WP2d6kgRM6E7uIbwIJz4+j2trS2Wo7/+IYow5WVN8Jd6O27bIB/4gKNepO1Q==",
"path": "mongodb.driver/2.7.0",
"hashPath": "mongodb.driver.2.7.0.nupkg.sha512"
},
"MongoDB.Driver.Core/2.5.0": {
"MongoDB.Driver.Core/2.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-/JYwBTEoWZDHiSePk0AF775c0YkSGSsHTA2+hWt9/UOCkYV/QOFujAWDdpFzBMCDpmQewbLRR1knYj76YOxffA==",
"path": "mongodb.driver.core/2.5.0",
"hashPath": "mongodb.driver.core.2.5.0.nupkg.sha512"
"sha512": "sha512-SepB4KT+zXA3iFaIFwXVKmk6BZIp0EGE/iWqNbDZ1mca9e8EhtqYPwOOzFmEbdKAzmVvF1y86kNI4agWP6I5sg==",
"path": "mongodb.driver.core/2.7.0",
"hashPath": "mongodb.driver.core.2.7.0.nupkg.sha512"
},
"NETStandard.Library/2.0.1": {
"NETStandard.Library/2.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-oA6nwv9MhEKYvLpjZ0ggSpb1g4CQViDVQjLUcDWg598jtvJbpfeP2reqwI1GLW2TbxC/Ml7xL6BBR1HmKPXlTg==",
"path": "netstandard.library/2.0.1",
"hashPath": "netstandard.library.2.0.1.nupkg.sha512"
"sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
"path": "netstandard.library/2.0.3",
"hashPath": "netstandard.library.2.0.3.nupkg.sha512"
},
"runtime.native.System/4.3.0": {
"type": "package",
@@ -141,6 +141,7 @@
<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>
</member>
<member name="M:MongoDbGenericRepository.IBaseMongoRepository.UpdateOneAsync``1(``0,MongoDB.Driver.UpdateDefinition{``0})">
<summary>
@@ -155,11 +156,11 @@
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>
</member>
<member name="M:MongoDbGenericRepository.IBaseMongoRepository.UpdateOne``1(``0,MongoDB.Driver.UpdateDefinition{``0})">
<summary>
@@ -213,6 +214,7 @@
<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>
</member>
<member name="M:MongoDbGenericRepository.IBaseMongoRepository.UpdateOneAsync``3(``0,System.Linq.Expressions.Expression{System.Func{``0,``2}},``2)">
<summary>
@@ -235,6 +237,7 @@
<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>
</member>
<member name="M:MongoDbGenericRepository.IBaseMongoRepository.UpdateOne``3(``0,System.Linq.Expressions.Expression{System.Func{``0,``2}},``2)">
<summary>
@@ -588,20 +591,6 @@
<typeparam name="TDocument"></typeparam>
<param name="partitionKey">The value of the partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbContext.GetCollection``2(System.String)">
<summary>
Returns a collection for a document type that has a partition key.
</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="partitionKey">The value of the partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbContext.DropCollection``1">
<summary>
Drops a collection, use very carefully.
</summary>
<typeparam name="TDocument"></typeparam>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbContext.DropCollection``1(System.String)">
<summary>
Drops a collection having a partitionkey, use very carefully.
@@ -816,6 +805,165 @@
<param name="filter">A LINQ expression filter.</param>
<param name="partitionKey">An optional partitionKey</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMaxAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByDescending">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMax``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByDescending">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
<returns></returns>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMinAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMin``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMaxAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMax``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMinAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetByMin``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMaxValueAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMaxValueAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMaxValue``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMaxValue``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMinValueAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMinValueAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMinValue``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.IReadOnlyMongoRepository.GetMinValue``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="T:MongoDbGenericRepository.Attributes.CollectionNameAttribute">
<summary>
This attribute allows you to specify of the name of the collection.
@@ -830,6 +978,12 @@
The name of the collection in which your documents are stored.
</summary>
</member>
<member name="M:MongoDbGenericRepository.Attributes.CollectionNameAttribute.#ctor(System.String)">
<summary>
The constructor.
</summary>
<param name="name">The name of the collection.</param>
</member>
<member name="T:MongoDbGenericRepository.BaseMongoRepository">
<summary>
The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.
@@ -985,6 +1139,7 @@
<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>
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.UpdateOneAsync``2(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``1}},``1,System.String)">
<summary>
@@ -1002,11 +1157,11 @@
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>
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``1(``0,MongoDB.Driver.UpdateDefinition{``0})">
<summary>
@@ -1094,6 +1249,7 @@
<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>
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.UpdateOne``3(MongoDB.Driver.FilterDefinition{``0},System.Linq.Expressions.Expression{System.Func{``0,``2}},``2,System.String)">
<summary>
@@ -1117,6 +1273,7 @@
<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>
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.DeleteOneAsync``1(``0)">
<summary>
@@ -1532,6 +1689,12 @@
</summary>
<param name="guidRepresentation">The new value of the GuidRepresentation</param>
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.InitializeGuidRepresentation">
<summary>
Initialize the Guid representation of the MongoDb Driver.
Override this method to change the default GuidRepresentation.
</summary>
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.#ctor(MongoDB.Driver.IMongoDatabase)">
<summary>
The constructor of the MongoDbContext, it needs a an object implementing <see cref="T:MongoDB.Driver.IMongoDatabase"/>.
@@ -1554,37 +1717,31 @@
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.GetCollection``1(System.String)">
<summary>
Returns a collection for a document type that has a partition key.
Returns a collection for a document type. Also handles document types with a partition key.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="partitionKey">The value of the partition key.</param>
<param name="partitionKey">The optional value of the partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.GetCollection``2(System.String)">
<summary>
Returns a collection for a document type that has a partition key.
</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="partitionKey">The value of the partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.DropCollection``1">
<member name="M:MongoDbGenericRepository.MongoDbContext.DropCollection``1(System.String)">
<summary>
Drops a collection, use very carefully.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.DropCollection``1(System.String)">
<member name="M:MongoDbGenericRepository.MongoDbContext.GetCollectionName``1(System.String)">
<summary>
Drops a collection having a partitionkey, use very carefully.
Given the docmuent type and the partition key, returns the name of the collection it belongs to.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="partitionKey">The value of the partition key.</param>
<returns>The name of the collection.</returns>
</member>
<member name="M:MongoDbGenericRepository.MongoDbContext.Pluralize``1">
<summary>
Very naively pluralizes a TDocument type name.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<returns></returns>
<returns>The pluralized document name.</returns>
</member>
<member name="T:MongoDbGenericRepository.ReadOnlyMongoRepository">
<summary>
@@ -1713,6 +1870,43 @@
<param name="filter">A LINQ expression filter.</param>
<param name="partitionKey">An optional partitionKey</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMaxAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMax``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
<returns></returns>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMinAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMin``1(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByIdAsync``2(``1,System.String)">
<summary>
Asynchronously returns one document given its id.
@@ -1812,21 +2006,159 @@
<param name="filter">A LINQ expression filter.</param>
<param name="partitionKey">An optional partitionKey</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMaxAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMax``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the maximum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by descending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMinAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetByMin``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,System.Object}},System.String)">
<summary>
Gets the document with the minimum value of a specified property in a MongoDB collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMinMongoQuery``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMaxMongoQuery``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by descending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMaxValueAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMaxValueAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="orderByAscending">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMaxValue``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMaxValue``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the maximum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="maxValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partitionKey.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMinValueAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMinValueAsync``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMinValue``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``1}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetMinValue``3(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{``0,``2}},System.String)">
<summary>
Gets the minimum value of a property in a mongodb collections that is satisfying the filter.
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TKey">The type of the primary key.</typeparam>
<typeparam name="TValue">The type of the value used to order the query.</typeparam>
<param name="filter">A LINQ expression filter.</param>
<param name="minValueSelector">A property selector to order by ascending.</param>
<param name="partitionKey">An optional partition key.</param>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetCollection``1(System.String)">
<summary>
Gets a collections for the type TDocument with the matching partition key.
Gets a collections for the type TDocument with the matching partition key (if any).
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<param name="partitionKey">The partion key.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>An <see cref="T:MongoDB.Driver.IMongoCollection`1"/></returns>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.GetCollection``1">
<summary>
Gets a collections for the type TDocument
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<returns></returns>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.HandlePartitioned``1(``0)">
<summary>
Gets a collections for the type TDocument
@@ -1870,6 +2202,26 @@
<param name="partitionKey">The collection partition key.</param>
<returns></returns>
</member>
<member name="M:MongoDbGenericRepository.ReadOnlyMongoRepository.ConvertExpression``2(System.Linq.Expressions.Expression{System.Func{``0,``1}})">
<summary>
Converts a LINQ expression of TDocument, TValue to a LINQ expression of TDocument, object
</summary>
<typeparam name="TDocument">The document type.</typeparam>
<typeparam name="TValue">The type of the value.</typeparam>
<param name="expression">The expression to convert</param>
</member>
<member name="T:MongoDbGenericRepository.Utils.IdGenerator">
<summary>
The IdGenerator instance, used to generate Ids of different types.
</summary>
</member>
<member name="M:MongoDbGenericRepository.Utils.IdGenerator.GetId``1">
<summary>
Generates a random value of a given type.
</summary>
<typeparam name="TKey">The type of the value to generate.</typeparam>
<returns>A value of type TKey.</returns>
</member>
<member name="T:MongoDbGenericRepository.Utils.Vocabularies">
<summary>
Container for registered Vocabularies. At present, only a single vocabulary is supported: Default.
+19 -2
View File
@@ -40,6 +40,7 @@ Here is an example of repository usage, where the TestRepository is implementing
}
}
```
## Instantiation
The repository can be instantiated like so:
@@ -127,6 +128,22 @@ _testRepository.AddOne(myDoc);
The above code will generate a collection named `myPartitionKey-myPartitionedDocuments`.
## CollectionName Attribute
It is now possible to change the collection name by using the `CollectionName` attribute:
```csharp
[CollectionName("MyCollectionName")]
public class MyDocument : Document
{
public MyDocument()
{
Version = 2;
}
public string SomeContent { get; set; }
}
```
Documents of this type will be inserted into a collection named "MyCollectionName".
Please refer to the IntegrationTests (NET45) and CoreIntegrationTests (netstandard2.0) projects for more usage examples.
## Author
@@ -137,7 +154,7 @@ mongodb-generic-repository is under MIT license - http://www.opensource.org/lice
The MIT License (MIT)
Copyright (c) 2016-2017 Alexandre Spieser
Copyright (c) 2016-2018 Alexandre Spieser
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -172,4 +189,4 @@ Copyright (c) 2012-2014 Mehdi Khalili (http://omar.io)
==============================================================================
## Copyright
Copyright © 2017
Copyright © 2018