Skip to content

Commit 99060a9

Browse files
committed
Remove Microsoft.AspNetCore.Mvc.WebApiCompatShim
1 parent aeda43d commit 99060a9

26 files changed

+403
-641
lines changed

Microsoft.SCIM.WebHostSample/Provider/InMemoryGroupProvider.cs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ namespace Microsoft.SCIM.WebHostSample.Provider
88
using System.Linq.Expressions;
99
using System.Net;
1010
using System.Threading.Tasks;
11-
using System.Web.Http;
1211
using Microsoft.SCIM;
1312

1413
public class InMemoryGroupProvider : ProviderBase
@@ -20,18 +19,18 @@ public InMemoryGroupProvider()
2019
this.storage = InMemoryStorage.Instance;
2120
}
2221

23-
public override Task<Resource> CreateAsync(Resource resource, string correlationIdentifier)
22+
public override Task<Resource>CreateAsync(Resource resource, string correlationIdentifier)
2423
{
2524
if (resource.Identifier != null)
2625
{
27-
throw new HttpResponseException(HttpStatusCode.BadRequest);
26+
throw new CustomHttpResponseException(HttpStatusCode.BadRequest);
2827
}
2928

3029
Core2Group group = resource as Core2Group;
3130

3231
if (string.IsNullOrWhiteSpace(group.DisplayName))
3332
{
34-
throw new HttpResponseException(HttpStatusCode.BadRequest);
33+
throw new CustomHttpResponseException(HttpStatusCode.BadRequest);
3534
}
3635

3736
IEnumerable<Core2Group> exisitingGroups = this.storage.Groups.Values;
@@ -42,7 +41,7 @@ public override Task<Resource> CreateAsync(Resource resource, string correlation
4241
string.Equals(exisitingGroup.DisplayName, group.DisplayName, StringComparison.Ordinal))
4342
)
4443
{
45-
throw new HttpResponseException(HttpStatusCode.Conflict);
44+
throw new CustomHttpResponseException(HttpStatusCode.Conflict);
4645
}
4746
//Update Metadata
4847
DateTime created = DateTime.UtcNow;
@@ -56,21 +55,23 @@ public override Task<Resource> CreateAsync(Resource resource, string correlation
5655
return Task.FromResult(resource);
5756
}
5857

59-
public override Task DeleteAsync(IResourceIdentifier resourceIdentifier, string correlationIdentifier)
58+
public override Task<Resource> DeleteAsync(IResourceIdentifier resourceIdentifier,
59+
string correlationIdentifier)
6060
{
6161
if (string.IsNullOrWhiteSpace(resourceIdentifier?.Identifier))
6262
{
63-
throw new HttpResponseException(HttpStatusCode.BadRequest);
63+
throw new CustomHttpResponseException(HttpStatusCode.BadRequest);
6464
}
6565

6666
string identifier = resourceIdentifier.Identifier;
6767

6868
if (this.storage.Groups.ContainsKey(identifier))
6969
{
70+
var group = this.storage.Groups[identifier];
7071
this.storage.Groups.Remove(identifier);
72+
return Task.FromResult(group as Resource);
7173
}
72-
73-
return Task.CompletedTask;
74+
throw new CustomHttpResponseException(HttpStatusCode.NotFound);
7475
}
7576

7677
public override Task<Resource[]> QueryAsync(IQueryParameters parameters, string correlationIdentifier)
@@ -127,17 +128,17 @@ public override Task<Resource[]> QueryAsync(IQueryParameters parameters, string
127128

128129
if (queryFilter.AttributePath.Equals(AttributeNames.DisplayName))
129130
{
130-
131+
131132
string displayName = queryFilter.ComparisonValue;
132133
predicateAnd = predicateAnd.And(p => string.Equals(p.DisplayName, displayName, StringComparison.OrdinalIgnoreCase));
133-
134+
134135
}
135136
else
136137
{
137138
throw new NotSupportedException(string.Format(SystemForCrossDomainIdentityManagementServiceResources.ExceptionFilterAttributePathNotSupportedTemplate, queryFilter.AttributePath));
138139
}
139140
}
140-
141+
141142
predicate = predicate.Or(predicateAnd);
142143
results = this.storage.Groups.Values.Where(predicate.Compile());
143144

@@ -148,14 +149,14 @@ public override Task<Resource> ReplaceAsync(Resource resource, string correlatio
148149
{
149150
if (resource.Identifier == null)
150151
{
151-
throw new HttpResponseException(HttpStatusCode.BadRequest);
152+
throw new CustomHttpResponseException(HttpStatusCode.BadRequest);
152153
}
153154

154155
Core2Group group = resource as Core2Group;
155156

156157
if (string.IsNullOrWhiteSpace(group.DisplayName))
157158
{
158-
throw new HttpResponseException(HttpStatusCode.BadRequest);
159+
throw new CustomHttpResponseException(HttpStatusCode.BadRequest);
159160
}
160161

161162
Core2Group exisitingGroups = resource as Core2Group;
@@ -167,12 +168,12 @@ public override Task<Resource> ReplaceAsync(Resource resource, string correlatio
167168
!string.Equals(exisitingUser.Identifier, group.Identifier, StringComparison.OrdinalIgnoreCase))
168169
)
169170
{
170-
throw new HttpResponseException(HttpStatusCode.Conflict);
171+
throw new CustomHttpResponseException(HttpStatusCode.Conflict);
171172
}
172173

173174
if (!this.storage.Groups.TryGetValue(group.Identifier, out Core2Group _))
174175
{
175-
throw new HttpResponseException(HttpStatusCode.NotFound);
176+
throw new CustomHttpResponseException(HttpStatusCode.NotFound);
176177
}
177178

178179
// Update metadata
@@ -211,11 +212,10 @@ public override Task<Resource> RetrieveAsync(IResourceRetrievalParameters parame
211212
return Task.FromResult(result);
212213
}
213214
}
214-
215-
throw new HttpResponseException(HttpStatusCode.NotFound);
215+
throw new CustomHttpResponseException(HttpStatusCode.NotFound);
216216
}
217217

218-
public override Task UpdateAsync(IPatch patch, string correlationIdentifier)
218+
public override Task<Resource> UpdateAsync(IPatch patch, string correlationIdentifier)
219219
{
220220
if (null == patch)
221221
{
@@ -254,10 +254,10 @@ public override Task UpdateAsync(IPatch patch, string correlationIdentifier)
254254
}
255255
else
256256
{
257-
throw new HttpResponseException(HttpStatusCode.NotFound);
257+
throw new CustomHttpResponseException(HttpStatusCode.NotFound);
258258
}
259259

260-
return Task.CompletedTask;
260+
return Task.FromResult(group as Resource);
261261
}
262262
}
263263
}

Microsoft.SCIM.WebHostSample/Provider/InMemoryProvider.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ public class InMemoryProvider : ProviderBase
1717
new Lazy<IReadOnlyCollection<TypeScheme>>(
1818
() =>
1919
new TypeScheme[]
20-
{
20+
{
2121
SampleTypeScheme.UserTypeScheme,
22-
SampleTypeScheme.GroupTypeScheme,
22+
SampleTypeScheme.GroupTypeScheme,
2323
SampleTypeScheme.EnterpriseUserTypeScheme,
2424
SampleTypeScheme.ResourceTypesTypeScheme,
2525
SampleTypeScheme.SchemaTypeScheme,
@@ -39,9 +39,9 @@ public InMemoryProvider()
3939
}
4040

4141
public override IReadOnlyCollection<Core2ResourceType> ResourceTypes => InMemoryProvider.Types.Value;
42-
42+
4343
public override IReadOnlyCollection<TypeScheme> Schema => InMemoryProvider.TypeSchema.Value;
44-
44+
4545
public override Task<Resource> CreateAsync(Resource resource, string correlationIdentifier)
4646
{
4747
if (resource is Core2EnterpriseUser)
@@ -57,7 +57,7 @@ public override Task<Resource> CreateAsync(Resource resource, string correlation
5757
throw new NotImplementedException();
5858
}
5959

60-
public override Task DeleteAsync(IResourceIdentifier resourceIdentifier, string correlationIdentifier)
60+
public override Task<Resource> DeleteAsync(IResourceIdentifier resourceIdentifier, string correlationIdentifier)
6161
{
6262
if (resourceIdentifier.SchemaIdentifier.Equals(SchemaIdentifiers.Core2EnterpriseUser))
6363
{
@@ -117,7 +117,7 @@ public override Task<Resource> RetrieveAsync(IResourceRetrievalParameters parame
117117
throw new NotImplementedException();
118118
}
119119

120-
public override Task UpdateAsync(IPatch patch, string correlationIdentifier)
120+
public override Task<Resource> UpdateAsync(IPatch patch, string correlationIdentifier)
121121
{
122122
if (patch == null)
123123
{

0 commit comments

Comments
 (0)