Skip to content

Commit 244499a

Browse files
committed
stylecop; add AddModule back to the OwinBootstrapper
1 parent b6d7ee9 commit 244499a

27 files changed

+407
-47
lines changed

src/Ninject.Web.Common.OwinHost/Ninject.Web.Common.OwinHost.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
<PropertyGroup>
44
<TargetFrameworks>net45</TargetFrameworks>
55
<Version>0.0.0</Version>
6-
<Authors>Remo Gloor ([email protected]); Ninject Contributors</Authors>
6+
<Authors>Ninject Project Contributors</Authors>
77
<Company>Ninject Project Contributors</Company>
88
<Product>Ninject.Web.Common.OwinHost</Product>
99
<Description>OWIN extension for Ninject.Web.Common</Description>
10-
<Copyright>2010-2011 bbv Software Services AG. 2011-2017 Ninject Contributors.</Copyright>
10+
<Copyright>2010-2011 bbv Software Services AG. 2011-2017 Ninject Project Contributors.</Copyright>
1111
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1212
<AssemblyOriginatorKeyFile>..\Ninject.snk</AssemblyOriginatorKeyFile>
1313
<SignAssembly>true</SignAssembly>

src/Ninject.Web.Common.OwinHost/OwinAppBuilderExtensions.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
// -------------------------------------------------------------------------------------------------
22
// <copyright file="OwinAppBuilderExtensions.cs" company="Ninject Project Contributors">
33
// Copyright (c) 2010-2011 bbv Software Services AG.
4-
// Copyright (c) 2011-2017 Ninject Contributors.
5-
// Licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
4+
// Copyright (c) 2011-2017 Ninject Project Contributors. All rights reserved.
5+
//
6+
// Dual-licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
7+
// You may not use this file except in compliance with one of the Licenses.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
// or
12+
// http://www.microsoft.com/opensource/licenses.mspx
13+
//
14+
// Unless required by applicable law or agreed to in writing, software
15+
// distributed under the License is distributed on an "AS IS" BASIS,
16+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
// See the License for the specific language governing permissions and
18+
// limitations under the License.
619
// </copyright>
720
// -------------------------------------------------------------------------------------------------
821

@@ -11,6 +24,7 @@ namespace Ninject.Web.Common.OwinHost
1124
using System;
1225
using System.Collections.Generic;
1326
using System.Threading.Tasks;
27+
1428
using Owin;
1529

1630
/// <summary>

src/Ninject.Web.Common.OwinHost/OwinBootstrapper.cs

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
// -------------------------------------------------------------------------------------------------
22
// <copyright file="OwinBootstrapper.cs" company="Ninject Project Contributors">
33
// Copyright (c) 2010-2011 bbv Software Services AG.
4-
// Copyright (c) 2011-2017 Ninject Contributors.
5-
// Licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
4+
// Copyright (c) 2011-2017 Ninject Project Contributors. All rights reserved.
5+
//
6+
// Dual-licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
7+
// You may not use this file except in compliance with one of the Licenses.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
// or
12+
// http://www.microsoft.com/opensource/licenses.mspx
13+
//
14+
// Unless required by applicable law or agreed to in writing, software
15+
// distributed under the License is distributed on an "AS IS" BASIS,
16+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
// See the License for the specific language governing permissions and
18+
// limitations under the License.
619
// </copyright>
720
// -------------------------------------------------------------------------------------------------
821

@@ -11,7 +24,8 @@ namespace Ninject.Web.Common.OwinHost
1124
using System;
1225
using System.Collections.Generic;
1326
using System.Threading.Tasks;
14-
using Microsoft.Owin;
27+
28+
using Ninject.Modules;
1529

1630
/// <summary>
1731
/// The Owin bootstrapper.
@@ -23,6 +37,7 @@ public class OwinBootstrapper
2337
/// </summary>
2438
public const string NinjectOwinRequestScope = "NinjectOwinRequestScope";
2539

40+
private readonly IList<INinjectModule> modules = new List<INinjectModule>();
2641
private readonly Func<IKernel> createKernelCallback;
2742
private readonly IBootstrapper bootstrapper = new Bootstrapper();
2843

@@ -35,6 +50,18 @@ public OwinBootstrapper(Func<IKernel> createKernelCallback)
3550
this.createKernelCallback = createKernelCallback;
3651
}
3752

53+
/// <summary>
54+
/// Adds a Ninject module.
55+
/// </summary>
56+
/// <param name="ninjectModule">The Ninject module.</param>
57+
public void AddModule(NinjectModule ninjectModule)
58+
{
59+
lock (this.modules)
60+
{
61+
this.modules.Add(ninjectModule);
62+
}
63+
}
64+
3865
/// <summary>
3966
/// Handles the owin context.
4067
/// </summary>
@@ -44,7 +71,15 @@ public OwinBootstrapper(Func<IKernel> createKernelCallback)
4471
/// </returns>
4572
public Func<IDictionary<string, object>, Task> Execute(Func<IDictionary<string, object>, Task> next)
4673
{
47-
this.bootstrapper.Initialize(this.createKernelCallback);
74+
this.bootstrapper.Initialize(() =>
75+
{
76+
var kernel = this.createKernelCallback();
77+
lock (this.modules)
78+
{
79+
kernel.Load(this.modules);
80+
}
81+
return kernel;
82+
});
4883

4984
return async context =>
5085
{

src/Ninject.Web.Common.OwinHost/OwinRequestScope.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
// -------------------------------------------------------------------------------------------------
22
// <copyright file="OwinRequestScope.cs" company="Ninject Project Contributors">
33
// Copyright (c) 2010-2011 bbv Software Services AG.
4-
// Copyright (c) 2011-2017 Ninject Contributors.
5-
// Licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
4+
// Copyright (c) 2011-2017 Ninject Project Contributors. All rights reserved.
5+
//
6+
// Dual-licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
7+
// You may not use this file except in compliance with one of the Licenses.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
// or
12+
// http://www.microsoft.com/opensource/licenses.mspx
13+
//
14+
// Unless required by applicable law or agreed to in writing, software
15+
// distributed under the License is distributed on an "AS IS" BASIS,
16+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
// See the License for the specific language governing permissions and
18+
// limitations under the License.
619
// </copyright>
720
// -------------------------------------------------------------------------------------------------
821

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// -------------------------------------------------------------------------------------------------
2+
// <copyright file="AssemblyInfo.cs" company="Ninject Project Contributors">
3+
// Copyright (c) 2010-2011 bbv Software Services AG.
4+
// Copyright (c) 2011-2017 Ninject Project Contributors. All rights reserved.
5+
//
6+
// Dual-licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
7+
// You may not use this file except in compliance with one of the Licenses.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
// or
12+
// http://www.microsoft.com/opensource/licenses.mspx
13+
//
14+
// Unless required by applicable law or agreed to in writing, software
15+
// distributed under the License is distributed on an "AS IS" BASIS,
16+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
// See the License for the specific language governing permissions and
18+
// limitations under the License.
19+
// </copyright>
20+
// -------------------------------------------------------------------------------------------------
21+
22+
using System;
23+
24+
[assembly: CLSCompliant(true)]

src/Ninject.Web.Common.SelfHost/INinjectSelfHost.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
// -------------------------------------------------------------------------------------------------
22
// <copyright file="INinjectSelfHost.cs" company="Ninject Project Contributors">
33
// Copyright (c) 2010-2011 bbv Software Services AG.
4-
// Copyright (c) 2011-2017 Ninject Contributors.
5-
// Licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
4+
// Copyright (c) 2011-2017 Ninject Project Contributors. All rights reserved.
5+
//
6+
// Dual-licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
7+
// You may not use this file except in compliance with one of the Licenses.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
// or
12+
// http://www.microsoft.com/opensource/licenses.mspx
13+
//
14+
// Unless required by applicable law or agreed to in writing, software
15+
// distributed under the License is distributed on an "AS IS" BASIS,
16+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
// See the License for the specific language governing permissions and
18+
// limitations under the License.
619
// </copyright>
720
// -------------------------------------------------------------------------------------------------
821

src/Ninject.Web.Common.SelfHost/Ninject.Web.Common.SelfHost.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
<PropertyGroup>
44
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
55
<Version>0.0.0</Version>
6-
<Authors>Remo Gloor ([email protected]); Ninject Contributors</Authors>
6+
<Authors>Ninject Project Contributors</Authors>
77
<Company>Ninject Project Contributors</Company>
88
<Product>Ninject.Web.Common.SelfHost</Product>
99
<Description>Self Host extension for Ninject.Web.Common</Description>
10-
<Copyright>2010-2011 bbv Software Services AG. 2011-2017 Ninject Contributors.</Copyright>
10+
<Copyright>2010-2011 bbv Software Services AG. 2011-2017 Ninject Project Contributors.</Copyright>
1111
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1212
<AssemblyOriginatorKeyFile>..\Ninject.snk</AssemblyOriginatorKeyFile>
1313
<SignAssembly>true</SignAssembly>

src/Ninject.Web.Common.SelfHost/NinjectSelfHostBootstrapper.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
// -------------------------------------------------------------------------------------------------
22
// <copyright file="NinjectSelfHostBootstrapper.cs" company="Ninject Project Contributors">
33
// Copyright (c) 2010-2011 bbv Software Services AG.
4-
// Copyright (c) 2011-2017 Ninject Contributors.
5-
// Licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
4+
// Copyright (c) 2011-2017 Ninject Project Contributors. All rights reserved.
5+
//
6+
// Dual-licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
7+
// You may not use this file except in compliance with one of the Licenses.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
// or
12+
// http://www.microsoft.com/opensource/licenses.mspx
13+
//
14+
// Unless required by applicable law or agreed to in writing, software
15+
// distributed under the License is distributed on an "AS IS" BASIS,
16+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
// See the License for the specific language governing permissions and
18+
// limitations under the License.
619
// </copyright>
720
// -------------------------------------------------------------------------------------------------
821

922
namespace Ninject.Web.Common.SelfHost
1023
{
1124
using System;
25+
1226
using Ninject.Web.Common;
1327

1428
/// <summary>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// -------------------------------------------------------------------------------------------------
2+
// <copyright file="AssemblyInfo.cs" company="Ninject Project Contributors">
3+
// Copyright (c) 2010-2011 bbv Software Services AG.
4+
// Copyright (c) 2011-2017 Ninject Project Contributors. All rights reserved.
5+
//
6+
// Dual-licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
7+
// You may not use this file except in compliance with one of the Licenses.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
// or
12+
// http://www.microsoft.com/opensource/licenses.mspx
13+
//
14+
// Unless required by applicable law or agreed to in writing, software
15+
// distributed under the License is distributed on an "AS IS" BASIS,
16+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
// See the License for the specific language governing permissions and
18+
// limitations under the License.
19+
// </copyright>
20+
// -------------------------------------------------------------------------------------------------
21+
22+
using System;
23+
24+
[assembly: CLSCompliant(true)]

src/Ninject.Web.Common.WebHost/HttpApplicationInitializationHttpModule.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
11
// -------------------------------------------------------------------------------------------------
22
// <copyright file="HttpApplicationInitializationHttpModule.cs" company="Ninject Project Contributors">
33
// Copyright (c) 2010-2011 bbv Software Services AG.
4-
// Copyright (c) 2011-2017 Ninject Contributors.
5-
// Licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
4+
// Copyright (c) 2011-2017 Ninject Project Contributors. All rights reserved.
5+
//
6+
// Dual-licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
7+
// You may not use this file except in compliance with one of the Licenses.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
// or
12+
// http://www.microsoft.com/opensource/licenses.mspx
13+
//
14+
// Unless required by applicable law or agreed to in writing, software
15+
// distributed under the License is distributed on an "AS IS" BASIS,
16+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
// See the License for the specific language governing permissions and
18+
// limitations under the License.
619
// </copyright>
720
// -------------------------------------------------------------------------------------------------
821

922
namespace Ninject.Web.Common
1023
{
1124
using System;
1225
using System.Web;
26+
1327
using Ninject.Infrastructure.Disposal;
1428

1529
/// <summary>

0 commit comments

Comments
 (0)