-
Notifications
You must be signed in to change notification settings - Fork 2
Other context type support #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mashbrno
wants to merge
10
commits into
Suremaker:master
Choose a base branch
from
mashbrno:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7010569
migrace na .NET standard 2.0
3cff1e1
ass
237179d
fixing related projects
fe5c33d
fixing related projects
cc99940
Merge pull request #1 from mashbrno/netstandard2
mashbrno 2dcc7c3
Merge remote-tracking branch 'sure/master'
mashbrno a0a964c
few updates
mashbrno 192cce0
updates based ob Suremaker's hintsx
mashbrno 6f3ce28
register class under interface name
mashbrno adfb1c5
upgrade to Spring 3
mashbrno File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -8,4 +8,5 @@ build/Output | |
test-results | ||
.idea | ||
output/ | ||
.vs | ||
.vs | ||
packages |
This file contains hidden or 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
18 changes: 9 additions & 9 deletions
18
Spring.FluentContext.Examples/Spring.FluentContext.Examples.csproj
This file contains hidden or 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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFrameworks>net461;netcoreapp2.2</TargetFrameworks> | ||
<Copyright>Copyright © 2012-2019, Wojciech Kotlarski</Copyright> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Spring.FluentContext\Spring.FluentContext.csproj" /> | ||
</ItemGroup> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFrameworks>net462;net6.0</TargetFrameworks> | ||
<Copyright>Copyright © 2012-2019, Wojciech Kotlarski</Copyright> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Spring.FluentContext\Spring.FluentContext.csproj" /> | ||
</ItemGroup> | ||
</Project> |
32 changes: 16 additions & 16 deletions
32
Spring.FluentContext.UnitTests/Spring.FluentContext.UnitTests.csproj
This file contains hidden or 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 |
---|---|---|
@@ -1,17 +1,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFrameworks>netcoreapp2.2;net45</TargetFrameworks> | ||
<IsPackable>false</IsPackable> | ||
<LangVersion>latest</LangVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Spring.FluentContext\Spring.FluentContext.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" /> | ||
<PackageReference Include="NUnit" Version="3.7.1" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="3.11.2" /> | ||
</ItemGroup> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFrameworks>net6.0;net462</TargetFrameworks> | ||
<IsPackable>false</IsPackable> | ||
<LangVersion>latest</LangVersion> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Spring.FluentContext\Spring.FluentContext.csproj" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" /> | ||
<PackageReference Include="NUnit" Version="3.13.3" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" /> | ||
</ItemGroup> | ||
</Project> |
This file contains hidden or 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,79 @@ | ||
using System; | ||
using Spring.Context; | ||
using Spring.Context.Support; | ||
using Spring.Objects.Factory.Config; | ||
using Spring.Objects.Factory.Support; | ||
|
||
namespace Spring.FluentContext.Web | ||
{ | ||
public class FluentWebApplicationContext : WebApplicationContext | ||
{ | ||
public const string SpringConfiguratorKey = "SpringConfigurator"; | ||
private IContextConfigurator _configurator; | ||
|
||
#region Constructors | ||
|
||
/// <summary> | ||
/// Create a new WebApplicationContext, loading the definitions | ||
/// from the given XML resource. | ||
/// </summary> | ||
/// <param name="configurationLocations">Names of configuration resources.</param> | ||
public FluentWebApplicationContext(params string[] configurationLocations) | ||
: base(new WebApplicationContextArgs(string.Empty, null, configurationLocations, null, false)) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Create a new WebApplicationContext, loading the definitions | ||
/// from the given XML resource. | ||
/// </summary> | ||
/// <param name="name">The application context name.</param> | ||
/// <param name="caseSensitive">Flag specifying whether to make this context case sensitive or not.</param> | ||
/// <param name="configurationLocations">Names of configuration resources.</param> | ||
public FluentWebApplicationContext(string name, bool caseSensitive, params string[] configurationLocations) | ||
: base(new WebApplicationContextArgs(name, null, configurationLocations, null, caseSensitive)) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Create a new WebApplicationContext with the given parent, | ||
/// loading the definitions from the given XML resources. | ||
/// </summary> | ||
/// <param name="name">The application context name.</param> | ||
/// <param name="caseSensitive">Flag specifying whether to make this context case sensitive or not.</param> | ||
/// <param name="parentContext">The parent context.</param> | ||
/// <param name="configurationLocations">Names of configuration resources.</param> | ||
public FluentWebApplicationContext(string name, bool caseSensitive, IApplicationContext parentContext, | ||
params string[] configurationLocations) | ||
: base(new WebApplicationContextArgs(name, parentContext, configurationLocations, null, caseSensitive)) | ||
{ } | ||
#endregion | ||
|
||
protected override void OnPreRefresh() | ||
{ | ||
const string prefix = SpringConfiguratorKey + ProtocolSeparator; | ||
|
||
for (int i = 0; i < ConfigurationLocations.Length; i++) | ||
{ | ||
if (ConfigurationLocations[i].StartsWith(prefix)) | ||
{ | ||
string configuratorName = ConfigurationLocations[i].Substring(prefix.Length); | ||
ConfigurationLocations[i] = "assembly://Spring.FluentContext.Web/Spring.FluentContext.Web/emptyContext.xml"; | ||
_configurator = (IContextConfigurator) Activator.CreateInstance(Type.GetType(configuratorName)); | ||
break; // only one configurator supported | ||
} | ||
} | ||
base.OnPreRefresh(); | ||
} | ||
|
||
/// <summary> | ||
/// This method registers Fluent objects and calls base post processing | ||
/// </summary> | ||
/// <param name="objectFactory"></param> | ||
protected override void PostProcessObjectFactory(IConfigurableListableObjectFactory objectFactory) | ||
{ | ||
_configurator?.LoadObjectDefinitions(this); | ||
base.PostProcessObjectFactory(objectFactory); | ||
} | ||
} | ||
} |
This file contains hidden or 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,49 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Linq; | ||
using Common.Logging; | ||
using Spring.Context; | ||
using Spring.Context.Support; | ||
using Spring.Core.IO; | ||
|
||
namespace Spring.FluentContext.Web | ||
{ | ||
public class FluentWebContextHandler : WebContextHandler | ||
{ | ||
private static readonly ILog Log = LogManager.GetLogger(typeof(WebContextHandler)); | ||
private readonly string _configurator; | ||
|
||
public FluentWebContextHandler() | ||
{ | ||
_configurator = ConfigurationManager.AppSettings["SpringConfigurator"]; | ||
} | ||
|
||
/// <summary> | ||
/// Sets default context type to <see cref="FluentWebApplicationContext"/> | ||
/// </summary> | ||
protected override Type DefaultApplicationContextType | ||
{ | ||
get { return typeof(FluentWebApplicationContext); } | ||
} | ||
|
||
/// <summary> | ||
/// Handles web specific details of context instantiation. | ||
/// </summary> | ||
protected override IApplicationContext InstantiateContext(IApplicationContext parent, object configContext, | ||
string contextName, Type contextType, bool caseSensitive, IList<string> resources) | ||
{ | ||
string[] resourcesArray = resources.Union( | ||
string.IsNullOrWhiteSpace(_configurator) | ||
? new string[0] | ||
: new[] | ||
{ | ||
FluentWebApplicationContext.SpringConfiguratorKey + | ||
ConfigurableResourceLoader.ProtocolSeparator + _configurator | ||
}).ToArray(); | ||
|
||
return base.InstantiateContext(parent, configContext, contextName, contextType, caseSensitive, | ||
resourcesArray); | ||
} | ||
} | ||
} |
This file contains hidden or 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,33 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net462</TargetFramework> | ||
<Description>Allows creating Spring.NET IoC container from code using fluent API</Description> | ||
<Copyright>Copyright © 2012-2019, Wojciech Kotlarski</Copyright> | ||
<Authors>Wojciech Kotlarski</Authors> | ||
<PackageProjectUrl>https://github.com/Suremaker/Spring.FluentContext</PackageProjectUrl> | ||
<Version>3.0.0</Version> | ||
<RepositoryType>git</RepositoryType> | ||
<RepositoryUrl>https://github.com/Suremaker/Spring.FluentContext</RepositoryUrl> | ||
<GenerateAssemblyInfo>true</GenerateAssemblyInfo> | ||
<IncludeSymbols>True</IncludeSymbols> | ||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild> | ||
<PackageOutputPath>$(SolutionDir)\output</PackageOutputPath> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<IsPackable>true</IsPackable> | ||
<LangVersion>latest</LangVersion> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Spring.Web" Version="3.0.1" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Reference Include="System.Configuration" /> | ||
<Reference Include="System.Web" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Spring.FluentContext\Spring.FluentContext.csproj" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Remove="emptyContext.xml" /> | ||
<EmbeddedResource Include="emptyContext.xml" /> | ||
</ItemGroup> | ||
</Project> |
This file contains hidden or 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,2 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<objects xmlns="http://www.springframework.net" /> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.