Skip to content

Commit e284b68

Browse files
Drop the obsolete EnableWriteSupport configuration option (#766)
* Drop the obsolete EnableWriteSupport configuration option fix #654 * Approved API
1 parent 5dda8b2 commit e284b68

File tree

5 files changed

+2
-30
lines changed

5 files changed

+2
-30
lines changed

docs/upgrade-guides/1.x.x-2.0.0.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,12 @@ var requestId = context.RequestId;
146146

147147
By default ServiceComposer responds only to HTTP `GET` requests, to enable write support, for example to handle `POST` requests, the following configuration can be used when adding ServiceComposer to the application:
148148

149-
<!-- snippet: enable-write-support -->
150-
<a id='snippet-enable-write-support'></a>
151149
```cs
152150
public void ConfigureServices(IServiceCollection services)
153151
{
154152
services.AddViewModelComposition(options => options.EnableWriteSupport());
155153
}
156154
```
157-
<sup><a href='/src/Snippets/WriteSupport/EnableWriteSupport.cs#L10-L15' title='Snippet source file'>snippet source</a> | <a href='#snippet-enable-write-support' title='Start of snippet'>anchor</a></sup>
158-
<!-- endSnippet -->
159155

160156
## IViewModelPreviewHandler Preview
161157

docs/upgrade-guides/2.0.0-2.1.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public void ConfigureServices(IServiceCollection services)
1717
services.AddViewModelComposition(options => options.DisableWriteSupport());
1818
}
1919
```
20-
<sup><a href='/src/Snippets/WriteSupport/EnableWriteSupport.cs#L20-L25' title='Snippet source file'>snippet source</a> | <a href='#snippet-disable-write-support' title='Start of snippet'>anchor</a></sup>
20+
<sup><a href='/src/Snippets/WriteSupport/EnableWriteSupport.cs#L9-L14' title='Snippet source file'>snippet source</a> | <a href='#snippet-disable-write-support' title='Start of snippet'>anchor</a></sup>
2121
<!-- endSnippet -->
2222

2323
When write support is disabled, `ServiceComposer.AspNetCore` will only respond to get requests.

src/ServiceComposer.AspNetCore.Tests/API/APIApprovals.Approve_API.verified.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,6 @@ namespace ServiceComposer.AspNetCore
124124
public void AddTypesRegistrationHandler(System.Func<System.Type, bool> typesFilter, System.Action<System.Collections.Generic.IEnumerable<System.Type>> registrationHandler) { }
125125
public void DisableWriteSupport() { }
126126
public void EnableCompositionOverControllers(bool useCaseInsensitiveRouteMatching = true) { }
127-
[System.Obsolete("EnableWriteSupport is obsolete. Starting v2.1.0, write support is enabled by defa" +
128-
"ult. Use DisableWriteSupport to disable it. It\'ll be considered an error in v3.0" +
129-
".0 and removed in v4.0.0", true)]
130-
public void EnableWriteSupport() { }
131127
public void RegisterCompositionHandler<T>() { }
132128
public void RegisterEndpointScopedViewModelFactory<T>()
133129
where T : ServiceComposer.AspNetCore.IEndpointScopedViewModelFactory { }
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
11
using System;
22

3-
namespace ServiceComposer.AspNetCore;
4-
5-
partial class ViewModelCompositionOptions
6-
{
7-
[Obsolete("EnableWriteSupport is obsolete. Starting v2.1.0, write support is enabled by default. Use DisableWriteSupport to disable it. It'll be considered an error in v3.0.0 and removed in v4.0.0", true)]
8-
public void EnableWriteSupport()
9-
{
10-
throw new NotSupportedException();
11-
}
12-
}
3+
namespace ServiceComposer.AspNetCore;

src/Snippets/WriteSupport/EnableWriteSupport.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,6 @@
44

55
namespace Snippets.WriteSupport;
66

7-
public class EnableWriteSupport
8-
{
9-
[Obsolete("This snippet is used only by an upgrade guide. The Obsolete is needed to prevent the EnableWriteSupport usage here to cause the snippet compilation to fail.")]
10-
// begin-snippet: enable-write-support
11-
public void ConfigureServices(IServiceCollection services)
12-
{
13-
services.AddViewModelComposition(options => options.EnableWriteSupport());
14-
}
15-
// end-snippet
16-
}
17-
187
public class DisableWriteSupport
198
{
209
// begin-snippet: disable-write-support

0 commit comments

Comments
 (0)