Skip to content

Commit ff3cb76

Browse files
committed
Moving ctors to internal
1 parent eada9b4 commit ff3cb76

30 files changed

+78
-148
lines changed

src/Http/Http.Results/src/AcceptedAtRouteHttpResult.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public sealed class AcceptedAtRouteHttpResult : IResult
2020
/// </summary>
2121
/// <param name="routeValues">The route data to use for generating the URL.</param>
2222
/// <param name="value">The value to format in the entity body.</param>
23-
public AcceptedAtRouteHttpResult(object? routeValues, object? value)
23+
internal AcceptedAtRouteHttpResult(object? routeValues, object? value)
2424
: this(routeName: null, routeValues: routeValues, value: value)
2525
{
2626
}
@@ -32,7 +32,7 @@ public AcceptedAtRouteHttpResult(object? routeValues, object? value)
3232
/// <param name="routeName">The name of the route to use for generating the URL.</param>
3333
/// <param name="routeValues">The route data to use for generating the URL.</param>
3434
/// <param name="value">The value to format in the entity body.</param>
35-
public AcceptedAtRouteHttpResult(
35+
internal AcceptedAtRouteHttpResult(
3636
string? routeName,
3737
object? routeValues,
3838
object? value)

src/Http/Http.Results/src/AcceptedHttpResult.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public sealed class AcceptedHttpResult : IResult
1818
/// </summary>
1919
/// <param name="location">The location at which the status of requested content can be monitored.</param>
2020
/// <param name="value">The value to format in the entity body.</param>
21-
public AcceptedHttpResult(string? location, object? value)
21+
internal AcceptedHttpResult(string? location, object? value)
2222
{
2323
Value = value;
2424
Location = location;
@@ -31,7 +31,7 @@ public AcceptedHttpResult(string? location, object? value)
3131
/// </summary>
3232
/// <param name="locationUri">The location at which the status of requested content can be monitored.</param>
3333
/// <param name="value">The value to format in the entity body.</param>
34-
public AcceptedHttpResult(Uri locationUri, object? value)
34+
internal AcceptedHttpResult(Uri locationUri, object? value)
3535
{
3636
Value = value;
3737
HttpResultsHelper.ApplyProblemDetailsDefaultsIfNeeded(Value, StatusCode);

src/Http/Http.Results/src/BadRequestObjectHttpResult.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public sealed class BadRequestObjectHttpResult : IResult
1414
/// provided.
1515
/// </summary>
1616
/// <param name="error">The error content to format in the entity body.</param>
17-
public BadRequestObjectHttpResult(object? error)
17+
internal BadRequestObjectHttpResult(object? error)
1818
{
1919
Value = error;
2020
HttpResultsHelper.ApplyProblemDetailsDefaultsIfNeeded(Value, StatusCode);

src/Http/Http.Results/src/ChallengeHttpResult.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public sealed partial class ChallengeHttpResult : IResult
1616
/// <summary>
1717
/// Initializes a new instance of <see cref="ChallengeHttpResult"/>.
1818
/// </summary>
19-
public ChallengeHttpResult()
19+
internal ChallengeHttpResult()
2020
: this(Array.Empty<string>())
2121
{
2222
}
@@ -26,7 +26,7 @@ public ChallengeHttpResult()
2626
/// specified authentication scheme.
2727
/// </summary>
2828
/// <param name="authenticationScheme">The authentication scheme to challenge.</param>
29-
public ChallengeHttpResult(string authenticationScheme)
29+
internal ChallengeHttpResult(string authenticationScheme)
3030
: this(new[] { authenticationScheme })
3131
{
3232
}
@@ -36,7 +36,7 @@ public ChallengeHttpResult(string authenticationScheme)
3636
/// specified authentication schemes.
3737
/// </summary>
3838
/// <param name="authenticationSchemes">The authentication schemes to challenge.</param>
39-
public ChallengeHttpResult(IList<string> authenticationSchemes)
39+
internal ChallengeHttpResult(IList<string> authenticationSchemes)
4040
: this(authenticationSchemes, properties: null)
4141
{
4242
}
@@ -47,7 +47,7 @@ public ChallengeHttpResult(IList<string> authenticationSchemes)
4747
/// </summary>
4848
/// <param name="properties"><see cref="AuthenticationProperties"/> used to perform the authentication
4949
/// challenge.</param>
50-
public ChallengeHttpResult(AuthenticationProperties? properties)
50+
internal ChallengeHttpResult(AuthenticationProperties? properties)
5151
: this(Array.Empty<string>(), properties)
5252
{
5353
}
@@ -59,7 +59,7 @@ public ChallengeHttpResult(AuthenticationProperties? properties)
5959
/// <param name="authenticationScheme">The authentication schemes to challenge.</param>
6060
/// <param name="properties"><see cref="AuthenticationProperties"/> used to perform the authentication
6161
/// challenge.</param>
62-
public ChallengeHttpResult(string authenticationScheme, AuthenticationProperties? properties)
62+
internal ChallengeHttpResult(string authenticationScheme, AuthenticationProperties? properties)
6363
: this(new[] { authenticationScheme }, properties)
6464
{
6565
}
@@ -71,7 +71,7 @@ public ChallengeHttpResult(string authenticationScheme, AuthenticationProperties
7171
/// <param name="authenticationSchemes">The authentication scheme to challenge.</param>
7272
/// <param name="properties"><see cref="AuthenticationProperties"/> used to perform the authentication
7373
/// challenge.</param>
74-
public ChallengeHttpResult(IList<string> authenticationSchemes, AuthenticationProperties? properties)
74+
internal ChallengeHttpResult(IList<string> authenticationSchemes, AuthenticationProperties? properties)
7575
{
7676
AuthenticationSchemes = authenticationSchemes.AsReadOnly();
7777
Properties = properties;

src/Http/Http.Results/src/ConflictObjectHttpResult.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public sealed class ConflictObjectHttpResult : IResult
1414
/// provided.
1515
/// </summary>
1616
/// <param name="error">The error content to format in the entity body.</param>
17-
public ConflictObjectHttpResult(object? error)
17+
internal ConflictObjectHttpResult(object? error)
1818
{
1919
Value = error;
2020
HttpResultsHelper.ApplyProblemDetailsDefaultsIfNeeded(Value, StatusCode);

src/Http/Http.Results/src/ContentHttpResult.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public sealed partial class ContentHttpResult : IResult
1414
/// </summary>
1515
/// <param name="content">The value to format in the entity body.</param>
1616
/// <param name="contentType">The Content-Type header for the response</param>
17-
public ContentHttpResult(string? content, string? contentType)
17+
internal ContentHttpResult(string? content, string? contentType)
1818
: this(content, contentType, statusCode: null)
1919
{
2020
}
@@ -25,7 +25,7 @@ public ContentHttpResult(string? content, string? contentType)
2525
/// <param name="content">The value to format in the entity body.</param>
2626
/// <param name="statusCode">The HTTP status code of the response.</param>
2727
/// <param name="contentType">The Content-Type header for the response</param>
28-
public ContentHttpResult(string? content, string? contentType, int? statusCode)
28+
internal ContentHttpResult(string? content, string? contentType, int? statusCode)
2929
{
3030
Content = content;
3131
StatusCode = statusCode;

src/Http/Http.Results/src/CreatedAtRouteHttpResult.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public sealed class CreatedAtRouteHttpResult : IResult
1919
/// </summary>
2020
/// <param name="routeValues">The route data to use for generating the URL.</param>
2121
/// <param name="value">The value to format in the entity body.</param>
22-
public CreatedAtRouteHttpResult(object? routeValues, object? value)
22+
internal CreatedAtRouteHttpResult(object? routeValues, object? value)
2323
: this(routeName: null, routeValues: routeValues, value: value)
2424
{
2525
}
@@ -31,7 +31,7 @@ public CreatedAtRouteHttpResult(object? routeValues, object? value)
3131
/// <param name="routeName">The name of the route to use for generating the URL.</param>
3232
/// <param name="routeValues">The route data to use for generating the URL.</param>
3333
/// <param name="value">The value to format in the entity body.</param>
34-
public CreatedAtRouteHttpResult(
34+
internal CreatedAtRouteHttpResult(
3535
string? routeName,
3636
object? routeValues,
3737
object? value)

src/Http/Http.Results/src/CreatedHttpResult.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public sealed class CreatedHttpResult : IResult
1515
/// </summary>
1616
/// <param name="location">The location at which the content has been created.</param>
1717
/// <param name="value">The value to format in the entity body.</param>
18-
public CreatedHttpResult(string location, object? value)
18+
internal CreatedHttpResult(string location, object? value)
1919
{
2020
Value = value;
2121
Location = location;
@@ -28,7 +28,7 @@ public CreatedHttpResult(string location, object? value)
2828
/// </summary>
2929
/// <param name="locationUri">The location at which the content has been created.</param>
3030
/// <param name="value">The value to format in the entity body.</param>
31-
public CreatedHttpResult(Uri locationUri, object? value)
31+
internal CreatedHttpResult(Uri locationUri, object? value)
3232
{
3333
Value = value;
3434
HttpResultsHelper.ApplyProblemDetailsDefaultsIfNeeded(Value, StatusCode);

src/Http/Http.Results/src/EmptyHttpResult.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ namespace Microsoft.AspNetCore.Http;
99
/// </summary>
1010
public sealed class EmptyHttpResult : IResult
1111
{
12-
/// <summary>
13-
/// Gets an instance of <see cref="EmptyHttpResult"/>.
14-
/// </summary>
15-
public static readonly EmptyHttpResult Instance = new();
16-
1712
private EmptyHttpResult()
1813
{
1914
}
2015

16+
/// <summary>
17+
/// Gets an instance of <see cref="EmptyHttpResult"/>.
18+
/// </summary>
19+
public static EmptyHttpResult Instance => new();
20+
2121
/// <inheritdoc/>
2222
public Task ExecuteAsync(HttpContext httpContext)
2323
{

src/Http/Http.Results/src/FileContentHttpResult.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public sealed partial class FileContentHttpResult : IResult
1919
/// </summary>
2020
/// <param name="fileContents">The bytes that represent the file contents.</param>
2121
/// <param name="contentType">The Content-Type of the file.</param>
22-
public FileContentHttpResult(ReadOnlyMemory<byte> fileContents, string? contentType)
22+
internal FileContentHttpResult(ReadOnlyMemory<byte> fileContents, string? contentType)
2323
: this(fileContents, contentType, fileDownloadName: null)
2424
{
2525
}
@@ -32,7 +32,7 @@ public FileContentHttpResult(ReadOnlyMemory<byte> fileContents, string? contentT
3232
/// <param name="fileContents">The bytes that represent the file contents.</param>
3333
/// <param name="contentType">The Content-Type header of the response.</param>
3434
/// <param name="fileDownloadName">The suggested file name.</param>
35-
public FileContentHttpResult(
35+
internal FileContentHttpResult(
3636
ReadOnlyMemory<byte> fileContents,
3737
string? contentType,
3838
string? fileDownloadName)
@@ -49,7 +49,7 @@ public FileContentHttpResult(
4949
/// <param name="enableRangeProcessing">Set to <c>true</c> to enable range requests processing.</param>
5050
/// <param name="lastModified">The <see cref="DateTimeOffset"/> of when the file was last modified.</param>
5151
/// <param name="entityTag">The <see cref="EntityTagHeaderValue"/> associated with the file.</param>
52-
public FileContentHttpResult(
52+
internal FileContentHttpResult(
5353
ReadOnlyMemory<byte> fileContents,
5454
string? contentType,
5555
string? fileDownloadName,

src/Http/Http.Results/src/FileStreamHttpResult.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public sealed class FileStreamHttpResult : IResult
1919
/// </summary>
2020
/// <param name="fileStream">The stream with the file.</param>
2121
/// <param name="contentType">The Content-Type of the file.</param>
22-
public FileStreamHttpResult(Stream fileStream, string? contentType)
22+
internal FileStreamHttpResult(Stream fileStream, string? contentType)
2323
: this(fileStream, contentType, fileDownloadName: null)
2424
{
2525
}
@@ -32,7 +32,7 @@ public FileStreamHttpResult(Stream fileStream, string? contentType)
3232
/// <param name="fileStream">The stream with the file.</param>
3333
/// <param name="contentType">The Content-Type header of the response.</param>
3434
/// <param name="fileDownloadName">The suggested file name.</param>
35-
public FileStreamHttpResult(
35+
internal FileStreamHttpResult(
3636
Stream fileStream,
3737
string? contentType,
3838
string? fileDownloadName)
@@ -49,7 +49,7 @@ public FileStreamHttpResult(
4949
/// <param name="enableRangeProcessing">Set to <c>true</c> to enable range requests processing.</param>
5050
/// <param name="lastModified">The <see cref="DateTimeOffset"/> of when the file was last modified.</param>
5151
/// <param name="entityTag">The <see cref="EntityTagHeaderValue"/> associated with the file.</param>
52-
public FileStreamHttpResult(
52+
internal FileStreamHttpResult(
5353
Stream fileStream,
5454
string? contentType,
5555
string? fileDownloadName,

src/Http/Http.Results/src/ForbidHttpResult.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public sealed partial class ForbidHttpResult : IResult
1616
/// <summary>
1717
/// Initializes a new instance of <see cref="ForbidHttpResult"/>.
1818
/// </summary>
19-
public ForbidHttpResult()
19+
internal ForbidHttpResult()
2020
: this(Array.Empty<string>())
2121
{
2222
}
@@ -26,7 +26,7 @@ public ForbidHttpResult()
2626
/// specified authentication scheme.
2727
/// </summary>
2828
/// <param name="authenticationScheme">The authentication scheme to challenge.</param>
29-
public ForbidHttpResult(string authenticationScheme)
29+
internal ForbidHttpResult(string authenticationScheme)
3030
: this(new[] { authenticationScheme })
3131
{
3232
}
@@ -36,7 +36,7 @@ public ForbidHttpResult(string authenticationScheme)
3636
/// specified authentication schemes.
3737
/// </summary>
3838
/// <param name="authenticationSchemes">The authentication schemes to challenge.</param>
39-
public ForbidHttpResult(IList<string> authenticationSchemes)
39+
internal ForbidHttpResult(IList<string> authenticationSchemes)
4040
: this(authenticationSchemes, properties: null)
4141
{
4242
}
@@ -47,7 +47,7 @@ public ForbidHttpResult(IList<string> authenticationSchemes)
4747
/// </summary>
4848
/// <param name="properties"><see cref="AuthenticationProperties"/> used to perform the authentication
4949
/// challenge.</param>
50-
public ForbidHttpResult(AuthenticationProperties? properties)
50+
internal ForbidHttpResult(AuthenticationProperties? properties)
5151
: this(Array.Empty<string>(), properties)
5252
{
5353
}
@@ -59,7 +59,7 @@ public ForbidHttpResult(AuthenticationProperties? properties)
5959
/// <param name="authenticationScheme">The authentication schemes to challenge.</param>
6060
/// <param name="properties"><see cref="AuthenticationProperties"/> used to perform the authentication
6161
/// challenge.</param>
62-
public ForbidHttpResult(string authenticationScheme, AuthenticationProperties? properties)
62+
internal ForbidHttpResult(string authenticationScheme, AuthenticationProperties? properties)
6363
: this(new[] { authenticationScheme }, properties)
6464
{
6565
}
@@ -71,7 +71,7 @@ public ForbidHttpResult(string authenticationScheme, AuthenticationProperties? p
7171
/// <param name="authenticationSchemes">The authentication scheme to challenge.</param>
7272
/// <param name="properties"><see cref="AuthenticationProperties"/> used to perform the authentication
7373
/// challenge.</param>
74-
public ForbidHttpResult(IList<string> authenticationSchemes, AuthenticationProperties? properties)
74+
internal ForbidHttpResult(IList<string> authenticationSchemes, AuthenticationProperties? properties)
7575
{
7676
AuthenticationSchemes = authenticationSchemes.AsReadOnly();
7777
Properties = properties;

src/Http/Http.Results/src/JsonHttpResult.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public sealed class JsonHttpResult : IResult
1515
/// </summary>
1616
/// <param name="value">The value to format in the entity body.</param>
1717
/// <param name="jsonSerializerOptions">The serializer settings.</param>
18-
public JsonHttpResult(object? value, JsonSerializerOptions? jsonSerializerOptions)
18+
internal JsonHttpResult(object? value, JsonSerializerOptions? jsonSerializerOptions)
1919
: this(value, statusCode: null, contentType: null, jsonSerializerOptions: jsonSerializerOptions)
2020
{
2121
}
@@ -26,7 +26,7 @@ public JsonHttpResult(object? value, JsonSerializerOptions? jsonSerializerOption
2626
/// <param name="value">The value to format in the entity body.</param>
2727
/// <param name="statusCode">The HTTP status code of the response.</param>
2828
/// <param name="jsonSerializerOptions">The serializer settings.</param>
29-
public JsonHttpResult(object? value, int? statusCode, JsonSerializerOptions? jsonSerializerOptions)
29+
internal JsonHttpResult(object? value, int? statusCode, JsonSerializerOptions? jsonSerializerOptions)
3030
: this(value, statusCode: statusCode, contentType: null, jsonSerializerOptions: jsonSerializerOptions)
3131
{
3232
}
@@ -37,7 +37,7 @@ public JsonHttpResult(object? value, int? statusCode, JsonSerializerOptions? jso
3737
/// <param name="value">The value to format in the entity body.</param>
3838
/// <param name="contentType">The value for the <c>Content-Type</c> header</param>
3939
/// <param name="jsonSerializerOptions">The serializer settings.</param>
40-
public JsonHttpResult(object? value, string? contentType, JsonSerializerOptions? jsonSerializerOptions)
40+
internal JsonHttpResult(object? value, string? contentType, JsonSerializerOptions? jsonSerializerOptions)
4141
: this(value, statusCode: null, contentType: contentType, jsonSerializerOptions: jsonSerializerOptions)
4242
{
4343

@@ -50,7 +50,7 @@ public JsonHttpResult(object? value, string? contentType, JsonSerializerOptions?
5050
/// <param name="statusCode">The HTTP status code of the response.</param>
5151
/// <param name="jsonSerializerOptions">The serializer settings.</param>
5252
/// <param name="contentType">The value for the <c>Content-Type</c> header</param>
53-
public JsonHttpResult(object? value, int? statusCode, string? contentType, JsonSerializerOptions? jsonSerializerOptions)
53+
internal JsonHttpResult(object? value, int? statusCode, string? contentType, JsonSerializerOptions? jsonSerializerOptions)
5454
{
5555
Value = value;
5656
StatusCode = statusCode;

src/Http/Http.Results/src/NoContentHttpResult.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class NoContentHttpResult : IResult
1515
/// <summary>
1616
/// Initializes a new instance of the <see cref="NoContentHttpResult"/> class.
1717
/// </summary>
18-
public NoContentHttpResult()
18+
internal NoContentHttpResult()
1919
{
2020
}
2121

src/Http/Http.Results/src/NotFoundObjectHttpResult.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public sealed class NotFoundObjectHttpResult : IResult
1313
/// Initializes a new instance of the <see cref="NotFoundObjectHttpResult"/> class with the values.
1414
/// </summary>
1515
/// <param name="value">The value to format in the entity body.</param>
16-
public NotFoundObjectHttpResult(object? value)
16+
internal NotFoundObjectHttpResult(object? value)
1717
{
1818
Value = value;
1919
HttpResultsHelper.ApplyProblemDetailsDefaultsIfNeeded(Value, StatusCode);

src/Http/Http.Results/src/ObjectHttpResult.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ internal sealed class ObjectHttpResult : IResult
1414
/// Creates a new <see cref="ObjectHttpResult"/> instance
1515
/// with the provided <paramref name="value"/>.
1616
/// </summary>
17-
public ObjectHttpResult(object? value)
17+
internal ObjectHttpResult(object? value)
1818
: this(value, null)
1919
{
2020
}
@@ -23,7 +23,7 @@ public ObjectHttpResult(object? value)
2323
/// Creates a new <see cref="ObjectHttpResult"/> instance with the provided
2424
/// <paramref name="value"/>, <paramref name="statusCode"/>.
2525
/// </summary>
26-
public ObjectHttpResult(object? value, int? statusCode)
26+
internal ObjectHttpResult(object? value, int? statusCode)
2727
: this(value, statusCode, contentType: null)
2828
{
2929
}
@@ -32,7 +32,7 @@ public ObjectHttpResult(object? value, int? statusCode)
3232
/// Creates a new <see cref="ObjectHttpResult"/> instance with the provided
3333
/// <paramref name="value"/>, <paramref name="statusCode"/> and <paramref name="contentType"/>.
3434
/// </summary>
35-
public ObjectHttpResult(object? value, int? statusCode, string? contentType)
35+
internal ObjectHttpResult(object? value, int? statusCode, string? contentType)
3636
{
3737
Value = value;
3838

src/Http/Http.Results/src/OkObjectHttpResult.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public sealed class OkObjectHttpResult : IResult
1515
/// Initializes a new instance of the <see cref="OkObjectHttpResult"/> class with the values.
1616
/// </summary>
1717
/// <param name="value">The value to format in the entity body.</param>
18-
public OkObjectHttpResult(object? value)
18+
internal OkObjectHttpResult(object? value)
1919
{
2020
Value = value;
2121
HttpResultsHelper.ApplyProblemDetailsDefaultsIfNeeded(Value, StatusCode);

0 commit comments

Comments
 (0)