-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #394 from fir3pho3nixx/aspnet-core-windsor-final
ASP.NET Core Facility (now production ready BUT... )
- Loading branch information
Showing
33 changed files
with
2,844 additions
and
476 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
192 changes: 0 additions & 192 deletions
192
src/Castle.Facilities.AspNetCore.Tests/AspNetCoreFacilityTestCase.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright 2004-2018 Castle Project - http://www.castleproject.org/ | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
|
||
namespace Castle.Facilities.AspNetCore.Tests.Fakes | ||
{ | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
using Microsoft.AspNetCore.Http; | ||
|
||
using Castle.MicroKernel.Lifestyle; | ||
|
||
public class AnyComponent { } | ||
public class AnyComponentWithLifestyleManager : AbstractLifestyleManager | ||
{ | ||
public override void Dispose() | ||
{ | ||
} | ||
} | ||
|
||
public sealed class AnyMiddleware : IMiddleware | ||
{ | ||
private readonly AnyComponent anyComponent; | ||
private readonly ServiceProviderOnlyScopedDisposable serviceProviderOnlyScopedDisposable; | ||
private readonly WindsorOnlyScopedDisposable windsorOnlyScopedDisposable; | ||
private readonly CrossWiredScopedDisposable crossWiredScopedDisposable; | ||
|
||
public AnyMiddleware( | ||
ServiceProviderOnlyScopedDisposable serviceProviderOnlyScopedDisposable, | ||
WindsorOnlyScopedDisposable windsorOnlyScopedDisposable, | ||
CrossWiredScopedDisposable crossWiredScopedDisposable) | ||
{ | ||
this.serviceProviderOnlyScopedDisposable = serviceProviderOnlyScopedDisposable ?? throw new ArgumentNullException(nameof(serviceProviderOnlyScopedDisposable)); | ||
this.windsorOnlyScopedDisposable = windsorOnlyScopedDisposable ?? throw new ArgumentNullException(nameof(windsorOnlyScopedDisposable)); | ||
this.crossWiredScopedDisposable = crossWiredScopedDisposable ?? throw new ArgumentNullException(nameof(crossWiredScopedDisposable)); | ||
} | ||
|
||
public AnyMiddleware(AnyComponent anyComponent) | ||
{ | ||
// This will never get called because Windsor picks the most greedy constructor | ||
this.anyComponent = anyComponent ?? throw new ArgumentNullException(nameof(anyComponent)); | ||
} | ||
|
||
public async Task InvokeAsync(HttpContext context, RequestDelegate next) | ||
{ | ||
// Do something before | ||
await next(context); | ||
// Do something after | ||
} | ||
} | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
src/Castle.Facilities.AspNetCore.Tests/Fakes/CompositeFakes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright 2004-2018 Castle Project - http://www.castleproject.org/ | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
namespace Castle.Facilities.AspNetCore.Tests.Fakes | ||
{ | ||
using System; | ||
|
||
public class CompositeController | ||
{ | ||
public CompositeController( | ||
ControllerCrossWired crossWiredController, | ||
ControllerServiceProviderOnly serviceProviderOnlyController, | ||
ControllerWindsorOnly windsorOnlyController) | ||
{ | ||
if (crossWiredController == null) throw new ArgumentNullException(nameof(crossWiredController)); | ||
if (serviceProviderOnlyController == null) throw new ArgumentNullException(nameof(serviceProviderOnlyController)); | ||
if (windsorOnlyController == null) throw new ArgumentNullException(nameof(windsorOnlyController)); | ||
} | ||
} | ||
|
||
public class CompositeTagHelper | ||
{ | ||
public CompositeTagHelper( | ||
TagHelperCrossWired crossWiredTagHelper, | ||
TagHelperServiceProviderOnly serviceProviderOnlyTagHelper, | ||
TagHelperWindsorOnly windsorOnlyTagHelper) | ||
{ | ||
if (crossWiredTagHelper == null) throw new ArgumentNullException(nameof(crossWiredTagHelper)); | ||
if (serviceProviderOnlyTagHelper == null) throw new ArgumentNullException(nameof(serviceProviderOnlyTagHelper)); | ||
if (windsorOnlyTagHelper == null) throw new ArgumentNullException(nameof(windsorOnlyTagHelper)); | ||
} | ||
} | ||
|
||
public class CompositeViewComponent | ||
{ | ||
public CompositeViewComponent( | ||
ViewComponentCrossWired crossWiredViewComponent, | ||
ViewComponentServiceProviderOnly serviceProviderOnlyViewComponent, | ||
ViewComponentWindsorOnly windsorOnlyViewComponent) | ||
{ | ||
if (crossWiredViewComponent == null) throw new ArgumentNullException(nameof(crossWiredViewComponent)); | ||
if (serviceProviderOnlyViewComponent == null) throw new ArgumentNullException(nameof(serviceProviderOnlyViewComponent)); | ||
if (windsorOnlyViewComponent == null) throw new ArgumentNullException(nameof(windsorOnlyViewComponent)); | ||
} | ||
} | ||
} |
Oops, something went wrong.