Changeset 427

Show
Ignore:
Timestamp:
02/08/10 23:52:45 (6 months ago)
Author:
serialseb
Message:

trunk changes pre-RC

Location:
trunk/src
Files:
4 added
1 removed
43 modified
1 copied
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/aspnet/OpenRasta.Codecs.WebForms.Tests.Unit/OpenRasta.Codecs.WebForms.Tests.Unit.csproj

    r272 r427  
    3636      <HintPath>..\..\..\lib\nunit-2.5\nunit.framework.dll</HintPath> 
    3737    </Reference> 
    38     <Reference Include="OpenRasta, Version=2.0.0.0, Culture=neutral, PublicKeyToken=e04bf464d7caae73, processorArchitecture=MSIL"> 
    39       <SpecificVersion>False</SpecificVersion> 
    40       <HintPath>..\..\..\bin\Release\net-35\OpenRasta.dll</HintPath> 
    41     </Reference> 
    4238    <Reference Include="OpenRasta.Testing, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"> 
    4339      <SpecificVersion>False</SpecificVersion> 
    44       <HintPath>..\..\..\bin\Release\net-35\OpenRasta.Testing.dll</HintPath> 
     40      <HintPath>..\..\..\bin\$(Configuration)\net-35\OpenRasta.Testing.dll</HintPath> 
    4541    </Reference> 
    4642    <Reference Include="System" /> 
    47     <Reference Include="System.Core"> 
    48       <RequiredTargetFramework>3.5</RequiredTargetFramework> 
    49     </Reference> 
    5043    <Reference Include="System.Web" /> 
    51     <Reference Include="System.Xml.Linq"> 
    52       <RequiredTargetFramework>3.5</RequiredTargetFramework> 
    53     </Reference> 
    54     <Reference Include="System.Data.DataSetExtensions"> 
    55       <RequiredTargetFramework>3.5</RequiredTargetFramework> 
    56     </Reference> 
    5744    <Reference Include="System.Data" /> 
    5845    <Reference Include="System.Xml" /> 
     
    6956    </ProjectReference> 
    7057  </ItemGroup> 
     58  <ItemGroup> 
     59    <None Include="dependencies.targets" /> 
     60  </ItemGroup> 
     61  <Import Project="dependencies.targets" /> 
    7162  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 
    7263  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.  
  • trunk/src/aspnet/OpenRasta.Codecs.WebForms/dependencies.targets

    r230 r427  
    44  <PropertyGroup> 
    55    <RootPath Condition="'$(RootPath)' == ''">$(MSBuildProjectDirectory)\..\..\..</RootPath> 
    6      
    7      
    86    <OpenRasta>2.0</OpenRasta> 
    97  </PropertyGroup> 
  • trunk/src/aspnet/OpenRasta.Hosting.AspNet/AspNetRequest.cs

    r356 r427  
    1414using System.Web; 
    1515using OpenRasta.Web; 
     16using OpenRasta.Web.Headers; 
    1617 
    1718namespace OpenRasta.Hosting.AspNet 
     
    2526            NativeContext = context; 
    2627            Uri = NativeContext.Request.Url; 
    27             Headers = new HttpHeaderDictionary(NativeContext.Request.Headers); 
     28            Headers = new HttpHeaderDictionary(); 
     29            CopyNativeHeaders(); 
    2830 
    2931            // TODO: Finish off the new input stream that goes to the 
     
    3436                Entity.ContentType = new MediaType(NativeContext.Request.ContentType); 
    3537            CodecParameters = new List<string>(); 
     38        } 
     39 
     40        void CopyNativeHeaders() 
     41        { 
     42            foreach(var nativeHeader in NativeContext.Request.Headers.AllKeys) 
     43            { 
     44                Headers[nativeHeader] = NativeContext.Request.Headers[nativeHeader]; 
     45            } 
    3646        } 
    3747 
  • trunk/src/aspnet/OpenRasta.Hosting.AspNet/AspNetResponse.cs

    r356 r427  
    1010 
    1111using System; 
     12using System.Collections.Generic; 
    1213using System.Web; 
    1314using OpenRasta.DI; 
    1415using OpenRasta.Diagnostics; 
    1516using OpenRasta.Web; 
     17using OpenRasta.Web.Headers; 
     18using OpenRasta.Web.Headers.Entity; 
    1619 
    1720namespace OpenRasta.Hosting.AspNet 
     
    2427            Headers = new HttpHeaderDictionary(); 
    2528            Entity = new HttpEntity(Headers, NativeContext.Response.OutputStream); 
    26         } 
    27  
    28         public long? ContentLength 
    29         { 
    30             get { return Headers.ContentLength; } 
    31             set { Headers.ContentLength = value; } 
    32         } 
    33  
    34         public string ContentType 
    35         { 
    36             get { return Headers.ContentType.ToString(); } 
    37             set { Headers.ContentType = new MediaType(value); } 
    3829        } 
    3930 
     
    5950                try 
    6051                { 
    61                     Log.WriteDebug("Writing http header {0}:{1}", header.Key, header.Value); 
    62                     NativeContext.Response.AppendHeader(header.Key, header.Value); 
     52                    Log.WriteDebug("Writing http header {0}:{1}", header.FieldName, header.FieldValue); 
     53                    NativeContext.Response.AppendHeader(header.FieldName, header.FieldValue); 
    6354                } 
    6455                catch (Exception ex) 
  • trunk/src/aspnet/OpenRasta.Hosting.AspNet/HttpInputStream.cs

    r356 r427  
    1414namespace OpenRasta.Hosting.AspNet 
    1515{ 
     16    /* 
    1617    public class HttpInputStream : Stream 
    1718    { 
     
    6970        } 
    7071    } 
     72     * */ 
    7173} 
    7274 
  • trunk/src/core/OpenRasta/OpenRasta.csproj.resharper

    r370 r427  
    11<Configuration> 
    22  <NamespaceFolders> 
     3    <SkipFolder>C3ED9CCE-A140-4D0F-AE00-FBBF4CD27647/d:Codecs/d:application/d:json</SkipFolder> 
    34    <SkipFolder>C3ED9CCE-A140-4D0F-AE00-FBBF4CD27647/d:Codecs/d:application/d:octet-stream</SkipFolder> 
    45    <SkipFolder>C3ED9CCE-A140-4D0F-AE00-FBBF4CD27647/d:Codecs/d:application/d:x-www-form-urlencoded</SkipFolder> 
     
    1011    <SkipFolder>C3ED9CCE-A140-4D0F-AE00-FBBF4CD27647/d:Codecs/d:text/d:plain</SkipFolder> 
    1112    <SkipFolder>C3ED9CCE-A140-4D0F-AE00-FBBF4CD27647/d:Codecs/d:text</SkipFolder> 
     13    <SkipFolder>C3ED9CCE-A140-4D0F-AE00-FBBF4CD27647/d:Web/d:Markup/d:Controls</SkipFolder> 
    1214  </NamespaceFolders> 
    1315</Configuration> 
  • trunk/src/core/core.4.5.resharper

    r363 r427  
    2323args 
    2424localhost 
    25 Accessor</UserWords> 
     25Accessor 
     26Json 
     27Queryable 
     28Linq 
     29tokenizers 
     30Tokenizer</UserWords> 
    2631            </CustomDictionary> 
    2732            <CustomDictionary> 
  • trunk/src/ninject/OpenRasta.DI.Ninject.Tests.Unit/OpenRasta.DI.Ninject.Tests.Unit.csproj

    r353 r427  
    4646      <HintPath>..\..\..\lib\nunit-2.5\nunit.framework.dll</HintPath> 
    4747    </Reference> 
    48     <Reference Include="OpenRasta, Version=2.0.1.0, Culture=neutral, PublicKeyToken=e04bf464d7caae73, processorArchitecture=MSIL"> 
    49       <SpecificVersion>False</SpecificVersion> 
    50       <HintPath>..\..\..\bin\Release\net-35\OpenRasta.dll</HintPath> 
    51     </Reference> 
    5248    <Reference Include="OpenRasta.Testing, Version=2.0.1.0, Culture=neutral, processorArchitecture=MSIL"> 
    5349      <SpecificVersion>False</SpecificVersion> 
    54       <HintPath>..\..\..\bin\Release\net-35\OpenRasta.Testing.dll</HintPath> 
     50      <HintPath>..\..\..\bin\$(Configuration)\net-35\OpenRasta.Testing.dll</HintPath> 
    5551    </Reference> 
    56     <Reference Include="OpenRasta.Tests.Unit, Version=2.0.1.0, Culture=neutral, processorArchitecture=MSIL"> 
     52    <Reference Include="OpenRasta.Tests.Unit, Version=2.0.3.0, Culture=neutral, processorArchitecture=MSIL"> 
    5753      <SpecificVersion>False</SpecificVersion> 
    58       <HintPath>..\..\..\bin\Release\net-35\OpenRasta.Tests.Unit.dll</HintPath> 
     54      <HintPath>..\..\..\bin\$(Configuration)\net-35\OpenRasta.Tests.Unit.dll</HintPath> 
    5955    </Reference> 
    6056    <Reference Include="System" /> 
    61     <Reference Include="System.Core"> 
    62       <RequiredTargetFramework>3.5</RequiredTargetFramework> 
    63     </Reference> 
    64     <Reference Include="System.Xml.Linq"> 
    65       <RequiredTargetFramework>3.5</RequiredTargetFramework> 
    66     </Reference> 
    67     <Reference Include="System.Data.DataSetExtensions"> 
    68       <RequiredTargetFramework>3.5</RequiredTargetFramework> 
    69     </Reference> 
    7057    <Reference Include="System.Data" /> 
    7158    <Reference Include="System.Xml" /> 
     
    8269    </ProjectReference> 
    8370  </ItemGroup> 
     71  <ItemGroup> 
     72    <None Include="dependencies.targets" /> 
     73  </ItemGroup> 
    8474  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 
     75  <Import Project="dependencies.targets" /> 
    8576  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.  
    8677       Other similar extension points exist, see Microsoft.Common.targets. 
  • trunk/src/ninject/OpenRasta.DI.Ninject/OpenRasta.DI.Ninject.csproj

    r339 r427  
    1818    <DebugType>full</DebugType> 
    1919    <Optimize>false</Optimize> 
    20     <OutputPath>..\..\..\bin\vs\bin\Debug\OpenRasta.DI.Ninject\</OutputPath> 
    2120    <DefineConstants>DEBUG;TRACE</DefineConstants> 
    2221    <ErrorReport>prompt</ErrorReport> 
    2322    <WarningLevel>4</WarningLevel> 
    24     <DocumentationFile>..\..\..\bin\vs\bin\Debug\OpenRasta.DI.Ninject\OpenRasta.DI.Ninject.xml</DocumentationFile> 
    2523    <NoWarn>1591;1591</NoWarn> 
    2624  </PropertyGroup> 
     
    2826    <DebugType>pdbonly</DebugType> 
    2927    <Optimize>true</Optimize> 
    30     <OutputPath>..\..\..\bin\vs\bin\Release\OpenRasta.DI.Ninject\</OutputPath> 
    3128    <DefineConstants>TRACE</DefineConstants> 
    3229    <ErrorReport>prompt</ErrorReport> 
    3330    <WarningLevel>4</WarningLevel> 
    34     <DocumentationFile>..\..\..\bin\vs\bin\Release\OpenRasta.DI.Ninject\OpenRasta.DI.Ninject.xml</DocumentationFile> 
    3531  </PropertyGroup> 
    3632  <ItemGroup> 
     
    3935      <HintPath>..\..\..\lib\ninject-2.0\Ninject.dll</HintPath> 
    4036    </Reference> 
    41     <Reference Include="OpenRasta, Version=2.0.1.0, Culture=neutral, PublicKeyToken=e04bf464d7caae73, processorArchitecture=MSIL"> 
    42       <SpecificVersion>False</SpecificVersion> 
    43       <HintPath>..\..\..\bin\Release\net-35\OpenRasta.dll</HintPath> 
    44     </Reference> 
    4537    <Reference Include="System" /> 
    46     <Reference Include="System.Core"> 
    47       <RequiredTargetFramework>3.5</RequiredTargetFramework> 
    48     </Reference> 
    49     <Reference Include="System.Xml.Linq"> 
    50       <RequiredTargetFramework>3.5</RequiredTargetFramework> 
    51     </Reference> 
    52     <Reference Include="System.Data.DataSetExtensions"> 
    53       <RequiredTargetFramework>3.5</RequiredTargetFramework> 
    54     </Reference> 
    5538    <Reference Include="System.Data" /> 
    5639    <Reference Include="System.Xml" /> 
     
    7053    <Compile Include="WebBinding.cs" /> 
    7154  </ItemGroup> 
     55  <ItemGroup> 
     56    <None Include="dependencies.targets" /> 
     57  </ItemGroup> 
     58  <Import Project="dependencies.targets" /> 
    7259  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 
    7360  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.  
  • trunk/src/openbastard/OpenBastard.TestRunner/Environments/HttpWebRequestEnvironment.cs

    r356 r427  
    5858                try 
    5959                { 
    60                     webRequest.Headers[header.Key] = header.Value; 
     60                    webRequest.Headers.Add(header.FieldName, header.FieldValue); 
    6161                } 
    6262                catch (ArgumentException) 
  • trunk/src/openbastard/OpenBastard.TestRunner/Environments/WebRequestResponse.cs

    r363 r427  
    55using OpenRasta.Codecs; 
    66using OpenRasta.Web; 
     7using OpenRasta.Web.Headers; 
    78 
    89namespace OpenBastard.Environments 
  • trunk/src/openbastard/openbastard.sln

    r356 r427  
    1111EndProject 
    1212Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenBastard.Hosting.Iis7.WorkerProcess-64", "OpenBastard.Hosting.Iis7.WorkerProcess-64\OpenBastard.Hosting.Iis7.WorkerProcess-64.csproj", "{F7152A67-F16E-4EE4-A39A-0450767BC5C9}" 
     13EndProject 
     14Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{6FE34CE4-E647-4C64-AFE7-F5DF5A00B8E4}" 
     15        ProjectSection(SolutionItems) = preProject 
     16                ..\..\build\openbastard.proj = ..\..\build\openbastard.proj 
     17        EndProjectSection 
    1318EndProject 
    1419Global 
  • trunk/src/sharpview/OpenRasta.Codecs.SharpView.Tests.Unit/OpenRasta.Codecs.SharpView.Tests.Unit.csproj

    r243 r427  
    3636      <HintPath>..\..\..\lib\nunit-2.5\nunit.framework.dll</HintPath> 
    3737    </Reference> 
    38     <Reference Include="OpenRasta, Version=2.0.1.0, Culture=neutral, processorArchitecture=MSIL"> 
    39       <SpecificVersion>False</SpecificVersion> 
    40       <HintPath>..\..\..\bin\Release\net-35\OpenRasta.dll</HintPath> 
    41     </Reference> 
    4238    <Reference Include="OpenRasta.Testing, Version=2.0.1.0, Culture=neutral, processorArchitecture=MSIL"> 
    4339      <SpecificVersion>False</SpecificVersion> 
     
    4541    </Reference> 
    4642    <Reference Include="System" /> 
    47     <Reference Include="System.Core"> 
    48       <RequiredTargetFramework>3.5</RequiredTargetFramework> 
    49     </Reference> 
    50     <Reference Include="System.Xml.Linq"> 
    51       <RequiredTargetFramework>3.5</RequiredTargetFramework> 
    52     </Reference> 
    53     <Reference Include="System.Data.DataSetExtensions"> 
    54       <RequiredTargetFramework>3.5</RequiredTargetFramework> 
    55     </Reference> 
    5643    <Reference Include="System.Data" /> 
    5744    <Reference Include="System.Xml" /> 
     
    6754  </ItemGroup> 
    6855  <ItemGroup> 
     56    <None Include="dependencies.targets" /> 
     57  </ItemGroup> 
     58  <ItemGroup> 
    6959    <Folder Include="Properties\" /> 
    7060  </ItemGroup> 
    7161  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 
     62  <Import Project="dependencies.targets" /> 
    7263  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.  
    7364       Other similar extension points exist, see Microsoft.Common.targets. 
  • trunk/src/sharpview/OpenRasta.Codecs.SharpView.Tests.Unit/SharpView_Specification.cs

    r420 r427  
    414414            Expression<Func<object>> expr = () => customer.Orders.Current().Lines; 
    415415            var property = new PropertyPathForIteratorVisitor().BuildPropertyPath(expr); 
    416             property.TypePrefix.ShouldBe("Order"); 
    417             property.TypeSuffix.ShouldBe("Lines"); 
     416            property.RootType.ShouldBe("Order"); 
     417            property.Path.ShouldBe("Lines"); 
    418418        } 
    419419 
     
    424424            Expression<Func<object>> expr = () => customer.MainOrder.Lines; 
    425425            var property = new PropertyPathForIteratorVisitor().BuildPropertyPath(expr); 
    426             property.TypePrefix.ShouldBe("Customer"); 
    427             property.TypeSuffix.ShouldBe("MainOrder.Lines"); 
     426            property.RootType.ShouldBe("Customer"); 
     427            property.Path.ShouldBe("MainOrder.Lines"); 
    428428        } 
    429429        [Test] 
     
    433433            Expression<Func<object>> expr = () => customer.Orders[0].Lines; 
    434434            var property = new PropertyPathForIteratorVisitor().BuildPropertyPath(expr); 
    435             property.TypePrefix.ShouldBe("Customer"); 
    436             property.TypeSuffix.ShouldBe("Orders:0.Lines"); 
     435            property.RootType.ShouldBe("Customer"); 
     436            property.Path.ShouldBe("Orders:0.Lines"); 
    437437        } 
    438438    } 
  • trunk/src/sharpview/OpenRasta.Codecs.SharpView/OpenRasta.Codecs.SharpView.csproj

    r300 r427  
    2121    <ErrorReport>prompt</ErrorReport> 
    2222    <WarningLevel>4</WarningLevel> 
    23     <DocumentationFile>..\..\bin\OpenRasta.Codecs.SharpView\OpenRasta.Codecs.SharpView.xml</DocumentationFile> 
    2423  </PropertyGroup> 
    2524  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 
  • trunk/src/sharpview/OpenRasta.Codecs.SharpView/SourcedElementExtensions.cs

    r300 r427  
    1212using System.Collections; 
    1313using System.Collections.Generic; 
    14 using OpenRasta.Reflection; 
     14using OpenRasta.Binding.Path; 
    1515using OpenRasta.Web.Markup; 
    1616 
     
    5151        public static IEnumerable<TResult> SelectHtml<TSource, TResult>(this IEnumerable<TSource> source, 
    5252                                                                        object rootInstance, 
    53                                                                         PropertyPath path, 
     53                                                                        MemberPath path, 
    5454                                                                        Func<TSource, TResult> selector) 
    5555        { 
     
    6161                try 
    6262                { 
    63                     PropertyPath pathToAdd; 
     63                    MemberPath pathToAdd; 
    6464                    if (rootInstance != null) 
    6565                    { 
    66                         PropertyPath rootPath = ObjectPaths.Get(rootInstance); 
    67                         pathToAdd = new PropertyPath 
     66                        MemberPath rootPath = MemberPathsContext.Get(rootInstance); 
     67                        pathToAdd = new MemberPath 
    6868                            { 
    69                                 TypePrefix = rootPath.TypePrefix, 
    70                                 TypeSuffix = rootPath.TypeSuffix + "." + path.TypeSuffix + ":" + index 
     69                                RootType = rootPath.RootType, 
     70                                Path = rootPath.Path + "." + path.Path + ":" + index 
    7171                            }; 
    7272                    } 
    7373                    else 
    7474                    { 
    75                         pathToAdd = new PropertyPath 
     75                        pathToAdd = new MemberPath 
    7676                            { 
    77                                 TypePrefix = path.TypePrefix, 
    78                                 TypeSuffix = path.TypeSuffix + ":" + index 
     77                                RootType = path.RootType, 
     78                                Path = path.Path + ":" + index 
    7979                            }; 
    8080                    } 
    81                     ObjectPaths.Add(item, pathToAdd); 
     81                    MemberPathsContext.Add(item, pathToAdd); 
    8282                    yield return selector(item); 
    8383                } 
    8484                finally 
    8585                { 
    86                     ObjectPaths.Remove(item); 
     86                    MemberPathsContext.Remove(item); 
    8787                    index++; 
    8888                } 
  • trunk/src/sharpview/OpenRasta.Codecs.SharpView/Visitors/ChildScopeForEachFinder.cs

    r300 r427  
    11using System.Linq.Expressions; 
    2 using OpenRasta.Reflection; 
     2using OpenRasta.Binding.Path.Visitors; 
     3using OpenRasta.Linq.Visitors; 
    34 
    45namespace OpenRasta.Codecs.SharpView.Visitors 
  • trunk/src/sharpview/OpenRasta.Codecs.SharpView/Visitors/ChildScopeRewriterVisitor.cs

    r300 r427  
    22using System.Linq.Expressions; 
    33using System.Reflection; 
    4 using OpenRasta.Reflection; 
     4using OpenRasta.Binding.Path.Visitors; 
     5using OpenRasta.Linq.Visitors; 
    56 
    67namespace OpenRasta.Codecs.SharpView.Visitors 
  • trunk/src/sharpview/OpenRasta.Codecs.SharpView/Visitors/CurrentItemRewriterVisitor.cs

    r300 r427  
    1111using System.Linq.Expressions; 
    1212using IQ; 
    13 using OpenRasta.Reflection; 
     13using OpenRasta.Binding.Path.Visitors; 
     14using OpenRasta.Linq.Visitors; 
    1415 
    1516namespace OpenRasta.Codecs.SharpView.Visitors 
  • trunk/src/sharpview/OpenRasta.Codecs.SharpView/Visitors/ForEachRewriter.cs

    r300 r427  
    44using System.Linq.Expressions; 
    55using System.Reflection; 
    6 using OpenRasta.Reflection; 
     6using OpenRasta.Binding.Path; 
    77using OpenRasta.Web.Markup; 
    88 
     
    5454                                   nullPropagatingIterator, 
    5555                                   Expression.Constant(null, typeof(object)), 
    56                                    Expression.Constant(null, typeof(PropertyPath)), 
     56                                   Expression.Constant(null, typeof(MemberPath)), 
    5757                                   projection); 
    5858        } 
  • trunk/src/sharpview/OpenRasta.Codecs.SharpView/Visitors/IfRewriterVisitor.cs

    r300 r427  
    1212using System.Linq; 
    1313using System.Linq.Expressions; 
    14 using OpenRasta.Reflection; 
     14using OpenRasta.Binding.Path.Visitors; 
    1515using OpenRasta.TypeSystem.ReflectionBased; 
     16using OpenRasta.Linq.Visitors; 
    1617 
    1718namespace OpenRasta.Codecs.SharpView.Visitors 
  • trunk/src/sharpview/OpenRasta.Codecs.SharpView/Visitors/MemberAccessNullPropagateVisitor.cs

    r300 r427  
    1111using System; 
    1212using System.Linq.Expressions; 
    13 using OpenRasta.Reflection; 
     13using OpenRasta.Binding.Path.Visitors; 
    1414using OpenRasta.TypeSystem.ReflectionBased; 
     15using OpenRasta.Linq.Visitors; 
    1516 
    1617namespace OpenRasta.Codecs.SharpView.Visitors 
  • trunk/src/sharpview/OpenRasta.Codecs.SharpView/Visitors/PropertyPathForIteratorVisitor.cs

    r300 r427  
    11using System.Linq.Expressions; 
    22using System.Text; 
    3 using OpenRasta.Reflection; 
     3using OpenRasta.Binding.Path.Visitors; 
    44 
    55namespace OpenRasta.Codecs.SharpView.Visitors 
    66{ 
    7     public class PropertyPathForIteratorVisitor : PropertyPathVisitor 
     7    public class PropertyPathForIteratorVisitor : MemberPathVisitor 
    88    { 
    99        protected override Expression VisitMethodCall(MethodCallExpression m) 
  • trunk/src/sharpview/OpenRasta.Codecs.SharpView/Visitors/ScopedForEachFinder.cs

    r300 r427  
    11using System; 
    22using System.Linq.Expressions; 
    3 using OpenRasta.Reflection; 
     3using OpenRasta.Binding.Path.Visitors; 
    44using OpenRasta.Web.Markup; 
    55using OpenRasta.Web.Markup.Elements; 
     6using OpenRasta.Linq.Visitors; 
    67 
    78namespace OpenRasta.Codecs.SharpView.Visitors 
  • trunk/src/sharpview/OpenRasta.Codecs.SharpView/Visitors/SelectHtmlPropertyPathRewriter.cs

    r300 r427  
    11using System.Linq.Expressions; 
    2 using OpenRasta.Reflection; 
     2using OpenRasta.Binding.Path; 
     3using OpenRasta.Binding.Path.Visitors; 
     4using OpenRasta.Linq.Visitors; 
    35 
    46namespace OpenRasta.Codecs.SharpView.Visitors 
     
    1820                Expression nullPropagatingIterator = new MemberAccessNullPropagateVisitor().Rewrite(iterator); 
    1921 
    20                 PropertyPath iteratorPath = CreatePropertyPath(iterator); 
     22                var iteratorPath = CreatePropertyPath(iterator); 
    2123 
    2224                Expression iteratorRoot = GetIteratorRoot(iterator); 
     
    3537        } 
    3638 
    37         static PropertyPath CreatePropertyPath(Expression expression) 
     39        static MemberPath CreatePropertyPath(Expression expression) 
    3840        { 
    3941            return new PropertyPathForIteratorVisitor().BuildPropertyPath(expression); 
  • trunk/src/unity/OpenRasta.DI.Unity.Sample/OpenRasta.DI.Unity.Sample.csproj

    r387 r427  
    4242    <Reference Include="OpenRasta, Version=2.0.3.0, Culture=neutral, PublicKeyToken=e04bf464d7caae73, processorArchitecture=MSIL"> 
    4343      <SpecificVersion>False</SpecificVersion> 
    44       <HintPath>..\..\..\bin\Release\net-35\OpenRasta.dll</HintPath> 
     44      <HintPath>..\..\..\bin\$(Configuration)\net-35\OpenRasta.dll</HintPath> 
    4545    </Reference> 
    4646    <Reference Include="OpenRasta.Hosting.AspNet, Version=2.0.3.0, Culture=neutral, processorArchitecture=MSIL"> 
    4747      <SpecificVersion>False</SpecificVersion> 
    48       <HintPath>..\..\..\bin\Release\net-35\OpenRasta.Hosting.AspNet.dll</HintPath> 
     48      <HintPath>..\..\..\bin\$(Configuration)\net-35\OpenRasta.Hosting.AspNet.dll</HintPath> 
    4949    </Reference> 
    5050    <Reference Include="System" /> 
  • trunk/src/unity/OpenRasta.DI.Unity.Tests.Unit/OpenRasta.DI.Unity.Tests.Unit.csproj

    r387 r427  
    1818    <DebugType>full</DebugType> 
    1919    <Optimize>false</Optimize> 
    20     <OutputPath>..\..\..\bin\vs\bin\Debug\OpenRasta.DI.Unity.Tests.Unit\</OutputPath> 
    2120    <DefineConstants>DEBUG;TRACE</DefineConstants> 
    2221    <ErrorReport>prompt</ErrorReport> 
    2322    <WarningLevel>4</WarningLevel> 
    2423    <TreatWarningsAsErrors>true</TreatWarningsAsErrors> 
    25     <DocumentationFile> 
    26     </DocumentationFile> 
    2724  </PropertyGroup> 
    2825  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 
    2926    <DebugType>pdbonly</DebugType> 
    3027    <Optimize>true</Optimize> 
    31     <OutputPath>bin\Release\</OutputPath> 
    3228    <DefineConstants>TRACE</DefineConstants> 
    3329    <ErrorReport>prompt</ErrorReport> 
     
    4339      <HintPath>..\..\..\lib\nunit-2.5\nunit.framework.dll</HintPath> 
    4440    </Reference> 
    45     <Reference Include="OpenRasta, Version=2.0.3.0, Culture=neutral, PublicKeyToken=e04bf464d7caae73, processorArchitecture=MSIL"> 
    46       <SpecificVersion>False</SpecificVersion> 
    47       <HintPath>..\..\..\bin\Release\net-35\OpenRasta.dll</HintPath> 
    48     </Reference> 
    4941    <Reference Include="OpenRasta.Testing, Version=2.0.3.0, Culture=neutral, processorArchitecture=MSIL"> 
    5042      <SpecificVersion>False</SpecificVersion> 
    51       <HintPath>..\..\..\bin\Release\net-35\OpenRasta.Testing.dll</HintPath> 
     43      <HintPath>..\..\..\bin\$(Configuration)\net-35\OpenRasta.Testing.dll</HintPath> 
    5244    </Reference> 
    5345    <Reference Include="OpenRasta.Tests.Unit, Version=2.0.3.0, Culture=neutral, processorArchitecture=MSIL"> 
    5446      <SpecificVersion>False</SpecificVersion> 
    55       <HintPath>..\..\..\bin\Release\net-35\OpenRasta.Tests.Unit.dll</HintPath> 
     47      <HintPath>..\..\..\bin\$(Configuration)\net-35\OpenRasta.Tests.Unit.dll</HintPath> 
    5648    </Reference> 
    5749    <Reference Include="System" /> 
    58     <Reference Include="System.Core"> 
    59       <RequiredTargetFramework>3.5</RequiredTargetFramework> 
    60     </Reference> 
    61     <Reference Include="System.Xml.Linq"> 
    62       <RequiredTargetFramework>3.5</RequiredTargetFramework> 
    63     </Reference> 
    64     <Reference Include="System.Data.DataSetExtensions"> 
    65       <RequiredTargetFramework>3.5</RequiredTargetFramework> 
    66     </Reference> 
    6750    <Reference Include="System.Data" /> 
    6851    <Reference Include="System.Xml" /> 
     
    7861    </ProjectReference> 
    7962  </ItemGroup> 
     63  <ItemGroup> 
     64    <None Include="dependencies.targets" /> 
     65  </ItemGroup> 
     66  <Import Project="dependencies.targets" /> 
    8067  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 
    8168  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.  
  • trunk/src/unity/OpenRasta.DI.Unity/Extensions/CycleDetector.cs

    r387 r427  
    99    /// Adds early detection of circular references to prevent <see cref="StackOverflowException"/>s. 
    1010    /// </summary> 
    11     class CycleDetector : UnityContainerExtension 
     11    internal class CycleDetector : UnityContainerExtension 
    1212    { 
    1313        protected override void Initialize() 
     
    1717    } 
    1818} 
    19  
  • trunk/src/unity/OpenRasta.DI.Unity/Extensions/InjectionPolicies.cs

    r387 r427  
    1010    /// individual policies for details. 
    1111    /// </summary> 
    12     class InjectionPolicies : UnityContainerExtension 
     12    internal class InjectionPolicies : UnityContainerExtension 
    1313    { 
    1414        protected override void Initialize() 
     
    3030        void ApplyPolicies(Type type) 
    3131        { 
    32             if(type == null) 
     32            if (type == null) 
    3333                return; 
    3434 
  • trunk/src/unity/OpenRasta.DI.Unity/Extensions/Policies/ConstructorSelectorPolicy.cs

    r389 r427  
    1515    /// provided. 
    1616    /// </remarks> 
    17     class ConstructorSelectorPolicy : IConstructorSelectorPolicy 
     17    internal class ConstructorSelectorPolicy : IConstructorSelectorPolicy 
    1818    { 
    19         /// <summary> 
    20         /// Exposes part of Unity's default policy which is marked protected. 
    21         /// </summary> 
    22         class ParameterResolver : DefaultUnityConstructorSelectorPolicy 
    23         { 
    24             public IDependencyResolverPolicy GetResolver(ParameterInfo parameterInfo) 
    25             { 
    26                 return CreateResolver(parameterInfo); 
    27             } 
    28         } 
    29  
    30         readonly ParameterResolver parameterResolver = new ParameterResolver(); 
     19        readonly ParameterResolver _parameterResolver = new ParameterResolver(); 
    3120 
    3221        public SelectedConstructor SelectConstructor(IBuilderContext context) 
     
    4736            { 
    4837                parameters.Add(new TypeToBeResolved( 
    49                     parameter.ParameterType, 
    50                     parameterResolver.GetResolver(parameter))); 
     38                                   parameter.ParameterType,  
     39                                   _parameterResolver.GetResolver(parameter))); 
    5140            } 
    5241 
    5342            return new SpecifiedConstructorSelectorPolicy(constructor, parameters.ToArray()) 
    5443                .SelectConstructor(context); 
    55         } 
    56  
    57         static ConstructorInfo SelectConstructor(Type target, TypeTracker typeTracker) 
    58         { 
    59             ConstructorInfo best = null; 
    60             var bestScore = -1; 
    61  
    62             foreach (var constructor in target.GetConstructors()) 
    63             { 
    64                 var score = Rate(constructor, typeTracker); 
    65                  
    66                 if(score > bestScore) 
    67                 { 
    68                     best = constructor; 
    69                     bestScore = score; 
    70                 } 
    71             } 
    72  
    73             return best; 
    7444        } 
    7545 
     
    8353                return int.MaxValue; 
    8454 
    85             var score = 0; 
     55            int score = 0; 
    8656 
    8757            foreach (var parameter in constructor.GetParameters()) 
    8858            { 
    89                 if(parameter.IsOut || parameter.IsRetval) 
     59                if (parameter.IsOut || parameter.IsRetval) 
    9060                    return -1; 
    9161 
     
    10373            return score; 
    10474        } 
     75 
     76        static ConstructorInfo SelectConstructor(Type target, TypeTracker typeTracker) 
     77        { 
     78            ConstructorInfo best = null; 
     79            int bestScore = -1; 
     80 
     81            foreach (var constructor in target.GetConstructors()) 
     82            { 
     83                int score = Rate(constructor, typeTracker); 
     84 
     85                if (score > bestScore) 
     86                { 
     87                    best = constructor; 
     88                    bestScore = score; 
     89                } 
     90            } 
     91 
     92            return best; 
     93        } 
     94 
     95        /// <summary> 
     96        /// Exposes part of Unity's default policy which is marked protected. 
     97        /// </summary> 
     98        class ParameterResolver : DefaultUnityConstructorSelectorPolicy 
     99        { 
     100            public IDependencyResolverPolicy GetResolver(ParameterInfo parameterInfo) 
     101            { 
     102                return CreateResolver(parameterInfo); 
     103            } 
     104        } 
    105105    } 
    106106} 
  • trunk/src/unity/OpenRasta.DI.Unity/Extensions/Policies/CycleDetectionPolicy.cs

    r387 r427  
    66    /// If set, indicates that cycle detection has begun for the current build operation. 
    77    /// </summary> 
    8     class CycleDetectionPolicy : IBuilderPolicy 
     8    internal class CycleDetectionPolicy : IBuilderPolicy 
    99    { 
    1010    } 
  • trunk/src/unity/OpenRasta.DI.Unity/Extensions/Policies/PropertySelectorPolicy.cs

    r389 r427  
    1414    /// Normally Unity only injects values for properties explicitly marked with an attribute. 
    1515    /// </remarks> 
    16     class PropertySelectorPolicy : IPropertySelectorPolicy 
     16    internal class PropertySelectorPolicy : IPropertySelectorPolicy 
    1717    { 
    1818        public IEnumerable<SelectedProperty> SelectProperties(IBuilderContext context) 
     
    2929            { 
    3030                // Ignore indexed properties 
    31                 if(property.GetIndexParameters().Length > 0) 
     31                if (property.GetIndexParameters().Length > 0) 
    3232                    continue; 
    3333 
    3434                // Ignore read only properties 
    35                 if(!property.CanWrite) 
     35                if (!property.CanWrite) 
    3636                    continue; 
    3737 
    3838                // Ignore properties we can't fill anyway 
    39                 if(!typeTracker.HasDependency(property.PropertyType)) 
     39                if (!typeTracker.HasDependency(property.PropertyType)) 
    4040                    continue; 
    4141 
     
    4646                    continue; 
    4747 
    48                 policy.AddPropertyAndValue(property, new TypeToBeResolved( 
    49                     property.PropertyType, 
    50                     GetResolver(property))); 
     48                policy.AddPropertyAndValue(property,  
     49                                           new TypeToBeResolved( 
     50                                               property.PropertyType,  
     51                                               GetResolver(property))); 
    5152            } 
    5253 
     
    5758        { 
    5859            var resolverAttributes = property 
    59                 .GetCustomAttributes(typeof (DependencyResolutionAttribute), false) 
     60                .GetCustomAttributes(typeof(DependencyResolutionAttribute), false) 
    6061                .OfType<DependencyResolutionAttribute>() 
    6162                .ToList(); 
     
    6869                return resolverAttributes[0].CreateResolver(property.PropertyType); 
    6970            } 
    70              
     71 
    7172            // If no custom logic was provided, this resolver will call back in to Unity.  Normally 
    7273            // Unity would only inject into properties if it had an attribute. 
  • trunk/src/unity/OpenRasta.DI.Unity/Extensions/Policies/TypeToBeResolved.cs

    r389 r427  
    88    /// Used by the injection policies to indicate how further dependencies will be resolved. 
    99    /// </summary> 
    10     class TypeToBeResolved : TypedInjectionValue 
     10    internal class TypeToBeResolved : TypedInjectionValue 
    1111    { 
    12         readonly IDependencyResolverPolicy resolver; 
     12        readonly IDependencyResolverPolicy _resolver; 
    1313 
    1414        public TypeToBeResolved(Type parameterType, IDependencyResolverPolicy resolver) 
    1515            : base(parameterType) 
    1616        { 
    17             this.resolver = resolver; 
     17            this._resolver = resolver; 
    1818        } 
    1919 
    2020        public override IDependencyResolverPolicy GetResolverPolicy(Type typeToBuild) 
    2121        { 
    22             return resolver; 
     22            return _resolver; 
    2323        } 
    2424    } 
  • trunk/src/unity/OpenRasta.DI.Unity/Extensions/Policies/TypeTrackerPolicy.cs

    r387 r427  
    88    public class TypeTrackerPolicy : IBuilderPolicy 
    99    { 
    10         public TypeTracker TypeTracker { get; private set; } 
    11  
    1210        public TypeTrackerPolicy(TypeTracker typeTracker) 
    1311        { 
    1412            TypeTracker = typeTracker; 
    1513        } 
     14 
     15        public TypeTracker TypeTracker { get; private set; } 
    1616    } 
    1717} 
  • trunk/src/unity/OpenRasta.DI.Unity/Extensions/Strategies/CycleDetectionStrategy.cs

    r387 r427  
    88    /// Detects cycles in the current build operation by watching for repeated build keys. 
    99    /// </summary> 
    10     class CycleDetectionStrategy : BuilderStrategy 
     10    internal class CycleDetectionStrategy : BuilderStrategy 
    1111    { 
    12         readonly HashSet<object> previousKeys = new HashSet<object>(); 
     12        readonly HashSet<object> _previousKeys = new HashSet<object>(); 
    1313 
    14         bool cycleDetected; 
     14        bool _cycleDetected; 
     15 
     16        public override void PostBuildUp(IBuilderContext context) 
     17        { 
     18            if (_cycleDetected) 
     19                throw new DependencyResolutionException("Circular dependency detected."); 
     20        } 
    1521 
    1622        public override void PreBuildUp(IBuilderContext context) 
     
    2329            if (policy == null) 
    2430            { 
    25                 previousKeys.Clear(); 
     31                _previousKeys.Clear(); 
    2632                context.Policies.SetDefault(new CycleDetectionPolicy()); 
    2733            } 
    2834 
    2935            // If we are seeing the same build key twice it means we've followed a cycle 
    30             if (previousKeys.Contains(context.OriginalBuildKey)) 
     36            if (_previousKeys.Contains(context.OriginalBuildKey)) 
    3137            { 
    32                 cycleDetected = true; 
     38                _cycleDetected = true; 
    3339                context.BuildComplete = true; 
    3440            } 
    3541 
    36             previousKeys.Add(context.BuildKey); 
    37         } 
    38  
    39         public override void PostBuildUp(IBuilderContext context) 
    40         { 
    41             if (cycleDetected) 
    42                 throw new DependencyResolutionException("Circular dependency detected."); 
     42            _previousKeys.Add(context.BuildKey); 
    4343        } 
    4444    } 
  • trunk/src/unity/OpenRasta.DI.Unity/Extensions/Strategies/TypeRegistrationRequiredStrategy.cs

    r387 r427  
    77    /// Makes sure that any types being built are actually registered in the container. 
    88    /// </summary> 
    9     class TypeRegistrationRequiredStrategy : BuilderStrategy 
     9    internal class TypeRegistrationRequiredStrategy : BuilderStrategy 
    1010    { 
    1111        public override void PreBuildUp(IBuilderContext context) 
     
    2121            var typeTracker = context.Policies.Get<TypeTrackerPolicy>(context.BuildKey).TypeTracker; 
    2222 
    23             if(!typeTracker.HasDependency(requestedType)) 
     23            if (!typeTracker.HasDependency(requestedType)) 
    2424                throw new DependencyResolutionException("Couldn't find type " + requestedType.FullName); 
    2525        } 
     
    2727        bool WeAreNotTheLast(IBuilderContext context) 
    2828        { 
    29             var foundUs = false; 
     29            bool foundUs = false; 
    3030 
    3131            foreach (var strategy in context.Strategies) 
    3232            { 
    33                 if(!(strategy is TypeRegistrationRequiredStrategy)) 
     33                if (!(strategy is TypeRegistrationRequiredStrategy)) 
    3434                    continue; 
    3535 
     
    3737                    return true; 
    3838 
    39                 if(strategy == this) 
     39                if (strategy == this) 
    4040                    foundUs = true; 
    4141            } 
  • trunk/src/unity/OpenRasta.DI.Unity/Extensions/TypeRegistrationRequired.cs

    r387 r427  
    88    /// Changes the default Unity behaviour so that types must be registered to be created. 
    99    /// </summary> 
    10     class TypeRegistrationRequired : UnityContainerExtension 
     10    internal class TypeRegistrationRequired : UnityContainerExtension 
    1111    { 
    1212        protected override void Initialize() 
  • trunk/src/unity/OpenRasta.DI.Unity/Extensions/TypeTracker.cs

    r387 r427  
    1616    public class TypeTracker : UnityContainerExtension 
    1717    { 
    18         readonly Dictionary<Type, HashSet<Type>> mappings = new Dictionary<Type, HashSet<Type>>(); 
     18        readonly Dictionary<Type, HashSet<Type>> _mappings = new Dictionary<Type, HashSet<Type>>(); 
     19 
     20        /// <summary> 
     21        /// Access the <see cref="TypeTracker"/> installed in our parent container.  This is necessary because we 
     22        /// are only notified about types registered in our container specifically, not ones added 
     23        /// to parent or child container. 
     24        /// </summary> 
     25        TypeTracker Parent 
     26        { 
     27            get 
     28            { 
     29                if (Container.Parent == null) 
     30                    return null; 
     31 
     32                return Container.Parent.TypeTracker(); 
     33            } 
     34        } 
     35 
     36        /// <summary> 
     37        /// Find all the possible implementations of the given type. 
     38        /// </summary> 
     39        public IEnumerable<Type> GetAllConcreteTypes(Type serviceType) 
     40        { 
     41            var types = new HashSet<Type>(); 
     42 
     43            if (_mappings.ContainsKey(serviceType)) 
     44                types.UnionWith(_mappings[serviceType]); 
     45 
     46            if (Parent != null) 
     47                types.UnionWith(Parent.GetAllConcreteTypes(serviceType)); 
     48 
     49            return types; 
     50        } 
     51 
     52        /// <summary> 
     53        /// Do we know of any implementations for the given type at all? 
     54        /// </summary> 
     55        public bool HasDependency(Type serviceType) 
     56        { 
     57            if (_mappings.ContainsKey(serviceType)) 
     58                return true; 
     59 
     60            if (Parent == null) 
     61                return false; 
     62 
     63            return Parent.HasDependency(serviceType); 
     64        } 
     65 
     66        /// <summary> 
     67        /// Do we know of a specific implementation of the given type? 
     68        /// </summary> 
     69        public bool HasDependencyImplementation(Type serviceType, Type concreteType) 
     70        { 
     71            if (_mappings.ContainsKey(serviceType)) 
     72            { 
     73                foreach (var type in _mappings[serviceType]) 
     74                { 
     75                    if (type == concreteType) 
     76                        return true; 
     77                } 
     78            } 
     79 
     80            if (Parent != null) 
     81                return Parent.HasDependencyImplementation(serviceType, concreteType); 
     82 
     83            return false; 
     84        } 
    1985 
    2086        protected override void Initialize() 
     
    40106                typeTo = typeFrom; 
    41107 
    42             if (!mappings.ContainsKey(typeFrom)) 
    43                 mappings[typeFrom] = new HashSet<Type>(); 
     108            if (!_mappings.ContainsKey(typeFrom)) 
     109                _mappings[typeFrom] = new HashSet<Type>(); 
    44110 
    45             if(!mappings.ContainsKey(typeTo)) 
    46                 mappings[typeTo] = new HashSet<Type>(); 
     111            if (!_mappings.ContainsKey(typeTo)) 
     112                _mappings[typeTo] = new HashSet<Type>(); 
    47113 
    48             mappings[typeFrom].Add(typeTo); 
    49             mappings[typeTo].Add(typeTo); 
    50         } 
    51  
    52         /// <summary> 
    53         /// Access the TypeTracker installed in our parent container.  This is necesary because we 
    54         /// are only notified about types registered in our container specifically, not ones added 
    55         /// to parent or child container. 
    56         /// </summary> 
    57         TypeTracker Parent 
    58         { 
    59             get 
    60             { 
    61                 if (Container.Parent == null) 
    62                     return null; 
    63  
    64                 return Container.Parent.TypeTracker(); 
    65             } 
    66         } 
    67  
    68         /// <summary> 
    69         /// Do we know of any implementations for the given type at all? 
    70         /// </summary> 
    71         public bool HasDependency(Type serviceType) 
    72         { 
    73             if (mappings.ContainsKey(serviceType)) 
    74                 return true; 
    75  
    76             if(Parent == null) 
    77                 return false; 
    78  
    79             return Parent.HasDependency(serviceType); 
    80         } 
    81  
    82         /// <summary> 
    83         /// Do we know of a specific implementation of the given type? 
    84         /// </summary> 
    85         public bool HasDependencyImplementation(Type serviceType, Type concreteType) 
    86         { 
    87             if(mappings.ContainsKey(serviceType)) 
    88             { 
    89                 foreach (var type in mappings[serviceType]) 
    90                 { 
    91                     if(type == concreteType) 
    92                         return true; 
    93                 } 
    94             } 
    95  
    96             if (Parent != null) 
    97                 return Parent.HasDependencyImplementation(serviceType, concreteType); 
    98  
    99             return false; 
    100         } 
    101  
    102         /// <summary> 
    103         /// Find all the possible implementations of the given type. 
    104         /// </summary> 
    105         public IEnumerable<Type> GetAllConcreteTypes(Type serviceType) 
    106         { 
    107             var types = new HashSet<Type>(); 
    108  
    109             if (mappings.ContainsKey(serviceType)) 
    110                 types.UnionWith(mappings[serviceType]); 
    111  
    112             if(Parent != null) 
    113                 types.UnionWith(Parent.GetAllConcreteTypes(serviceType)); 
    114  
    115             return types; 
     114            _mappings[typeFrom].Add(typeTo); 
     115            _mappings[typeTo].Add(typeTo); 
    116116        } 
    117117    } 
  • trunk/src/unity/OpenRasta.DI.Unity/OpenRasta.DI.Unity.csproj

    r389 r427  
    1818    <DebugType>full</DebugType> 
    1919    <Optimize>false</Optimize> 
    20     <OutputPath>..\..\..\bin\vs\bin\Debug\OpenRasta.DI.Unity\</OutputPath> 
    2120    <DefineConstants>DEBUG;TRACE</DefineConstants> 
    2221    <ErrorReport>prompt</ErrorReport> 
    2322    <WarningLevel>4</WarningLevel> 
    2423    <TreatWarningsAsErrors>true</TreatWarningsAsErrors> 
    25     <DocumentationFile> 
    26     </DocumentationFile> 
    2724  </PropertyGroup> 
    2825  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 
    2926    <DebugType>pdbonly</DebugType> 
    3027    <Optimize>true</Optimize> 
    31     <OutputPath>bin\Release\</OutputPath> 
    3228    <DefineConstants>TRACE</DefineConstants> 
    3329    <ErrorReport>prompt</ErrorReport> 
     
    4339      <HintPath>..\..\..\lib\unity-1.2\Microsoft.Practices.Unity.dll</HintPath> 
    4440    </Reference> 
    45     <Reference Include="OpenRasta, Version=2.0.3.0, Culture=neutral, PublicKeyToken=e04bf464d7caae73, processorArchitecture=MSIL"> 
    46       <SpecificVersion>False</SpecificVersion> 
    47       <HintPath>..\..\..\bin\Release\net-35\OpenRasta.dll</HintPath> 
    48     </Reference> 
    4941    <Reference Include="System" /> 
    50     <Reference Include="System.Core"> 
    51       <RequiredTargetFramework>3.5</RequiredTargetFramework> 
    52     </Reference> 
    53     <Reference Include="System.Xml.Linq"> 
    54       <RequiredTargetFramework>3.5</RequiredTargetFramework> 
    55     </Reference> 
    56     <Reference Include="System.Data.DataSetExtensions"> 
    57       <RequiredTargetFramework>3.5</RequiredTargetFramework> 
    58     </Reference> 
    5942    <Reference Include="System.Data" /> 
    6043    <Reference Include="System.Xml" /> 
    6144  </ItemGroup> 
    6245  <ItemGroup> 
     46    <Compile Include="..\..\CommonInfo.cs"> 
     47      <Link>CommonInfo.cs</Link> 
     48    </Compile> 
    6349    <Compile Include="Extensions\Policies\CycleDetectionPolicy.cs" /> 
    6450    <Compile Include="Extensions\Policies\TypeToBeResolved.cs" /> 
     
    7763    <Compile Include="UnityDependencyResolver.cs" /> 
    7864  </ItemGroup> 
     65 
     66  <ItemGroup> 
     67    <None Include="dependencies.targets" /> 
     68  </ItemGroup> 
     69  <Import Project="dependencies.targets" /> 
    7970  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 
    8071  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.  
  • trunk/src/unity/OpenRasta.DI.Unity/PerRequestLifetimeManager.cs

    r387 r427  
    77    /// <summary> 
    88    /// This, combined with the context container management in <see cref="UnityDependencyResolver"/>, 
    9     /// implements OpenRastas per request lifetime requirements.  One instance of this class is used 
     9    /// implements OpenRasta per request lifetime requirements.  One instance of this class is used 
    1010    /// per registered type. 
    1111    /// </summary> 
    12     class PerRequestLifetimeManager : LifetimeManager 
     12    internal class PerRequestLifetimeManager : LifetimeManager 
    1313    { 
    14         readonly IDependencyResolver resolver; 
    15         readonly string key = Guid.NewGuid().ToString(); 
     14        readonly string _key = Guid.NewGuid().ToString(); 
     15        readonly IDependencyResolver _resolver; 
     16 
     17        public PerRequestLifetimeManager(IDependencyResolver resolver) 
     18        { 
     19            _resolver = resolver; 
     20        } 
    1621 
    1722        IContextStore ContextStore 
    1823        { 
    19             get { return resolver.Resolve<IContextStore>(); } 
    20         } 
    21  
    22         public PerRequestLifetimeManager(IDependencyResolver resolver) 
    23         { 
    24             this.resolver = resolver; 
     24            get { return _resolver.Resolve<IContextStore>(); } 
    2525        } 
    2626 
     
    3030        public override object GetValue() 
    3131        { 
    32             if(!resolver.HasDependency<IContextStore>()) 
     32            if (!_resolver.HasDependency<IContextStore>()) 
    3333                throw new DependencyResolutionException("Context store not initialised."); 
    3434 
    35             return ContextStore[key]; 
     35            return ContextStore[_key]; 
     36        } 
     37 
     38        public override void RemoveValue() 
     39        { 
     40            // Strangely required, but not used by Unity, go Microsoft! 
     41            throw new NotSupportedException(); 
    3642        } 
    3743 
     
    4147        public override void SetValue(object newValue) 
    4248        { 
    43             ContextStore[key] = newValue; 
    44         } 
    45  
    46         public override void RemoveValue() 
    47         { 
    48             // Strangely required, but not used by Unity, go Microsoft! 
    49             throw new NotSupportedException(); 
     49            ContextStore[_key] = newValue; 
    5050        } 
    5151    } 
  • trunk/src/unity/OpenRasta.DI.Unity/Properties/AssemblyInfo.cs

    r387 r427  
    11using System.Reflection; 
    2 using System.Runtime.CompilerServices; 
    32using System.Runtime.InteropServices; 
    43 
     
    65// set of attributes. Change these attribute values to modify the information 
    76// associated with an assembly. 
    8 [assembly: AssemblyTitle("OpenRasta.DI.Unity")] 
    9 [assembly: AssemblyDescription("")] 
     7[assembly: AssemblyTitle("OpenRasta Unity IoC support")] 
     8[assembly: AssemblyDescription("Provides support for using the Unity IoC container.")] 
    109[assembly: AssemblyConfiguration("")] 
    11 [assembly: AssemblyCompany("Microsoft")] 
    12 [assembly: AssemblyProduct("OpenRasta.DI.Unity")] 
    13 [assembly: AssemblyCopyright("Copyright © Microsoft 2009")] 
    14 [assembly: AssemblyTrademark("")] 
    1510[assembly: AssemblyCulture("")] 
    16  
    17 // Setting ComVisible to false makes the types in this assembly not visible  
    18 // to COM components.  If you need to access a type in this assembly from  
    19 // COM, set the ComVisible attribute to true on that type. 
    20 [assembly: ComVisible(false)] 
    21  
    22 // The following GUID is for the ID of the typelib if this project is exposed to COM 
    2311[assembly: Guid("f6ef8ad1-3817-4c14-aaca-3840667c4194")] 
    24  
    25 // Version information for an assembly consists of the following four values: 
    26 // 
    27 //      Major Version 
    28 //      Minor Version  
    29 //      Build Number 
    30 //      Revision 
    31 // 
    32 // You can specify all the values or you can default the Build and Revision Numbers  
    33 // by using the '*' as shown below: 
    34 // [assembly: AssemblyVersion("1.0.*")] 
    35 [assembly: AssemblyVersion("1.0.0.0")] 
    36 [assembly: AssemblyFileVersion("1.0.0.0")] 
  • trunk/src/unity/OpenRasta.DI.Unity/UnityContainerExtensions.cs

    r387 r427  
    44namespace OpenRasta.DI.Unity 
    55{ 
    6     static class UnityContainerExtensions 
     6    internal static class UnityContainerExtensions 
    77    { 
    88        /// <summary> 
  • trunk/src/unity/OpenRasta.DI.Unity/UnityDependencyResolver.cs

    r387 r427  
    44using OpenRasta.DI.Unity.Extensions; 
    55using OpenRasta.Pipeline; 
    6 using System.Diagnostics; 
    76 
    87namespace OpenRasta.DI.Unity 
     
    2625    public class UnityDependencyResolver : DependencyResolverCore, IDependencyResolver 
    2726    { 
    28         const string ContextKey = "OpenRasta.DI.Unity.UnityDependencyResolver.ContextKey"; 
     27        const string CONTEXT_KEY = "OpenRasta.DI.Unity.UnityDependencyResolver.CONTEXT_KEY"; 
    2928 
    3029        /// <summary> 
     
    3231        /// go per request but this is the one container we can rely on. 
    3332        /// </summary> 
    34         readonly IUnityContainer container; 
     33        readonly IUnityContainer _container; 
     34 
     35        /// <summary> 
     36        /// Creates a new instance with a new root container. 
     37        /// </summary> 
     38        public UnityDependencyResolver() 
     39        { 
     40            _container = CreateContainer(); 
     41        } 
     42 
     43        /// <summary> 
     44        /// Creates a new instance as a child of the given parent container. 
     45        /// </summary> 
     46        /// <remarks> 
     47        /// The parent container must have the <see cref="TypeTracker"/> extension installed. 
     48        /// </remarks> 
     49        public UnityDependencyResolver(IUnityContainer parent) 
     50        { 
     51            _container = CreateChildContainer(parent); 
     52        } 
    3553 
    3654        /// <summary> 
     
    4361        public IUnityContainer Container 
    4462        { 
    45             get { return container; } 
    46         } 
    47  
    48         /// <summary> 
    49         /// Creates a new instance with a new root container. 
    50         /// </summary> 
    51         public UnityDependencyResolver() 
    52         { 
    53             container = CreateContainer(); 
    54         } 
    55  
    56         /// <summary> 
    57         /// Creates a new instance as a child of the given parent container. 
    58         /// </summary> 
    59         /// <remarks> 
    60         /// The parent container must have the <see cref="TypeTracker"/> extension installed. 
    61         /// </remarks> 
    62         public UnityDependencyResolver(IUnityContainer parent) 
    63         { 
    64             container = CreateChildContainer(parent); 
     63            get { return _container; } 
     64        } 
     65 
     66        public void HandleIncomingRequestProcessed() 
     67        { 
     68            if (!_container.TypeTracker().HasDependency(typeof(IContextStore))) 
     69                return; 
     70 
     71            // If we have a per request container, dispose and remove it 
     72            var context = _container.Resolve<IContextStore>(); 
     73            var current = (IUnityContainer)context[CONTEXT_KEY]; 
     74 
     75            if (current == null) 
     76                return; 
     77 
     78            current.Dispose(); 
     79            context[CONTEXT_KEY] = null; 
     80        } 
     81 
     82        public bool HasDependency(Type serviceType) 
     83        { 
     84            if (serviceType == null) 
     85                return false; 
     86 
     87            return OptionalContextContainer() 
     88                .TypeTracker() 
     89                .HasDependency(serviceType); 
     90        } 
     91 
     92        public bool HasDependencyImplementation(Type serviceType, Type concreteType) 
     93        { 
     94            if (serviceType == null) 
     95                throw new ArgumentNullException("serviceType"); 
     96 
     97            if (concreteType == null) 
     98                throw new ArgumentNullException("concreteType"); 
     99 
     100            return OptionalContextContainer() 
     101                .TypeTracker() 
     102                .HasDependencyImplementation(serviceType, concreteType); 
     103        } 
     104 
     105        protected override void AddDependencyCore(Type serviceType, Type concreteType, DependencyLifetime lifetime) 
     106        { 
     107            if (lifetime == DependencyLifetime.Transient) 
     108            { 
     109                // Unity registers types as transient by default. 
     110                _container.RegisterType(serviceType, concreteType); 
     111            } 
     112            else if (lifetime == DependencyLifetime.Singleton) 
     113            { 
     114                _container.RegisterType(serviceType, concreteType, new ContainerControlledLifetimeManager()); 
     115            } 
     116            else if (lifetime == DependencyLifetime.PerRequest) 
     117            { 
     118                OptionalContextContainer().RegisterType(serviceType, concreteType, new PerRequestLifetimeManager(this)); 
     119            } 
     120            else 
     121            { 
     122                throw new NotSupportedException("lifetime"); 
     123            } 
     124        } 
     125 
     126        protected override void AddDependencyCore(Type concreteType, DependencyLifetime lifetime) 
     127        { 
     128            AddDependencyCore(concreteType, concreteType, lifetime); 
     129        } 
     130 
     131        protected override void AddDependencyInstanceCore(Type serviceType, object instance, DependencyLifetime lifetime) 
     132        { 
     133            if (lifetime == DependencyLifetime.Singleton) 
     134            { 
     135                // Unity registers instances as singletons by default 
     136                _container.RegisterInstance(serviceType, instance); 
     137            } 
     138            else if (lifetime == DependencyLifetime.PerRequest) 
     139            { 
     140                RequiredContextContainer().RegisterInstance(serviceType, instance, new PerRequestLifetimeManager(this)); 
     141            } 
     142            else 
     143            { 
     144                throw new NotSupportedException("lifetime"); 
     145            } 
     146        } 
     147 
     148        protected override IEnumerable<TService> ResolveAllCore<TService>() 
     149        { 
     150            var types = OptionalContextContainer() 
     151                .TypeTracker() 
     152                .GetAllConcreteTypes(typeof(TService)); 
     153 
     154            var current = OptionalContextContainer(); 
     155            var services = new List<TService>(); 
     156 
     157            foreach (var type in types) 
     158            { 
     159                services.Add((TService)current.Resolve(type)); 
     160            } 
     161 
     162            return services; 
     163        } 
     164 
     165        protected override object ResolveCore(Type serviceType) 
     166        { 
     167            return OptionalContextContainer().Resolve(serviceType); 
     168        } 
     169 
     170        static IUnityContainer CreateChildContainer(IUnityContainer parent) 
     171        { 
     172            if (parent == null) 
     173                throw new ArgumentNullException("parent"); 
     174 
     175            if (parent.TypeTracker() == null) 
     176                throw new ArgumentException("Parent container does not have the TypeTracker extension installed."); 
     177 
     178            var child = parent.CreateChildContainer(); 
     179            Extend(child); 
     180            return child; 
    65181        } 
    66182 
     
    70186            Extend(container); 
    71187            return container; 
    72         } 
    73  
    74         static IUnityContainer CreateChildContainer(IUnityContainer parent) 
    75         { 
    76             if (parent == null) 
    77                 throw new ArgumentNullException("parent"); 
    78  
    79             if (parent.TypeTracker() == null) 
    80                 throw new ArgumentException("Parent container does not have the TypeTracker extension installed."); 
    81  
    82             var child = parent.CreateChildContainer(); 
    83             Extend(child); 
    84             return child; 
    85188        } 
    86189 
     
    93196        } 
    94197 
    95         public bool HasDependency(Type serviceType) 
    96         { 
    97             if (serviceType == null) 
    98                 return false; 
    99  
    100             return OptionalContextContainer() 
    101                 .TypeTracker() 
    102                 .HasDependency(serviceType); 
    103         } 
    104  
    105         public bool HasDependencyImplementation(Type serviceType, Type concreteType) 
    106         { 
    107             if (serviceType == null) 
    108                 throw new ArgumentNullException("serviceType"); 
    109  
    110             if (concreteType == null) 
    111                 throw new ArgumentNullException("concreteType"); 
    112  
    113             return OptionalContextContainer() 
    114                 .TypeTracker() 
    115                 .HasDependencyImplementation(serviceType, concreteType); 
    116         } 
    117  
    118         public void HandleIncomingRequestProcessed() 
    119         { 
    120             if (!container.TypeTracker().HasDependency(typeof(IContextStore))) 
    121                 return; 
    122  
    123             // If we have a per request container, dispose and remove it 
    124             var context = container.Resolve<IContextStore>(); 
    125             var current = (IUnityContainer)context[ContextKey]; 
    126  
    127             if(current == null) 
    128                 return; 
    129  
    130             current.Dispose(); 
    131             context[ContextKey] = null; 
    132         } 
    133  
    134         protected override void AddDependencyCore(Type serviceType, Type concreteType, DependencyLifetime lifetime) 
    135         { 
    136             if (lifetime == DependencyLifetime.Transient) 
    137             { 
    138                 // Unity registers types as transient by default. 
    139                 container.RegisterType(serviceType, concreteType); 
    140             } 
    141             else if (lifetime == DependencyLifetime.Singleton) 
    142             { 
    143                 container.RegisterType(serviceType, concreteType, new ContainerControlledLifetimeManager()); 
    144             } 
    145             else if (lifetime == DependencyLifetime.PerRequest) 
    146             { 
    147                 OptionalContextContainer().RegisterType(serviceType, concreteType, new PerRequestLifetimeManager(this)); 
    148             } 
    149             else 
    150             { 
    151                 throw new NotSupportedException("lifetime"); 
    152             } 
    153         } 
    154  
    155         protected override void AddDependencyCore(Type concreteType, DependencyLifetime lifetime) 
    156         { 
    157             AddDependencyCore(concreteType, concreteType, lifetime); 
    158         } 
    159  
    160         protected override void AddDependencyInstanceCore(Type serviceType, object instance, DependencyLifetime lifetime) 
    161         { 
    162             if (lifetime == DependencyLifetime.Singleton) 
    163             { 
    164                 // Unity registers instances as singletons by default 
    165                 container.RegisterInstance(serviceType, instance); 
    166             } 
    167             else if (lifetime == DependencyLifetime.PerRequest) 
    168             { 
    169                 RequiredContextContainer().RegisterInstance(serviceType, instance, new PerRequestLifetimeManager(this)); 
    170             } 
    171             else 
    172             { 
    173                 throw new NotSupportedException("lifetime"); 
    174             } 
    175         } 
    176  
    177         /// <summary> 
    178         /// Ensures that there is a child container for the current request and returns it. 
    179         /// </summary> 
    180         IUnityContainer RequiredContextContainer() 
    181         { 
    182             if (!container.TypeTracker().HasDependency(typeof(IContextStore))) 
    183                 throw new InvalidOperationException("There is no current per request context to register in."); 
    184  
    185             var context = container.Resolve<IContextStore>(); 
    186             var current = (IUnityContainer)context[ContextKey]; 
    187  
    188             if (current == null) 
    189             { 
    190                 current = CreateChildContainer(container); 
    191                 context[ContextKey] = current; 
    192             } 
    193  
    194             return current; 
    195         } 
    196  
    197198        /// <summary> 
    198199        /// Returns the child container for this request if there is one, otherwise returns the 
     
    201202        IUnityContainer OptionalContextContainer() 
    202203        { 
    203             if (!container.TypeTracker().HasDependency(typeof(IContextStore))) 
    204                 return container; 
    205  
    206             var context = container.Resolve<IContextStore>(); 
    207             var current = (IUnityContainer)context[ContextKey]; 
    208  
    209             return current ?? container; 
    210         } 
    211  
    212         protected override IEnumerable<TService> ResolveAllCore<TService>() 
    213         { 
    214             var types = OptionalContextContainer() 
    215                 .TypeTracker() 
    216                 .GetAllConcreteTypes(typeof (TService)); 
    217  
    218             var current = OptionalContextContainer(); 
    219             var services = new List<TService>(); 
    220  
    221             foreach (var type in types) 
    222             { 
    223                 services.Add((TService)current.Resolve(type)); 
    224             } 
    225  
    226             return services; 
    227         } 
    228  
    229         protected override object ResolveCore(Type serviceType) 
    230         { 
    231             return OptionalContextContainer().Resolve(serviceType); 
     204            if (!_container.TypeTracker().HasDependency(typeof(IContextStore))) 
     205                return _container; 
     206 
     207            var context = _container.Resolve<IContextStore>(); 
     208            var current = (IUnityContainer)context[CONTEXT_KEY]; 
     209 
     210            return current ?? _container; 
     211        } 
     212 
     213        /// <summary> 
     214        /// Ensures that there is a child container for the current request and returns it. 
     215        /// </summary> 
     216        IUnityContainer RequiredContextContainer() 
     217        { 
     218            if (!_container.TypeTracker().HasDependency(typeof(IContextStore))) 
     219                throw new InvalidOperationException("There is no current per request context to register in."); 
     220 
     221            var context = _container.Resolve<IContextStore>(); 
     222            var current = (IUnityContainer)context[CONTEXT_KEY]; 
     223 
     224            if (current == null) 
     225            { 
     226                current = CreateChildContainer(_container); 
     227                context[CONTEXT_KEY] = current; 
     228            } 
     229 
     230            return current; 
    232231        } 
    233232    }