Skip to content

Commit 77f30dd

Browse files
committed
Updated the .editorconfig file and updated all .cs files to use file-scoped namespace declarations
1 parent 307cf42 commit 77f30dd

Some content is hidden

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

43 files changed

+2261
-2335
lines changed

src/.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Version 1.0.7
2+
13
# Remove the line below if you want to inherit .editorconfig settings from higher directories
24
root = true
35

@@ -209,3 +211,9 @@ dotnet_naming_style.require_underscore_prefix_and_camel_case.capitalization = ca
209211
dotnet_naming_rule.private_fields_must_begin_with_underscore_and_be_in_camel_case.symbols = private_fields
210212
dotnet_naming_rule.private_fields_must_begin_with_underscore_and_be_in_camel_case.style = require_underscore_prefix_and_camel_case
211213
dotnet_naming_rule.private_fields_must_begin_with_underscore_and_be_in_camel_case.severity = warning
214+
215+
# Prefer file-scoped namespace declarations
216+
csharp_style_namespace_declarations = file_scoped:warning
217+
218+
# Don't prefer or suggest primary constructors
219+
csharp_style_prefer_primary_constructors = false

src/Skybrud.Umbraco.GridData/Composers/GridComposer.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,18 @@
66
using Umbraco.Cms.Core.DependencyInjection;
77
using Umbraco.Extensions;
88

9-
namespace Skybrud.Umbraco.GridData.Composers {
9+
namespace Skybrud.Umbraco.GridData.Composers;
1010

11-
internal class GridComposer : IComposer {
11+
internal class GridComposer : IComposer {
1212

13-
public void Compose(IUmbracoBuilder builder) {
13+
public void Compose(IUmbracoBuilder builder) {
1414

15-
builder.Services.AddSingleton<GridContext>();
16-
builder.Services.AddUnique<IGridFactory, DefaultGridFactory>();
15+
builder.Services.AddSingleton<GridContext>();
16+
builder.Services.AddUnique<IGridFactory, DefaultGridFactory>();
1717

18-
builder.GridConverters().Append<UmbracoGridConverter>();
18+
builder.GridConverters().Append<UmbracoGridConverter>();
1919

20-
builder.ManifestFilters().Append<GridManifestFilter>();
21-
22-
}
20+
builder.ManifestFilters().Append<GridManifestFilter>();
2321

2422
}
2523

src/Skybrud.Umbraco.GridData/Composers/GridComposerExtensions.cs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,20 @@
33

44
// ReSharper disable InconsistentNaming
55

6-
namespace Skybrud.Umbraco.GridData.Composers {
6+
namespace Skybrud.Umbraco.GridData.Composers;
7+
8+
/// <summary>
9+
/// Static class with extension methods for composing the grid.
10+
/// </summary>
11+
public static class GridComposerExtensions {
712

813
/// <summary>
9-
/// Static class with extension methods for composing the grid.
14+
/// Returns the current instance of <see cref="GridConverterCollectionBuilder"/>.
1015
/// </summary>
11-
public static class GridComposerExtensions {
12-
13-
/// <summary>
14-
/// Returns the current instance of <see cref="GridConverterCollectionBuilder"/>.
15-
/// </summary>
16-
/// <param name="builder">The current <see cref="IUmbracoBuilder"/>.</param>
17-
/// <returns>An instance of <see cref="GridConverterCollectionBuilder"/>.</returns>
18-
public static GridConverterCollectionBuilder GridConverters(this IUmbracoBuilder builder) {
19-
return builder.WithCollectionBuilder<GridConverterCollectionBuilder>();
20-
}
21-
16+
/// <param name="builder">The current <see cref="IUmbracoBuilder"/>.</param>
17+
/// <returns>An instance of <see cref="GridConverterCollectionBuilder"/>.</returns>
18+
public static GridConverterCollectionBuilder GridConverters(this IUmbracoBuilder builder) {
19+
return builder.WithCollectionBuilder<GridConverterCollectionBuilder>();
2220
}
2321

2422
}

src/Skybrud.Umbraco.GridData/Converters/GridConverterBase.cs

Lines changed: 95 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -8,114 +8,112 @@
88
using Skybrud.Umbraco.GridData.Models.Values;
99
using Umbraco.Cms.Core.Models.PublishedContent;
1010

11-
namespace Skybrud.Umbraco.GridData.Converters {
11+
namespace Skybrud.Umbraco.GridData.Converters;
12+
13+
/// <summary>
14+
/// Abstract base implementation of <see cref="IGridConverter"/>.
15+
/// </summary>
16+
public abstract class GridConverterBase : IGridConverter {
1217

1318
/// <summary>
14-
/// Abstract base implementation of <see cref="IGridConverter"/>.
19+
/// Attemtps to get the type of the configuration object of the specified <paramref name="editor"/>.
1520
/// </summary>
16-
public abstract class GridConverterBase : IGridConverter {
17-
18-
/// <summary>
19-
/// Attemtps to get the type of the configuration object of the specified <paramref name="editor"/>.
20-
/// </summary>
21-
/// <param name="editor">The editor.</param>
22-
/// <param name="type">When this method returns, holds an instance of <see cref="Type"/> representing the type if successful; otherwise, <see langword="null"/>.</param>
23-
/// <returns><see langword="true"/> if successful; otherwise, <see langword="false"/>.</returns>
24-
public virtual bool TryGetConfigType(GridEditor editor, [NotNullWhen(true)] out Type? type) {
25-
type = null;
26-
return false;
27-
}
28-
29-
/// <summary>
30-
/// Attempts to get the type of the value of the specified <paramref name="control"/>.
31-
/// </summary>
32-
/// <param name="control">The control.</param>
33-
/// <param name="type">When this method returns, holds an instance of <see cref="Type"/> representing the type if successful; otherwise, <see langword="null"/>.</param>
34-
/// <returns><see langword="true"/> if successful; otherwise, <see langword="false"/>.</returns>
35-
public virtual bool TryGetValueType(GridControl control, [NotNullWhen(true)] out Type? type) {
36-
type = null;
37-
return false;
38-
}
21+
/// <param name="editor">The editor.</param>
22+
/// <param name="type">When this method returns, holds an instance of <see cref="Type"/> representing the type if successful; otherwise, <see langword="null"/>.</param>
23+
/// <returns><see langword="true"/> if successful; otherwise, <see langword="false"/>.</returns>
24+
public virtual bool TryGetConfigType(GridEditor editor, [NotNullWhen(true)] out Type? type) {
25+
type = null;
26+
return false;
27+
}
3928

40-
/// <summary>
41-
/// Converts the specified <paramref name="token"/> into an instance of <see cref="IGridControlValue"/>.
42-
/// </summary>
43-
/// <param name="control">A reference to the parent <see cref="GridControl"/>.</param>
44-
/// <param name="token">The instance of <see cref="JToken"/> representing the control value.</param>
45-
/// <param name="value">The converted control value.</param>
46-
public virtual bool TryConvertControlValue(GridControl control, JToken token, [NotNullWhen(true)] out IGridControlValue? value) {
47-
value = null;
48-
return false;
49-
}
29+
/// <summary>
30+
/// Attempts to get the type of the value of the specified <paramref name="control"/>.
31+
/// </summary>
32+
/// <param name="control">The control.</param>
33+
/// <param name="type">When this method returns, holds an instance of <see cref="Type"/> representing the type if successful; otherwise, <see langword="null"/>.</param>
34+
/// <returns><see langword="true"/> if successful; otherwise, <see langword="false"/>.</returns>
35+
public virtual bool TryGetValueType(GridControl control, [NotNullWhen(true)] out Type? type) {
36+
type = null;
37+
return false;
38+
}
5039

51-
/// <summary>
52-
/// Converts the specified <paramref name="token"/> into an instance of <see cref="IGridEditorConfig"/>.
53-
/// </summary>
54-
/// <param name="editor">A reference to the parent <see cref="GridEditor"/>.</param>
55-
/// <param name="token">The instance of <see cref="JToken"/> representing the editor config.</param>
56-
/// <param name="config">The converted editor config.</param>
57-
public virtual bool TryConvertEditorConfig(GridEditor editor, JToken token, [NotNullWhen(true)] out IGridEditorConfig? config) {
58-
config = null;
59-
return false;
60-
}
40+
/// <summary>
41+
/// Converts the specified <paramref name="token"/> into an instance of <see cref="IGridControlValue"/>.
42+
/// </summary>
43+
/// <param name="control">A reference to the parent <see cref="GridControl"/>.</param>
44+
/// <param name="token">The instance of <see cref="JToken"/> representing the control value.</param>
45+
/// <param name="value">The converted control value.</param>
46+
public virtual bool TryConvertControlValue(GridControl control, JToken token, [NotNullWhen(true)] out IGridControlValue? value) {
47+
value = null;
48+
return false;
49+
}
6150

62-
/// <summary>
63-
/// Writes a string representation of <paramref name="element"/> to <paramref name="writer"/>.
64-
/// </summary>
65-
/// <param name="context">The current grid context.</param>
66-
/// <param name="element">The element.</param>
67-
/// <param name="writer">The writer.</param>
68-
/// <returns><see langword="true"/> if successful; otherwise, <see langword="false"/>.</returns>
69-
public virtual bool TryWriteSearchableText(GridContext context, IPublishedElement element, TextWriter writer) {
70-
return false;
71-
}
51+
/// <summary>
52+
/// Converts the specified <paramref name="token"/> into an instance of <see cref="IGridEditorConfig"/>.
53+
/// </summary>
54+
/// <param name="editor">A reference to the parent <see cref="GridEditor"/>.</param>
55+
/// <param name="token">The instance of <see cref="JToken"/> representing the editor config.</param>
56+
/// <param name="config">The converted editor config.</param>
57+
public virtual bool TryConvertEditorConfig(GridEditor editor, JToken token, [NotNullWhen(true)] out IGridEditorConfig? config) {
58+
config = null;
59+
return false;
60+
}
7261

73-
/// <summary>
74-
/// Attempts to check whether the specified <paramref name="value"/> represents a valid grid control value.
75-
/// </summary>
76-
/// <param name="value">The value to check.</param>
77-
/// <param name="result">When this method returns, holds a boolean value indicating whether <paramref name="value"/> is valid if successful; otherwise, <see langword="false"/>.</param>
78-
/// <returns><see langword="true"/> if successful; otherwise, <see langword="false"/>.</returns>
79-
public virtual bool TryGetValid(IGridControlValue value, out bool result) {
80-
result = false;
81-
return false;
82-
}
62+
/// <summary>
63+
/// Writes a string representation of <paramref name="element"/> to <paramref name="writer"/>.
64+
/// </summary>
65+
/// <param name="context">The current grid context.</param>
66+
/// <param name="element">The element.</param>
67+
/// <param name="writer">The writer.</param>
68+
/// <returns><see langword="true"/> if successful; otherwise, <see langword="false"/>.</returns>
69+
public virtual bool TryWriteSearchableText(GridContext context, IPublishedElement element, TextWriter writer) {
70+
return false;
71+
}
8372

84-
/// <summary>
85-
/// Attempts to check whether the specified <paramref name="element"/> represents a valid element.
86-
/// </summary>
87-
/// <param name="element">The element.</param>
88-
/// <param name="result">When this method returns, holds a boolean value indicating whether <paramref name="element"/> is valid if successful; otherwise, <see langword="false"/>.</param>
89-
/// <returns><see langword="true"/> if successful; otherwise, <see langword="false"/>.</returns>
90-
public virtual bool TryGetValid(IPublishedElement element, out bool result) {
91-
result = false;
92-
return false;
93-
}
73+
/// <summary>
74+
/// Attempts to check whether the specified <paramref name="value"/> represents a valid grid control value.
75+
/// </summary>
76+
/// <param name="value">The value to check.</param>
77+
/// <param name="result">When this method returns, holds a boolean value indicating whether <paramref name="value"/> is valid if successful; otherwise, <see langword="false"/>.</param>
78+
/// <returns><see langword="true"/> if successful; otherwise, <see langword="false"/>.</returns>
79+
public virtual bool TryGetValid(IGridControlValue value, out bool result) {
80+
result = false;
81+
return false;
82+
}
9483

95-
/// <summary>
96-
/// Returns whether <paramref name="value"/> is contained in <paramref name="source"/> (case insensitive).
97-
/// </summary>
98-
/// <param name="source">The source string.</param>
99-
/// <param name="value">The value to search for.</param>
100-
/// <returns><c>true</c> if <paramref name="source"/> contains <paramref name="value"/>; otherwise <c>false</c>.</returns>
101-
protected bool ContainsIgnoreCase(string source, string value) {
102-
if (string.IsNullOrWhiteSpace(source)) return false;
103-
if (string.IsNullOrWhiteSpace(value)) return false;
104-
return CultureInfo.InvariantCulture.CompareInfo.IndexOf(source, value, CompareOptions.IgnoreCase) >= 0;
105-
}
84+
/// <summary>
85+
/// Attempts to check whether the specified <paramref name="element"/> represents a valid element.
86+
/// </summary>
87+
/// <param name="element">The element.</param>
88+
/// <param name="result">When this method returns, holds a boolean value indicating whether <paramref name="element"/> is valid if successful; otherwise, <see langword="false"/>.</param>
89+
/// <returns><see langword="true"/> if successful; otherwise, <see langword="false"/>.</returns>
90+
public virtual bool TryGetValid(IPublishedElement element, out bool result) {
91+
result = false;
92+
return false;
93+
}
10694

107-
/// <summary>
108-
/// Returns whether <paramref name="value"/> is equal <paramref name="source"/> (case insensitive).
109-
/// </summary>
110-
/// <param name="source">The source string.</param>
111-
/// <param name="value">The value to search for.</param>
112-
/// <returns><c>true</c> if <paramref name="value"/> equal to <paramref name="source"/>; otherwise <c>false</c>.</returns>
113-
protected bool EqualsIgnoreCase(string source, string value) {
114-
if (string.IsNullOrWhiteSpace(source)) return false;
115-
if (string.IsNullOrWhiteSpace(value)) return false;
116-
return source.Equals(value, StringComparison.InvariantCultureIgnoreCase);
117-
}
95+
/// <summary>
96+
/// Returns whether <paramref name="value"/> is contained in <paramref name="source"/> (case insensitive).
97+
/// </summary>
98+
/// <param name="source">The source string.</param>
99+
/// <param name="value">The value to search for.</param>
100+
/// <returns><c>true</c> if <paramref name="source"/> contains <paramref name="value"/>; otherwise <c>false</c>.</returns>
101+
protected bool ContainsIgnoreCase(string source, string value) {
102+
if (string.IsNullOrWhiteSpace(source)) return false;
103+
if (string.IsNullOrWhiteSpace(value)) return false;
104+
return CultureInfo.InvariantCulture.CompareInfo.IndexOf(source, value, CompareOptions.IgnoreCase) >= 0;
105+
}
118106

107+
/// <summary>
108+
/// Returns whether <paramref name="value"/> is equal <paramref name="source"/> (case insensitive).
109+
/// </summary>
110+
/// <param name="source">The source string.</param>
111+
/// <param name="value">The value to search for.</param>
112+
/// <returns><c>true</c> if <paramref name="value"/> equal to <paramref name="source"/>; otherwise <c>false</c>.</returns>
113+
protected bool EqualsIgnoreCase(string source, string value) {
114+
if (string.IsNullOrWhiteSpace(source)) return false;
115+
if (string.IsNullOrWhiteSpace(value)) return false;
116+
return source.Equals(value, StringComparison.InvariantCultureIgnoreCase);
119117
}
120118

121119
}

src/Skybrud.Umbraco.GridData/Converters/GridConverterCollection.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,17 @@
22
using System.Collections.Generic;
33
using Umbraco.Cms.Core.Composing;
44

5-
namespace Skybrud.Umbraco.GridData.Converters {
5+
namespace Skybrud.Umbraco.GridData.Converters;
6+
7+
/// <summary>
8+
/// Collection of <see cref="IGridConverter"/>.
9+
/// </summary>
10+
public class GridConverterCollection : BuilderCollectionBase<IGridConverter> {
611

712
/// <summary>
8-
/// Collection of <see cref="IGridConverter"/>.
13+
/// Initializes a new converter collection based on the specified <paramref name="items"/>.
914
/// </summary>
10-
public class GridConverterCollection : BuilderCollectionBase<IGridConverter> {
11-
12-
/// <summary>
13-
/// Initializes a new converter collection based on the specified <paramref name="items"/>.
14-
/// </summary>
15-
/// <param name="items">The items to make up the collection.</param>
16-
public GridConverterCollection(Func<IEnumerable<IGridConverter>> items) : base(items) { }
17-
18-
}
15+
/// <param name="items">The items to make up the collection.</param>
16+
public GridConverterCollection(Func<IEnumerable<IGridConverter>> items) : base(items) { }
1917

2018
}
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
using Umbraco.Cms.Core.Composing;
22

3-
namespace Skybrud.Umbraco.GridData.Converters {
3+
namespace Skybrud.Umbraco.GridData.Converters;
44

5-
/// <inheritdoc />
6-
public class GridConverterCollectionBuilder : OrderedCollectionBuilderBase<GridConverterCollectionBuilder, GridConverterCollection, IGridConverter> {
7-
8-
/// <inheritdoc />
9-
protected override GridConverterCollectionBuilder This => this;
5+
/// <inheritdoc />
6+
public class GridConverterCollectionBuilder : OrderedCollectionBuilderBase<GridConverterCollectionBuilder, GridConverterCollection, IGridConverter> {
107

11-
}
8+
/// <inheritdoc />
9+
protected override GridConverterCollectionBuilder This => this;
1210

1311
}

0 commit comments

Comments
 (0)