restructured into separate assembly to avoid Spring.Core needing a dependency on Spring.Aop
This commit is contained in:
@@ -74,6 +74,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Web.Mvc.2010", "src\
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Web.Mvc.Tests.2010", "test\Spring\Spring.Web.Mvc.Tests\Spring.Web.Mvc.Tests.2010.csproj", "{D4032434-D9A8-437B-95E8-9D4DE0AD9932}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Core.Configuration.2010", "src\Spring\Spring.Core.Configuration\Spring.Core.Configuration.2010.csproj", "{7B65D538-E863-4F57-8DDC-2C38E4150045}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Core.Configuration.Tests.2010", "test\Spring\Spring.Core.Configuration.Tests\Spring.Core.Configuration.Tests.2010.csproj", "{4F1A206C-09A8-43FF-B791-FE956E99A120}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|.NET = Debug|.NET
|
||||
@@ -434,6 +438,26 @@ Global
|
||||
{D4032434-D9A8-437B-95E8-9D4DE0AD9932}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D4032434-D9A8-437B-95E8-9D4DE0AD9932}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{D4032434-D9A8-437B-95E8-9D4DE0AD9932}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{7B65D538-E863-4F57-8DDC-2C38E4150045}.Debug|.NET.ActiveCfg = Debug|Any CPU
|
||||
{7B65D538-E863-4F57-8DDC-2C38E4150045}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7B65D538-E863-4F57-8DDC-2C38E4150045}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7B65D538-E863-4F57-8DDC-2C38E4150045}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{7B65D538-E863-4F57-8DDC-2C38E4150045}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{7B65D538-E863-4F57-8DDC-2C38E4150045}.Release|.NET.ActiveCfg = Release|Any CPU
|
||||
{7B65D538-E863-4F57-8DDC-2C38E4150045}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7B65D538-E863-4F57-8DDC-2C38E4150045}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7B65D538-E863-4F57-8DDC-2C38E4150045}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{7B65D538-E863-4F57-8DDC-2C38E4150045}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{4F1A206C-09A8-43FF-B791-FE956E99A120}.Debug|.NET.ActiveCfg = Debug|Any CPU
|
||||
{4F1A206C-09A8-43FF-B791-FE956E99A120}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4F1A206C-09A8-43FF-B791-FE956E99A120}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4F1A206C-09A8-43FF-B791-FE956E99A120}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{4F1A206C-09A8-43FF-B791-FE956E99A120}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{4F1A206C-09A8-43FF-B791-FE956E99A120}.Release|.NET.ActiveCfg = Release|Any CPU
|
||||
{4F1A206C-09A8-43FF-B791-FE956E99A120}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4F1A206C-09A8-43FF-B791-FE956E99A120}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4F1A206C-09A8-43FF-B791-FE956E99A120}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{4F1A206C-09A8-43FF-B791-FE956E99A120}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Spring.Context.Annotation
|
||||
namespace Spring.Context.Attributes
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that a class declares one or more <see cref="Definition"/> methods and may be processed
|
||||
@@ -27,6 +27,15 @@ namespace Spring.Context.Annotation
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class ConfigurationAttribute : Attribute
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ConfigurationAttribute class.
|
||||
/// </summary>
|
||||
public ConfigurationAttribute()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private string _name;
|
||||
|
||||
/// <summary>
|
||||
@@ -5,7 +5,7 @@ using Spring.Core.IO;
|
||||
using Spring.Collections.Generic;
|
||||
using Spring.Objects.Factory.Parsing;
|
||||
|
||||
namespace Spring.Context.Annotation
|
||||
namespace Spring.Context.Attributes
|
||||
{
|
||||
public class ConfigurationClass
|
||||
{
|
||||
@@ -25,7 +25,7 @@ using Spring.Core.IO;
|
||||
using System.Reflection;
|
||||
using Spring.Objects.Factory.Parsing;
|
||||
|
||||
namespace Spring.Context.Annotation
|
||||
namespace Spring.Context.Attributes
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -8,7 +8,7 @@ using System.Reflection;
|
||||
using Spring.Objects.Factory.Config;
|
||||
using Common.Logging;
|
||||
|
||||
namespace Spring.Context.Annotation
|
||||
namespace Spring.Context.Attributes
|
||||
{
|
||||
public class ConfigurationClassObjectDefinitionReader
|
||||
{
|
||||
@@ -33,7 +33,7 @@ namespace Spring.Context.Annotation
|
||||
{
|
||||
if (type != null)
|
||||
{
|
||||
return (Attribute.GetCustomAttribute(type.GetType(), typeof(ConfigurationAttribute)) != null);
|
||||
return (Attribute.GetCustomAttribute(type, typeof(ConfigurationAttribute)) != null);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -58,14 +58,14 @@ namespace Spring.Context.Annotation
|
||||
// no bean definition exists yet -> this must be an imported configuration class (@Import).
|
||||
GenericObjectDefinition configBeanDef = new GenericObjectDefinition();
|
||||
String className = configClass.ConfigurationClassType.Name;
|
||||
configBeanDef.ObjectTypeName = className;
|
||||
configBeanDef.ObjectType = configClass.GetType();
|
||||
if (CheckConfigurationClassCandidate(configClass.ConfigurationClassType))
|
||||
{
|
||||
String configObjectName = ObjectDefinitionReaderUtils.RegisterWithGeneratedName(configBeanDef, _registry);
|
||||
configClass.ObjectName = configObjectName;
|
||||
if (_logger.IsDebugEnabled)
|
||||
{
|
||||
_logger.Debug(String.Format("Registered bean definition for imported [Configuration] class {0}", configObjectName));
|
||||
_logger.Debug(String.Format("Registered object definition for imported [Configuration] class {0}", configObjectName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,6 +102,10 @@ namespace Spring.Context.Annotation
|
||||
for (int i = 0; i < objectAttributes.Length; i++)
|
||||
{
|
||||
string[] namesAndAliases = ((DefinitionAttribute)objectAttributes[i]).Name;
|
||||
|
||||
if (namesAndAliases == null)
|
||||
namesAndAliases = new[] { metadata.Name };
|
||||
|
||||
for (int j = 0; j > namesAndAliases.Length; j++)
|
||||
{
|
||||
names.Add(namesAndAliases[j]);
|
||||
@@ -6,7 +6,7 @@ using Spring.Collections.Generic;
|
||||
using Spring.Util;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Spring.Context.Annotation
|
||||
namespace Spring.Context.Attributes
|
||||
{
|
||||
|
||||
public class ConfigurationClassParser
|
||||
@@ -7,10 +7,11 @@ using Spring.Objects.Factory.Support;
|
||||
using Spring.Objects.Factory.Config;
|
||||
using Spring.Collections.Generic;
|
||||
using Spring.Objects.Factory;
|
||||
using Spring.Core;
|
||||
|
||||
namespace Spring.Context.Annotation
|
||||
namespace Spring.Context.Attributes
|
||||
{
|
||||
public class ConfigurationClassPostProcessor : IObjectDefinitionRegistryPostProcessor
|
||||
public class ConfigurationClassPostProcessor : IObjectDefinitionRegistryPostProcessor, IOrdered
|
||||
{
|
||||
private ILog _logger = LogManager.GetLogger(typeof(ConfigurationClassPostProcessor));
|
||||
|
||||
@@ -25,10 +26,7 @@ namespace Spring.Context.Annotation
|
||||
set { _problemReporter = (value ?? new FailFastProblemReporter()); }
|
||||
}
|
||||
|
||||
//public int getOrder()
|
||||
//{
|
||||
// return Ordered.HIGHEST_PRECEDENCE;
|
||||
//}
|
||||
|
||||
|
||||
public void PostProcessObjectDefinitionRegistry(IObjectDefinitionRegistry registry)
|
||||
{
|
||||
@@ -44,24 +42,64 @@ namespace Spring.Context.Annotation
|
||||
ProcessConfigObjectDefinitions(registry);
|
||||
}
|
||||
|
||||
/*
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
|
||||
|
||||
private Type GenerateProxyType(Type objectType)
|
||||
{
|
||||
/*
|
||||
ProxyFactory proxyFactory = new ProxyFactory();
|
||||
proxyFactory.ProxyTargetAttributes = true;
|
||||
proxyFactory.Interfaces = Type.EmptyTypes;
|
||||
proxyFactory.TargetSource = new ObjectFactoryTargetSource(originalBeanName, owningObjectFactory);
|
||||
SpringObjectMethodInterceptor methodInterceptor = new SpringObjectMethodInterceptor(owningObjectFactory, objectNamingStrategy);
|
||||
proxyFactory.AddAdvice(methodInterceptor);
|
||||
|
||||
//TODO check type of object isn't infrastructure type.
|
||||
|
||||
InheritanceAopProxyTypeBuilder iaptb = new InheritanceAopProxyTypeBuilder(proxyFactory);
|
||||
//iaptb.ProxyDeclaredMembersOnly = true; // make configurable.
|
||||
Type type = iaptb.BuildProxyType();
|
||||
*/
|
||||
|
||||
return null;
|
||||
}
|
||||
private void EnhanceConfigurationClasses(IConfigurableListableObjectFactory objectFactory)
|
||||
{
|
||||
string[] objectNames = objectFactory.GetObjectDefinitionNames();
|
||||
|
||||
for (int i = 0; i < objectNames.Length; i++)
|
||||
{
|
||||
IObjectDefinition objDef = objectFactory.GetObjectDefinition(objectNames[i]);
|
||||
if (Attribute.GetCustomAttribute(objDef.ObjectType, typeof(ConfigurationAttribute)) != null)
|
||||
{
|
||||
if (this.postProcessBeanFactoryCalled)
|
||||
{
|
||||
throw new IllegalStateException(
|
||||
"postProcessBeanFactory already called for this post-processor");
|
||||
}
|
||||
this.postProcessBeanFactoryCalled = true;
|
||||
if (!this.postProcessBeanDefinitionRegistryCalled)
|
||||
{
|
||||
// BeanDefinitionRegistryPostProcessor hook apparently not supported...
|
||||
// Simply call processConfigBeanDefinitions lazily at this point then.
|
||||
processConfigBeanDefinitions((BeanDefinitionRegistry)beanFactory);
|
||||
}
|
||||
enhanceConfigurationClasses(beanFactory);
|
||||
//configNames.Add(objectNames[i]);
|
||||
|
||||
//ObjectType is READONLY :(
|
||||
//objDef.ObjectType = GenerateProxyType(objDef.ObjectType);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
public void PostProcessObjectFactory(IConfigurableListableObjectFactory objectFactory)
|
||||
{
|
||||
if (_postProcessObjectFactoryCalled)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"PostProcessObjectFactory already called for this post-processor");
|
||||
}
|
||||
_postProcessObjectFactoryCalled = true;
|
||||
if (!_postProcessObjectDefinitionRegistryCalled)
|
||||
{
|
||||
// BeanDefinitionRegistryPostProcessor hook apparently not supported...
|
||||
// Simply call processConfigBeanDefinitions lazily at this point then.
|
||||
ProcessConfigObjectDefinitions((IObjectDefinitionRegistry)objectFactory);
|
||||
}
|
||||
|
||||
EnhanceConfigurationClasses(objectFactory);
|
||||
}
|
||||
|
||||
|
||||
private void ProcessConfigObjectDefinitions(IObjectDefinitionRegistry registry)
|
||||
{
|
||||
@@ -105,5 +143,10 @@ namespace Spring.Context.Annotation
|
||||
reader.LoadObjectDefinitions(parser.ConfigurationClasses);
|
||||
}
|
||||
|
||||
|
||||
public int Order
|
||||
{
|
||||
get { return int.MinValue; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Spring.Objects.Factory.Config;
|
||||
|
||||
namespace Spring.Context.Annotation
|
||||
namespace Spring.Context.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public class DefinitionAttribute : Attribute
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Spring.Context.Annotation
|
||||
namespace Spring.Context.Attributes
|
||||
{
|
||||
/// <summary>
|
||||
/// objects on which the current object depends. Any objects specified are guaranteed to be
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Spring.Context.Annotation
|
||||
namespace Spring.Context.Attributes
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates one or more <see cref="Configuration"/> classes to import.
|
||||
@@ -4,7 +4,7 @@ using System.Text;
|
||||
using Spring.Objects.Factory.Support;
|
||||
using Spring.Objects.Factory.Xml;
|
||||
|
||||
namespace Spring.Context.Annotation
|
||||
namespace Spring.Context.Attributes
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Spring.Context.Annotation
|
||||
namespace Spring.Context.Attributes
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates whether a object is to be lazily initialized.
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Spring.Context.Annotation
|
||||
namespace Spring.Context.Attributes
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that an object should be given preference when multiple candidates
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Spring.Objects.Factory.Support;
|
||||
|
||||
namespace Spring.Context.Annotation
|
||||
namespace Spring.Context.Attributes
|
||||
{
|
||||
/// <summary>
|
||||
/// When used as a type-level attribute, indicates the name of a scope to use
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Spring.Core.Configuration")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("Spring.Core.Configuration")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("aa7c95ac-e82f-4c33-a857-76b179c34166")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{7B65D538-E863-4F57-8DDC-2C38E4150045}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Spring</RootNamespace>
|
||||
<AssemblyName>Spring.Core.Configuration</AssemblyName>
|
||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Common.Logging">
|
||||
<HintPath>..\..\..\lib\Net\2.0\Common.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Context\Attributes\ConfigurationAttribute.cs" />
|
||||
<Compile Include="Context\Attributes\ConfigurationClass.cs" />
|
||||
<Compile Include="Context\Attributes\ConfigurationClassMethod.cs" />
|
||||
<Compile Include="Context\Attributes\ConfigurationClassObjectDefinitionReader.cs" />
|
||||
<Compile Include="Context\Attributes\ConfigurationClassParser.cs" />
|
||||
<Compile Include="Context\Attributes\ConfigurationClassPostProcessor.cs" />
|
||||
<Compile Include="Context\Attributes\DefinitionAttribute.cs" />
|
||||
<Compile Include="Context\Attributes\DependsOnAttribute.cs" />
|
||||
<Compile Include="Context\Attributes\ImportAttribute.cs" />
|
||||
<Compile Include="Context\Attributes\ImportResourceAttribute.cs" />
|
||||
<Compile Include="Context\Attributes\LazyAttrribute.cs" />
|
||||
<Compile Include="Context\Attributes\PrimaryAttribute.cs" />
|
||||
<Compile Include="Context\Attributes\ScopeAttribute.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Spring.Aop\Spring.Aop.2010.csproj">
|
||||
<Project>{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}</Project>
|
||||
<Name>Spring.Aop.2010</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Spring.Core\Spring.Core.2010.csproj">
|
||||
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
|
||||
<Name>Spring.Core.2010</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Spring.Objects.Factory.Config;
|
||||
|
||||
namespace Spring.Objects.Factory.Support
|
||||
{
|
||||
public interface IObjectDefinitionRegistryPostProcessor
|
||||
public interface IObjectDefinitionRegistryPostProcessor : IObjectFactoryPostProcessor
|
||||
{
|
||||
void PostProcessObjectDefinitionRegistry(IObjectDefinitionRegistry registry);
|
||||
}
|
||||
|
||||
@@ -171,19 +171,6 @@
|
||||
<Compile Include="Collections\SynchronizedSet.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Context\Annotation\ConfigurationAttribute.cs" />
|
||||
<Compile Include="Context\Annotation\ConfigurationClass.cs" />
|
||||
<Compile Include="Context\Annotation\ConfigurationClassMethod.cs" />
|
||||
<Compile Include="Context\Annotation\ConfigurationClassObjectDefinitionReader.cs" />
|
||||
<Compile Include="Context\Annotation\ConfigurationClassParser.cs" />
|
||||
<Compile Include="Context\Annotation\ConfigurationClassPostProcessor.cs" />
|
||||
<Compile Include="Context\Annotation\DefinitionAttribute.cs" />
|
||||
<Compile Include="Context\Annotation\DependsOnAttribute.cs" />
|
||||
<Compile Include="Context\Annotation\ImportAttribute.cs" />
|
||||
<Compile Include="Context\Annotation\ImportResourceAttribute.cs" />
|
||||
<Compile Include="Context\Annotation\LazyAttrribute.cs" />
|
||||
<Compile Include="Context\Annotation\PrimaryAttribute.cs" />
|
||||
<Compile Include="Context\Annotation\ScopeAttribute.cs" />
|
||||
<Compile Include="Context\ApplicationContextException.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
@@ -1274,6 +1261,7 @@
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>rem $(ProjectDir)..\..\..\build-support\tools\antlr-2.7.6\antlr-2.7.6.exe -o $(ProjectDir)Expressions\Parser $(ProjectDir)Expressions\Expression.g
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using Spring.Context.Support;
|
||||
using Spring.Objects.Factory.Support;
|
||||
using Spring.Context.Attributes;
|
||||
|
||||
namespace Spring.Context.Annotation
|
||||
{
|
||||
[TestFixture]
|
||||
public class ConfigurationClassPostProcessorTests
|
||||
{
|
||||
private GenericApplicationContext _ctx;
|
||||
|
||||
private ConfigurationClassPostProcessor _postProcessor;
|
||||
|
||||
[SetUp]
|
||||
public void _SetUp()
|
||||
{
|
||||
_ctx = new GenericApplicationContext();
|
||||
|
||||
var builder = ObjectDefinitionBuilder.GenericObjectDefinition(typeof(ObjectDefinitions));
|
||||
_ctx.RegisterObjectDefinition("whoCares", builder.ObjectDefinition);
|
||||
|
||||
_postProcessor = new ConfigurationClassPostProcessor();
|
||||
_postProcessor.PostProcessObjectDefinitionRegistry(_ctx);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanRegisterDefintions()
|
||||
{
|
||||
Assert.That(_ctx.ObjectDefinitionCount, Is.EqualTo(3));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanRetreiveActualObjectsFromContext()
|
||||
{
|
||||
Assert.That(_ctx[typeof(Parent).Name], Is.TypeOf<Parent>());
|
||||
Assert.That(_ctx[typeof(Child).Name], Is.TypeOf<Child>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanSatisfyDependenciesOfObjects()
|
||||
{
|
||||
Assert.That(((Parent)_ctx[typeof(Parent).Name]).Child, Is.Not.Null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Configuration]
|
||||
public class ObjectDefinitions
|
||||
{
|
||||
[Definition]
|
||||
public Parent Parent()
|
||||
{
|
||||
return new Parent(Child());
|
||||
}
|
||||
|
||||
[Definition]
|
||||
public Child Child()
|
||||
{
|
||||
return new Child();
|
||||
}
|
||||
}
|
||||
|
||||
public class Parent
|
||||
{
|
||||
private Child _child;
|
||||
|
||||
public Parent(Child child)
|
||||
{
|
||||
_child = child;
|
||||
}
|
||||
|
||||
public Child Child
|
||||
{
|
||||
get
|
||||
{
|
||||
return _child;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public class Child { }
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Spring.Core.Configuration.Tests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("Spring.Core.Configuration.Tests")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("65e12092-0586-435f-b9ef-e4a35c302bef")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{4F1A206C-09A8-43FF-B791-FE956E99A120}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Spring.Core.Configuration.Tests</RootNamespace>
|
||||
<AssemblyName>Spring.Core.Configuration.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.framework, Version=2.5.7.10213, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\lib\Net\2.0\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Context\Attributes\ConfigurationClassPostProcessorTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Aop\Spring.Aop.2010.csproj">
|
||||
<Project>{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}</Project>
|
||||
<Name>Spring.Aop.2010</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Core.Configuration\Spring.Core.Configuration.2010.csproj">
|
||||
<Project>{7B65D538-E863-4F57-8DDC-2C38E4150045}</Project>
|
||||
<Name>Spring.Core.Configuration.2010</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.2010.csproj">
|
||||
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
|
||||
<Name>Spring.Core.2010</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
Reference in New Issue
Block a user