Changeset 4698

Show
Ignore:
Timestamp:
06/12/08 09:55:53 (6 months ago)
Author:
xmlhacker
Message:

a bunch of additional changes which enable proper error handling of async web calls as well as the addition of the Scope functionality which is really phreaking cool... more on that in subsequent check-ins

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/nuxleus/Source/Dependencies/Scope/Scope/Scope.csproj

    r4696 r4698  
    44    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 
    55    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 
    6     <ProductVersion>9.0.21022</ProductVersion> 
     6    <ProductVersion>9.0.30428</ProductVersion> 
    77    <SchemaVersion>2.0</SchemaVersion> 
    88    <ProjectGuid>{4A22EAF7-9A35-4F0E-A1CC-3D8A2DDB6830}</ProjectGuid> 
     
    5050    <Compile Include="Scope.cs" /> 
    5151  </ItemGroup> 
     52  <ItemGroup> 
     53    <ProjectReference Include="..\..\..\Nuxleus.Extension.Linq\Nuxleus.Extension.Linq.csproj"> 
     54      <Project>{D937BA9E-1E6C-4757-98CC-7D932F4697B0}</Project> 
     55      <Name>Nuxleus.Extension.Linq</Name> 
     56    </ProjectReference> 
     57  </ItemGroup> 
    5258  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 
    5359  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.  
  • trunk/nuxleus/Source/Nuxleus.Extension.Aws/SimpleDB/SimpleDBService.cs

    r4695 r4698  
    172172                    Console.WriteLine("[] got response on thread: {0}", Thread.CurrentThread.ManagedThreadId); 
    173173                    Stream stream = response.Result.GetResponseStream(); 
    174                     Async<T> responseObject = stream.ReadToEndAsync(typeof(T)).ExecuteAsync<T>(); 
     174                    Async<T> responseObject = stream.ReadToEndAsync<T>().ExecuteAsync<T>(); 
    175175                    yield return responseObject; 
    176176                    responseList.Add(responseObject.Result); 
  • trunk/nuxleus/Source/Nuxleus.Extension.Linq/Async.cs

    r4695 r4698  
    5757        /// </summary> 
    5858        public static Async<WebResponse> GetResponseAsync(this WebRequest req) { 
    59             return new AsyncPrimitive<WebResponse>(req.BeginGetResponse, req.EndGetResponse); 
     59            return new AsyncPrimitive<WebResponse>(req.BeginGetResponse, req.EndGetResponse, HandleWebException); 
    6060        } 
    6161 
     
    8080        /// <returns>Returns string using the 'Result' class.</returns> 
    8181        public static IEnumerable<IAsync> ReadToEndAsync(this Stream stream) { 
    82             return stream.ReadToEndAsync(typeof(String)); 
     82            return stream.ReadToEndAsync<String>(); 
    8383        } 
    8484 
     
    8888        /// </summary> 
    8989        /// <param name="returnType">Specifies the desired return type.  The default is System.String.</param> 
    90         public static IEnumerable<IAsync> ReadToEndAsync(this Stream stream, Type returnType) { 
     90        public static IEnumerable<IAsync> ReadToEndAsync<T>(this Stream stream) { 
    9191            MemoryStream ms = new MemoryStream(); 
    9292            int read = -1; 
     
    102102 
    103103            ms.Seek(0, SeekOrigin.Begin); 
    104  
    105             switch (returnType.FullName) { 
     104             
     105            switch (typeof(T).FullName) { 
    106106                case "System.Xml.XmlReader": 
    107107                    yield return new Result<XmlReader>(XmlReader.Create(ms)); 
     
    125125                    break; 
    126126            } 
     127        } 
     128 
     129        public static WebResponse HandleWebException(Exception ex) { 
     130            return ((WebException)ex).Response; 
    127131        } 
    128132 
     
    271275        } 
    272276 
     277        public AsyncPrimitive(Func<AsyncCallback, object, IAsyncResult> begin, Func<IAsyncResult, T> end, Func<Exception, T> we) { 
     278            this.func = (cont) => 
     279                begin(delegate(IAsyncResult res) { 
     280                    try { 
     281                        cont(end(res)); 
     282                    } catch (Exception e) { 
     283                        cont(we(e)); 
     284                    } 
     285                }, null); 
     286        } 
     287 
    273288        public override void ExecuteStep(Action cont) { 
    274289            func((res) => { 
  • trunk/nuxleus/Source/nuXleus.sln

    r4693 r4698  
    127127EndProject 
    128128Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AwsSdbSOAP_Test", "CodeSamples\AwsSdbSOAP_Test\AwsSdbSOAP_Test.csproj", "{A1DF0E96-5699-4219-80B9-CE6EDE8599EC}" 
     129EndProject 
     130Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scope", "Dependencies\Scope\Scope\Scope.csproj", "{4A22EAF7-9A35-4F0E-A1CC-3D8A2DDB6830}" 
     131EndProject 
     132Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScopeTest", "Dependencies\Scope\ScopeTest\ScopeTest.csproj", "{A1C69CA6-2CBF-4B80-9FAC-78AFB6523B22}" 
    129133EndProject 
    130134Global 
     
    10281032                {A1DF0E96-5699-4219-80B9-CE6EDE8599EC}.Release|x64.ActiveCfg = Release|Any CPU 
    10291033                {A1DF0E96-5699-4219-80B9-CE6EDE8599EC}.Release|x86.ActiveCfg = Release|Any CPU 
     1034                {4A22EAF7-9A35-4F0E-A1CC-3D8A2DDB6830}.Debug|.NET.ActiveCfg = Debug|Any CPU 
     1035                {4A22EAF7-9A35-4F0E-A1CC-3D8A2DDB6830}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 
     1036                {4A22EAF7-9A35-4F0E-A1CC-3D8A2DDB6830}.Debug|Any CPU.Build.0 = Debug|Any CPU 
     1037                {4A22EAF7-9A35-4F0E-A1CC-3D8A2DDB6830}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 
     1038                {4A22EAF7-9A35-4F0E-A1CC-3D8A2DDB6830}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 
     1039                {4A22EAF7-9A35-4F0E-A1CC-3D8A2DDB6830}.Debug|x64.ActiveCfg = Debug|Any CPU 
     1040                {4A22EAF7-9A35-4F0E-A1CC-3D8A2DDB6830}.Debug|x86.ActiveCfg = Debug|Any CPU 
     1041                {4A22EAF7-9A35-4F0E-A1CC-3D8A2DDB6830}.Release|.NET.ActiveCfg = Release|Any CPU 
     1042                {4A22EAF7-9A35-4F0E-A1CC-3D8A2DDB6830}.Release|Any CPU.ActiveCfg = Release|Any CPU 
     1043                {4A22EAF7-9A35-4F0E-A1CC-3D8A2DDB6830}.Release|Any CPU.Build.0 = Release|Any CPU 
     1044                {4A22EAF7-9A35-4F0E-A1CC-3D8A2DDB6830}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 
     1045                {4A22EAF7-9A35-4F0E-A1CC-3D8A2DDB6830}.Release|Mixed Platforms.Build.0 = Release|Any CPU 
     1046                {4A22EAF7-9A35-4F0E-A1CC-3D8A2DDB6830}.Release|x64.ActiveCfg = Release|Any CPU 
     1047                {4A22EAF7-9A35-4F0E-A1CC-3D8A2DDB6830}.Release|x86.ActiveCfg = Release|Any CPU 
     1048                {A1C69CA6-2CBF-4B80-9FAC-78AFB6523B22}.Debug|.NET.ActiveCfg = Debug|Any CPU 
     1049                {A1C69CA6-2CBF-4B80-9FAC-78AFB6523B22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 
     1050                {A1C69CA6-2CBF-4B80-9FAC-78AFB6523B22}.Debug|Any CPU.Build.0 = Debug|Any CPU 
     1051                {A1C69CA6-2CBF-4B80-9FAC-78AFB6523B22}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 
     1052                {A1C69CA6-2CBF-4B80-9FAC-78AFB6523B22}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 
     1053                {A1C69CA6-2CBF-4B80-9FAC-78AFB6523B22}.Debug|x64.ActiveCfg = Debug|Any CPU 
     1054                {A1C69CA6-2CBF-4B80-9FAC-78AFB6523B22}.Debug|x86.ActiveCfg = Debug|Any CPU 
     1055                {A1C69CA6-2CBF-4B80-9FAC-78AFB6523B22}.Release|.NET.ActiveCfg = Release|Any CPU 
     1056                {A1C69CA6-2CBF-4B80-9FAC-78AFB6523B22}.Release|Any CPU.ActiveCfg = Release|Any CPU 
     1057                {A1C69CA6-2CBF-4B80-9FAC-78AFB6523B22}.Release|Any CPU.Build.0 = Release|Any CPU 
     1058                {A1C69CA6-2CBF-4B80-9FAC-78AFB6523B22}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 
     1059                {A1C69CA6-2CBF-4B80-9FAC-78AFB6523B22}.Release|Mixed Platforms.Build.0 = Release|Any CPU 
     1060                {A1C69CA6-2CBF-4B80-9FAC-78AFB6523B22}.Release|x64.ActiveCfg = Release|Any CPU 
     1061                {A1C69CA6-2CBF-4B80-9FAC-78AFB6523B22}.Release|x86.ActiveCfg = Release|Any CPU 
    10301062        EndGlobalSection 
    10311063        GlobalSection(SolutionProperties) = preSolution 
  • trunk/nuxleus/Source/nux.build

    r4695 r4698  
    308308    </csc> 
    309309  </target> 
    310   <target name="Nuxleus.Extension.Aws" depends="init Nuxleus.Extension Nuxleus.Extension.Linq Nuxleus.MetaData"> 
     310  <target name="Nuxleus.Extension.Aws" depends="init Nuxleus.Extension Nuxleus.Extension.Linq Nuxleus.MetaData Scope"> 
    311311    <csc target="library" output="${build.dir}/Nuxleus.Extension.Aws.dll" keyfile="./Dependencies/Extf.Net.snk"> 
    312312      <arg if="${platform::is-unix()}" value="-langversion:linq"/> 
     
    318318        <include name="${build.dir}/Nuxleus.Extension.Linq.dll"/> 
    319319        <include name="${build.dir}/Nuxleus.MetaData.dll"/> 
     320        <include name="${build.dir}/Scope.dll"/> 
    320321        <include name="System.dll"/> 
    321322        <include name="System.Collections.dll"/> 
     
    660661    </csc> 
    661662  </target> 
     663  <target name="Scope" depends="init"> 
     664    <csc target="library" output="${build.dir}/Scope.dll" keyfile="./Dependencies/Extf.Net.snk"> 
     665      <arg if="${platform::is-unix()}" value="-langversion:linq"/> 
     666      <sources> 
     667        <include name="./Dependencies/Scope/Scope/**/*.cs"/> 
     668      </sources> 
     669      <references> 
     670        <include name="System.dll"/> 
     671        <include name="System.Data.dll"/> 
     672        <include name="System.Xml.dll"/> 
     673      </references> 
     674    </csc> 
     675  </target> 
    662676  <target name="sdb-test" depends="init Nuxleus.Extension.Aws.Sdb"> 
    663677    <csc target="exe" output="${build.dir}/sdb-test.exe"> 
     
    887901    </csc> 
    888902  </target> 
    889   <target name="SdbSOAP_Test" depends="init Nuxleus.Extension.Aws"> 
     903  <target name="SdbSOAP_Test" depends="init Nuxleus.Extension.Aws Scope"> 
    890904    <csc target="exe" output="${build.dir}/Sdb_SOAP_Test.exe" keyfile="./Dependencies/Extf.Net.snk"> 
    891905      <arg if="${platform::is-unix()}" value="-langversion:linq"/> 
    892906      <sources> 
    893         <include name="${source.dir}/CodeSamples/AwsSdbSOAP_Test/Program.cs"/> 
     907        <include name="${source.dir}/CodeSamples/AwsSdbSOAP_Test/**/*.cs"/> 
    894908      </sources> 
    895909      <references> 
    896910        <include name="${build.dir}/Nuxleus.Extension.Aws.dll"/> 
    897911        <include name="${build.dir}/Nuxleus.Extension.Linq.dll"/> 
    898         <include name="System.dll"/> 
     912        <include name="${build.dir}/Scope.dll"/> 
     913        <include name="System.dll"/> 
     914        <include name="System.Configuration.dll"/> 
    899915        <include name="System.Xml.Linq.dll"/> 
    900916        <include name="System.Xml.dll"/> 
     
    903919      </references> 
    904920    </csc> 
     921    <copy file="CodeSamples/AwsSdbSOAP_Test/App.config" tofile="${build.dir}/Sdb_SOAP_Test.exe.config"/> 
    905922  </target> 
    906923<!--