Skip to content

Commit 1f78c48

Browse files
Update to net10
1 parent e4156e4 commit 1f78c48

File tree

147 files changed

+7364
-7722
lines changed

Some content is hidden

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

147 files changed

+7364
-7722
lines changed

src/.editorconfig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
8484
csharp_style_conditional_delegate_call = true:suggestion
8585

8686
# Modifier preferences
87-
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
87+
csharp_preferred_modifier_order = public, private, protected, internal, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, volatile, async
8888

8989
# Code-block preferences
9090
csharp_prefer_braces = true:suggestion
@@ -149,4 +149,6 @@ csharp_preserve_single_line_statements = true
149149
dotnet_diagnostic.CA1303.severity = silent
150150

151151
# CA1308: Normalize strings to uppercase
152-
dotnet_diagnostic.CA1308.severity = suggestion
152+
dotnet_diagnostic.CA1308.severity = suggestion
153+
154+
place_attribute_on_same_line = false
Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
11
using Autofac;
22
using CouchDB.Driver.Options;
33
using System;
4-
using CouchDB.Driver.Helpers;
54

6-
namespace CouchDB.Driver.DependencyInjection.Autofac
5+
namespace CouchDB.Driver.DependencyInjection.Autofac;
6+
7+
public static class AutofacRegistrationExtensions
78
{
8-
public static class AutofacRegistrationExtensions
9+
public static ContainerBuilder AddCouchContext<TContext>(this ContainerBuilder builder,
10+
Action<CouchOptionsBuilder<TContext>> optionBuilderAction)
11+
where TContext : CouchContext
912
{
10-
public static ContainerBuilder AddCouchContext<TContext>(this ContainerBuilder builder,
11-
Action<CouchOptionsBuilder<TContext>> optionBuilderAction)
12-
where TContext : CouchContext
13-
{
14-
Check.NotNull(builder, nameof(builder));
15-
Check.NotNull(optionBuilderAction, nameof(optionBuilderAction));
13+
ArgumentNullException.ThrowIfNull(builder);
14+
ArgumentNullException.ThrowIfNull(optionBuilderAction);
1615

17-
var optionsBuilder = new CouchOptionsBuilder<TContext>();
18-
optionBuilderAction?.Invoke(optionsBuilder);
16+
var optionsBuilder = new CouchOptionsBuilder<TContext>();
17+
optionBuilderAction?.Invoke(optionsBuilder);
1918

20-
builder
21-
.RegisterInstance(optionsBuilder.Options)
22-
.AsSelf();
19+
builder
20+
.RegisterInstance(optionsBuilder.Options)
21+
.AsSelf();
2322

24-
builder
25-
.RegisterType<TContext>()
26-
.SingleInstance();
23+
builder
24+
.RegisterType<TContext>()
25+
.SingleInstance();
2726

28-
return builder;
29-
}
27+
return builder;
3028
}
31-
}
29+
}

src/CouchDB.Driver.DependencyInjection.Autofac/CouchDB.Driver.DependencyInjection.Autofac.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@
88
<PackageProjectUrl>https://github.com/matteobortolazzo/couchdb-net</PackageProjectUrl>
99
<RepositoryUrl>https://github.com/matteobortolazzo/couchdb-net</RepositoryUrl>
1010
<PackageTags>couchdb,driver,nosql,netstandard,pouchdb,xamarin</PackageTags>
11-
<ApplicationIcon />
1211
<OutputType>Library</OutputType>
13-
<StartupObject />
1412
<NeutralLanguage>en</NeutralLanguage>
15-
<LangVersion>8.0</LangVersion>
1613
<Nullable>enable</Nullable>
1714
<PackageIcon>icon.png</PackageIcon>
1815
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
@@ -30,7 +27,7 @@
3027

3128
<ItemGroup>
3229
<PackageReference Include="CouchDB.NET" Version="3.3.*" />
33-
<PackageReference Include="Autofac" Version="6.5.0" />
30+
<PackageReference Include="Autofac" Version="9.0.0" />
3431
</ItemGroup>
3532

3633
</Project>

src/CouchDB.Driver.DependencyInjection/CouchDB.Driver.DependencyInjection.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@
88
<PackageProjectUrl>https://github.com/matteobortolazzo/couchdb-net</PackageProjectUrl>
99
<RepositoryUrl>https://github.com/matteobortolazzo/couchdb-net</RepositoryUrl>
1010
<PackageTags>couchdb,driver,nosql,netstandard,pouchdb,xamarin</PackageTags>
11-
<ApplicationIcon/>
1211
<OutputType>Library</OutputType>
13-
<StartupObject/>
1412
<NeutralLanguage>en</NeutralLanguage>
15-
<LangVersion>8.0</LangVersion>
1613
<Nullable>enable</Nullable>
1714
<PackageIcon>icon.png</PackageIcon>
1815
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
@@ -30,7 +27,7 @@
3027

3128
<ItemGroup>
3229
<PackageReference Include="CouchDB.NET" Version="3.3.*"/>
33-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1"/>
30+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0"/>
3431
</ItemGroup>
3532

3633
</Project>
Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
using System;
2-
using CouchDB.Driver.Helpers;
32
using CouchDB.Driver.Options;
43
using Microsoft.Extensions.DependencyInjection;
54

6-
namespace CouchDB.Driver.DependencyInjection
5+
namespace CouchDB.Driver.DependencyInjection;
6+
7+
public static class ServiceCollectionExtensions
78
{
8-
public static class ServiceCollectionExtensions
9+
public static IServiceCollection AddCouchContext<TContext>(this IServiceCollection services,
10+
Action<CouchOptionsBuilder<TContext>> optionBuilderAction)
11+
where TContext : CouchContext
912
{
10-
public static IServiceCollection AddCouchContext<TContext>(this IServiceCollection services,
11-
Action<CouchOptionsBuilder<TContext>> optionBuilderAction)
12-
where TContext : CouchContext
13-
{
14-
Check.NotNull(services, nameof(services));
15-
Check.NotNull(optionBuilderAction, nameof(optionBuilderAction));
16-
17-
var builder = new CouchOptionsBuilder<TContext>();
18-
optionBuilderAction?.Invoke(builder);
19-
return services
20-
.AddSingleton(builder.Options)
21-
.AddSingleton<TContext>();
22-
}
13+
ArgumentNullException.ThrowIfNull(services);
14+
ArgumentNullException.ThrowIfNull(optionBuilderAction);
15+
16+
var builder = new CouchOptionsBuilder<TContext>();
17+
optionBuilderAction?.Invoke(builder);
18+
return services
19+
.AddSingleton(builder.Options)
20+
.AddSingleton<TContext>();
2321
}
24-
}
22+
}

src/CouchDB.Driver/ChangesFeed/ChangesFeedFilter.cs

Lines changed: 51 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -4,63 +4,61 @@
44
using CouchDB.Driver.ChangesFeed.Filters;
55
using CouchDB.Driver.Types;
66

7-
namespace CouchDB.Driver.ChangesFeed
7+
namespace CouchDB.Driver.ChangesFeed;
8+
9+
/// <summary>
10+
/// Represent a filter for the changes feed.
11+
/// </summary>
12+
public class ChangesFeedFilter
813
{
914
/// <summary>
10-
/// Represent a filter for the changes feed.
15+
/// Create a filter for document IDs.
1116
/// </summary>
12-
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1052:Static holder types should be Static or NotInheritable", Justification = "<Pending>")]
13-
public class ChangesFeedFilter
14-
{
15-
/// <summary>
16-
/// Create a filter for document IDs.
17-
/// </summary>
18-
/// <param name="documentIds">The document IDs to use as filters.</param>
19-
/// <returns></returns>
20-
public static ChangesFeedFilter DocumentIds(IList<string> documentIds)
21-
=> new DocumentIdsChangesFeedFilter(documentIds);
17+
/// <param name="documentIds">The document IDs to use as filters.</param>
18+
/// <returns></returns>
19+
public static ChangesFeedFilter DocumentIds(IList<string> documentIds)
20+
=> new DocumentIdsChangesFeedFilter(documentIds);
2221

23-
/// <summary>
24-
/// Create a filter using the same syntax used to query.
25-
/// </summary>
26-
/// <remarks>
27-
/// This is significantly more efficient than using a JavaScript filter function and is the recommended option if filtering on document attributes only.
28-
/// </remarks>
29-
/// <typeparam name="TSource">The type of database documents.</typeparam>
30-
/// <param name="selector">The function used to filter.</param>
31-
/// <returns></returns>
32-
public static ChangesFeedFilter Selector<TSource>(Expression<Func<TSource, bool>> selector) where TSource : CouchDocument
33-
=> new SelectorChangesFeedFilter<TSource>(selector);
22+
/// <summary>
23+
/// Create a filter using the same syntax used to query.
24+
/// </summary>
25+
/// <remarks>
26+
/// This is significantly more efficient than using a JavaScript filter function and is the recommended option if filtering on document attributes only.
27+
/// </remarks>
28+
/// <typeparam name="TSource">The type of database documents.</typeparam>
29+
/// <param name="selector">The function used to filter.</param>
30+
/// <returns></returns>
31+
public static ChangesFeedFilter Selector<TSource>(Expression<Func<TSource, bool>> selector) where TSource : CouchDocument
32+
=> new SelectorChangesFeedFilter<TSource>(selector);
3433

35-
/// <summary>
36-
/// Create a filter that accepts only changes for any design document within the requested database.
37-
/// </summary>
38-
/// <returns></returns>
39-
public static ChangesFeedFilter Design()
40-
=> new DesignChangesFeedFilter();
34+
/// <summary>
35+
/// Create a filter that accepts only changes for any design document within the requested database.
36+
/// </summary>
37+
/// <returns></returns>
38+
public static ChangesFeedFilter Design()
39+
=> new DesignChangesFeedFilter();
4140

42-
/// <summary>
43-
/// Create a filter that uses an existing map function to the filter.
44-
/// </summary>
45-
/// <remarks>
46-
/// If the map function emits anything for the processed document it counts as accepted and the changes event emits to the feed.
47-
/// </remarks>
48-
/// <param name="view">The view.</param>
49-
/// <returns></returns>
50-
public static ChangesFeedFilter View(string view)
51-
=> new ViewChangesFeedFilter(view);
41+
/// <summary>
42+
/// Create a filter that uses an existing map function to the filter.
43+
/// </summary>
44+
/// <remarks>
45+
/// If the map function emits anything for the processed document it counts as accepted and the changes event emits to the feed.
46+
/// </remarks>
47+
/// <param name="view">The view.</param>
48+
/// <returns></returns>
49+
public static ChangesFeedFilter View(string view)
50+
=> new ViewChangesFeedFilter(view);
5251

53-
/// <summary>
54-
/// Create a filter using a design document filter function with optional query parameters.
55-
/// </summary>
56-
/// <remarks>
57-
/// The filter function in the design document can access query parameters via <c>req.query</c>.
58-
/// This is useful for passing partition keys or other custom filtering parameters.
59-
/// </remarks>
60-
/// <param name="filterName">The filter name in format "designdoc/filtername" (e.g., "replication/by_partition").</param>
61-
/// <param name="queryParameters">Optional query parameters to pass to the filter function.</param>
62-
/// <returns></returns>
63-
public static ChangesFeedFilter DesignDocument(string filterName, Dictionary<string, string>? queryParameters = null)
64-
=> new DesignDocumentChangesFeedFilter(filterName, queryParameters);
65-
}
66-
}
52+
/// <summary>
53+
/// Create a filter using a design document filter function with optional query parameters.
54+
/// </summary>
55+
/// <remarks>
56+
/// The filter function in the design document can access query parameters via <c>req.query</c>.
57+
/// This is useful for passing partition keys or other custom filtering parameters.
58+
/// </remarks>
59+
/// <param name="filterName">The filter name in format "designdoc/filtername" (e.g., "replication/by_partition").</param>
60+
/// <param name="queryParameters">Optional query parameters to pass to the filter function.</param>
61+
/// <returns></returns>
62+
public static ChangesFeedFilter DesignDocument(string filterName, Dictionary<string, string>? queryParameters = null)
63+
=> new DesignDocumentChangesFeedFilter(filterName, queryParameters);
64+
}

0 commit comments

Comments
 (0)