├── .gitignore ├── Client1.Page ├── Client1.Page.csproj ├── Controllers │ └── TestController.cs ├── Properties │ └── AssemblyInfo.cs ├── UrlProviders │ ├── OverrideUrlProvider.cs │ └── ShowUrlProvider.cs ├── Views │ ├── Test │ │ ├── Index.cshtml │ │ └── Override.cshtml │ └── Web.config ├── Web.Debug.config ├── Web.Release.config ├── Web.config ├── bin │ ├── Client1.Page.dll.config │ ├── Newtonsoft.Json.xml │ ├── System.Net.Http.Formatting.xml │ ├── System.Web.Helpers.xml │ ├── System.Web.Http.WebHost.xml │ ├── System.Web.Http.xml │ ├── System.Web.Mvc.xml │ ├── System.Web.Razor.xml │ ├── System.Web.WebPages.Deployment.xml │ ├── System.Web.WebPages.Razor.xml │ └── System.Web.WebPages.xml ├── obj │ └── Debug │ │ ├── Client1.Page.csproj.FileListAbsolute.txt │ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs │ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs │ │ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs └── packages.config ├── Client2.Page ├── Client2.Page.csproj ├── Controllers │ └── TestController.cs ├── Properties │ └── AssemblyInfo.cs ├── Scripts │ └── test.js ├── UrlProviders │ └── ShowUrlProvider.cs ├── Views │ ├── Test │ │ └── Index.cshtml │ └── Web.config ├── Web.Debug.config ├── Web.Release.config ├── Web.config ├── bin │ ├── Client2.Page.dll.config │ ├── Newtonsoft.Json.xml │ ├── System.Net.Http.Formatting.xml │ ├── System.Web.Helpers.xml │ ├── System.Web.Http.WebHost.xml │ ├── System.Web.Http.xml │ ├── System.Web.Mvc.xml │ ├── System.Web.Razor.xml │ ├── System.Web.WebPages.Deployment.xml │ ├── System.Web.WebPages.Razor.xml │ └── System.Web.WebPages.xml ├── obj │ └── Debug │ │ ├── Client2.Page.csproj.FileListAbsolute.txt │ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs │ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs │ │ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs └── packages.config ├── README.md ├── SharedWebComponents.Contracts ├── IUrlProvider.cs ├── Properties │ └── AssemblyInfo.cs ├── SharedWebComponents.Contracts.csproj └── obj │ └── Debug │ ├── SharedWebComponents.Contracts.csproj.FileListAbsolute.txt │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs │ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs ├── SharedWebComponents ├── App_Start │ ├── FilterConfig.cs │ ├── RouteConfig.cs │ └── WebApiConfig.cs ├── Content │ └── test.css ├── Controllers │ └── HomeController.cs ├── Extensions │ ├── MimeTypeMap.cs │ ├── StreamExtensions.cs │ └── StringExtensions.cs ├── Global.asax ├── Global.asax.cs ├── Infrastructure │ ├── EmbeddedResource │ │ ├── EmbeddedResourceHttpHandler.cs │ │ ├── EmbeddedResourceNameResolver.cs │ │ ├── EmbeddedResourcePathInfo.cs │ │ ├── EmbeddedResourceRouteConfig.cs │ │ ├── EmbeddedResourceRouteHandler.cs │ │ ├── EmbeddedResourceVirtualFile.cs │ │ ├── EmbeddedResourceVirtualPathProvider.cs │ │ ├── UrlToAssemblyMapping.cs │ │ ├── VirtualFileRazorViewHelper.cs │ │ └── VirtualFileStreamFetcher.cs │ ├── Mef │ │ ├── MefAssemblyFetcher.cs │ │ ├── MefBootstrapper.cs │ │ ├── MefConfig.cs │ │ └── MefFallbackControllerFactory.cs │ ├── RuntimeDirectoryConstants.cs │ ├── SharedWebComponentsViewEngine.cs │ └── Utility │ │ └── UrlProviderFetcher.cs ├── Properties │ └── AssemblyInfo.cs ├── SharedWebComponents.csproj ├── Views │ ├── Home │ │ └── Override.cshtml │ ├── Shared │ │ └── _CustomLayout.cshtml │ ├── Web.config │ └── _ViewStart.cshtml ├── Web.Debug.config ├── Web.Release.config ├── Web.config ├── adjunct │ └── System │ │ ├── ComponentModel │ │ └── Composition │ │ │ ├── CatalogService.cs │ │ │ ├── ExportFactory.cs │ │ │ ├── ExportLifetimeContext.cs │ │ │ ├── ICatalogService.cs │ │ │ ├── IoC.cs │ │ │ ├── IoCDebugger.cs │ │ │ ├── XElementExportProvider.cs │ │ │ ├── XapCatalog.cs │ │ │ └── XapPackage.cs │ │ └── Threading │ │ └── Lock.cs ├── bin │ ├── Newtonsoft.Json.xml │ ├── SharedWebComponents.dll.config │ ├── System.Net.Http.Extensions.xml │ ├── System.Net.Http.Formatting.xml │ ├── System.Net.Http.Primitives.xml │ ├── System.Web.Helpers.xml │ ├── System.Web.Http.WebHost.xml │ ├── System.Web.Http.xml │ ├── System.Web.Mvc.xml │ ├── System.Web.Razor.xml │ ├── System.Web.WebPages.Deployment.xml │ ├── System.Web.WebPages.Razor.xml │ └── System.Web.WebPages.xml ├── obj │ └── Debug │ │ ├── SharedWebComponents.csproj.App.config │ │ ├── SharedWebComponents.csproj.FileListAbsolute.txt │ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs │ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs │ │ └── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs └── packages.config └── SharedWebComponentsMef.sln /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studo 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | *_i.c 42 | *_p.c 43 | *_i.h 44 | *.ilk 45 | *.meta 46 | *.obj 47 | *.pch 48 | *.pdb 49 | *.pgc 50 | *.pgd 51 | *.rsp 52 | *.sbr 53 | *.tlb 54 | *.tli 55 | *.tlh 56 | *.tmp 57 | *.tmp_proj 58 | *.log 59 | *.vspscc 60 | *.vssscc 61 | .builds 62 | *.pidb 63 | *.svclog 64 | *.scc 65 | 66 | # Chutzpah Test files 67 | _Chutzpah* 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | *.cachefile 76 | 77 | # Visual Studio profiler 78 | *.psess 79 | *.vsp 80 | *.vspx 81 | 82 | # TFS 2012 Local Workspace 83 | $tf/ 84 | 85 | # Guidance Automation Toolkit 86 | *.gpState 87 | 88 | # ReSharper is a .NET coding add-in 89 | _ReSharper*/ 90 | *.[Rr]e[Ss]harper 91 | *.DotSettings.user 92 | 93 | # JustCode is a .NET coding addin-in 94 | .JustCode 95 | 96 | # TeamCity is a build add-in 97 | _TeamCity* 98 | 99 | # DotCover is a Code Coverage Tool 100 | *.dotCover 101 | 102 | # NCrunch 103 | _NCrunch_* 104 | .*crunch*.local.xml 105 | 106 | # MightyMoose 107 | *.mm.* 108 | AutoTest.Net/ 109 | 110 | # Web workbench (sass) 111 | .sass-cache/ 112 | 113 | # Installshield output folder 114 | [Ee]xpress/ 115 | 116 | # DocProject is a documentation generator add-in 117 | DocProject/buildhelp/ 118 | DocProject/Help/*.HxT 119 | DocProject/Help/*.HxC 120 | DocProject/Help/*.hhc 121 | DocProject/Help/*.hhk 122 | DocProject/Help/*.hhp 123 | DocProject/Help/Html2 124 | DocProject/Help/html 125 | 126 | # Click-Once directory 127 | publish/ 128 | 129 | # Publish Web Output 130 | *.[Pp]ublish.xml 131 | *.azurePubxml 132 | # TODO: Comment the next line if you want to checkin your web deploy settings 133 | # but database connection strings (with potential passwords) will be unencrypted 134 | *.pubxml 135 | *.publishproj 136 | 137 | # NuGet Packages 138 | *.nupkg 139 | # The packages folder can be ignored because of Package Restore 140 | **/packages/* 141 | # except build/, which is used as an MSBuild target. 142 | !**/packages/build/ 143 | # Uncomment if necessary however generally it will be regenerated when needed 144 | #!**/packages/repositories.config 145 | 146 | # Windows Azure Build Output 147 | csx/ 148 | *.build.csdef 149 | 150 | # Windows Store app package directory 151 | AppPackages/ 152 | 153 | # Others 154 | *.[Cc]ache 155 | ClientBin/ 156 | [Ss]tyle[Cc]op.* 157 | ~$* 158 | *~ 159 | *.dbmdl 160 | *.dbproj.schemaview 161 | *.pfx 162 | *.publishsettings 163 | node_modules/ 164 | bower_components/ 165 | 166 | # RIA/Silverlight projects 167 | Generated_Code/ 168 | 169 | # Backup & report files from converting an old project file 170 | # to a newer Visual Studio version. Backup files are not needed, 171 | # because we have git ;-) 172 | _UpgradeReport_Files/ 173 | Backup*/ 174 | UpgradeLog*.XML 175 | UpgradeLog*.htm 176 | 177 | # SQL Server files 178 | *.mdf 179 | *.ldf 180 | 181 | # Business Intelligence projects 182 | *.rdl.data 183 | *.bim.layout 184 | *.bim_*.settings 185 | 186 | # Microsoft Fakes 187 | FakesAssemblies/ 188 | 189 | # Node.js Tools for Visual Studio 190 | .ntvs_analysis.dat 191 | 192 | # Visual Studio 6 build log 193 | *.plg 194 | 195 | # Visual Studio 6 workspace options file 196 | *.opt -------------------------------------------------------------------------------- /Client1.Page/Client1.Page.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | 8 | 9 | 2.0 10 | {95E69488-23AB-4A0C-BBD8-62FD784B63E3} 11 | {E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} 12 | Library 13 | Properties 14 | Client1.Page 15 | Client1.Page 16 | v4.5 17 | false 18 | true 19 | 20 | 21 | 22 | 23 | ..\packages\WebGrease.1.5.2\lib 24 | 25 | 26 | true 27 | full 28 | false 29 | bin\ 30 | DEBUG;TRACE 31 | prompt 32 | 4 33 | 34 | 35 | pdbonly 36 | true 37 | bin\ 38 | TRACE 39 | prompt 40 | 4 41 | 42 | 43 | 44 | ..\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll 45 | 46 | 47 | 48 | ..\packages\Newtonsoft.Json.5.0.4\lib\net45\Newtonsoft.Json.dll 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | ..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | True 73 | ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll 74 | 75 | 76 | True 77 | ..\packages\Microsoft.AspNet.Mvc.FixedDisplayModes.1.0.0\lib\net40\Microsoft.Web.Mvc.FixedDisplayModes.dll 78 | 79 | 80 | 81 | 82 | ..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll 83 | 84 | 85 | 86 | 87 | True 88 | ..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.Helpers.dll 89 | 90 | 91 | ..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll 92 | 93 | 94 | ..\packages\Microsoft.AspNet.WebApi.WebHost.4.0.30506.0\lib\net40\System.Web.Http.WebHost.dll 95 | 96 | 97 | True 98 | ..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll 99 | 100 | 101 | True 102 | ..\packages\Microsoft.AspNet.Razor.2.0.30506.0\lib\net40\System.Web.Razor.dll 103 | 104 | 105 | True 106 | ..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.dll 107 | 108 | 109 | True 110 | ..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.Deployment.dll 111 | 112 | 113 | True 114 | ..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.Razor.dll 115 | 116 | 117 | ..\packages\WebGrease.1.5.2\lib\WebGrease.dll 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | Web.config 130 | 131 | 132 | Web.config 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | {996766EC-10A6-4E2D-A020-216EE1E7AAD7} 146 | SharedWebComponents.Contracts 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 10.0 157 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | True 200 | True 201 | 52517 202 | / 203 | http://localhost:52517/ 204 | False 205 | False 206 | 207 | 208 | False 209 | 210 | 211 | 212 | 213 | 214 | xcopy "$(ProjectDir)bin\Client1.Page.dll" "$(SolutionDir)SharedWebComponents\Plugins\" /Y /I /R 215 | 216 | 222 | -------------------------------------------------------------------------------- /Client1.Page/Controllers/TestController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | 3 | namespace Client1.Page.Controllers { 4 | public class TestController : Controller { 5 | public ActionResult Index() { 6 | return View(); 7 | } 8 | 9 | public ActionResult Override() { 10 | return View(); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /Client1.Page/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Client1.Page")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Client1.Page")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [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 23 | [assembly: Guid("20ad7032-0942-451d-bec5-75e8dc0214ac")] 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 Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Client1.Page/UrlProviders/OverrideUrlProvider.cs: -------------------------------------------------------------------------------- 1 | using SharedWebComponents.Contracts; 2 | 3 | namespace Client1.Page.UrlProviders { 4 | public class OverrideUrlProvider : IUrlProvider { 5 | public string GetUrl() { 6 | return "/Client1/Test/Override"; 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /Client1.Page/UrlProviders/ShowUrlProvider.cs: -------------------------------------------------------------------------------- 1 | using SharedWebComponents.Contracts; 2 | 3 | namespace Client1.Page.UrlProviders { 4 | public class ShowUrlProvider : IUrlProvider { 5 | public string GetUrl() { 6 | return "/Client1/Test/"; 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /Client1.Page/Views/Test/Index.cshtml: -------------------------------------------------------------------------------- 1 | From Client 1 -------------------------------------------------------------------------------- /Client1.Page/Views/Test/Override.cshtml: -------------------------------------------------------------------------------- 1 | I'm an override view from Client 1 -------------------------------------------------------------------------------- /Client1.Page/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 39 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Client1.Page/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /Client1.Page/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /Client1.Page/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Client1.Page/bin/Client1.Page.dll.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Client1.Page/bin/System.Web.Http.WebHost.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | System.Web.Http.WebHost 5 | 6 | 7 | 8 | Provides a global for ASP.NET applications. 9 | 10 | 11 | 12 | Gets the default message handler that will be called for all requests. 13 | 14 | 15 | Extension methods for 16 | 17 | 18 | Maps the specified route template. 19 | A reference to the mapped route. 20 | A collection of routes for the application. 21 | The name of the route to map. 22 | The route template for the route. 23 | 24 | 25 | Maps the specified route template and sets default route. 26 | A reference to the mapped route. 27 | A collection of routes for the application. 28 | The name of the route to map. 29 | The route template for the route. 30 | An object that contains default route values. 31 | 32 | 33 | Maps the specified route template and sets default route values and constraints. 34 | A reference to the mapped route. 35 | A collection of routes for the application. 36 | The name of the route to map. 37 | The route template for the route. 38 | An object that contains default route values. 39 | A set of expressions that specify values for routeTemplate. 40 | 41 | 42 | Maps the specified route template and sets default route values, constraints, and end-point message handler. 43 | A reference to the mapped route. 44 | A collection of routes for the application. 45 | The name of the route to map. 46 | The route template for the route. 47 | An object that contains default route values. 48 | A set of expressions that specify values for routeTemplate. 49 | The handler to which the request will be dispatched. 50 | 51 | 52 | A that passes ASP.NET requests into the pipeline and write the result back. 53 | 54 | 55 | Initializes a new instance of the class. 56 | The route data. 57 | 58 | 59 | Begins the process request. 60 | An that contains information about the status of the process. 61 | The HTTP context base. 62 | The callback. 63 | The state. 64 | 65 | 66 | Provides an asynchronous process End method when the process ends. 67 | An that contains information about the status of the process. 68 | 69 | 70 | Gets a value indicating whether another request can use the instance. 71 | 72 | 73 | Processes the request. 74 | The HTTP context base. 75 | 76 | 77 | Begins processing the request. 78 | An that contains information about the status of the process. 79 | The HTTP context. 80 | The callback. 81 | The state. 82 | 83 | 84 | Provides an asynchronous process End method when the process ends. 85 | An that contains information about the status of the process. 86 | 87 | 88 | Gets a value indicating whether another request can use the instance. 89 | 90 | 91 | Processes the request. 92 | The HTTP context base. 93 | 94 | 95 | A that returns instances of that can pass requests to a given instance. 96 | 97 | 98 | Initializes a new instance of the class. 99 | 100 | 101 | Provides the object that processes the request. 102 | An object that processes the request. 103 | An object that encapsulates information about the request. 104 | 105 | 106 | Gets the singleton instance. 107 | 108 | 109 | Provides the object that processes the request. 110 | An object that processes the request. 111 | An object that encapsulates information about the request. 112 | 113 | 114 | Provides a registration point for the simple membership pre-application start code. 115 | 116 | 117 | Registers the simple membership pre-application start code. 118 | 119 | 120 | Represents the web host buffer policy selector. 121 | 122 | 123 | Initializes a new instance of the class. 124 | 125 | 126 | Gets a value that indicates whether the host should buffer the entity body of the HTTP request. 127 | true if buffering should be used; otherwise a streamed request should be used. 128 | The host context. 129 | 130 | 131 | Uses a buffered output stream for the web host. 132 | A buffered output stream. 133 | The response. 134 | 135 | 136 | -------------------------------------------------------------------------------- /Client1.Page/bin/System.Web.WebPages.Deployment.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | System.Web.WebPages.Deployment 5 | 6 | 7 | 8 | Provides a registration point for pre-application start code for Web Pages deployment. 9 | 10 | 11 | Registers pre-application start code for Web Pages deployment. 12 | 13 | 14 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. 15 | 16 | 17 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. 18 | 19 | 20 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. 21 | 22 | 23 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. 24 | 25 | 26 | The path of the root directory for the application. 27 | 28 | 29 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. 30 | 31 | 32 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. 33 | 34 | 35 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. 36 | 37 | 38 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. 39 | 40 | 41 | -------------------------------------------------------------------------------- /Client1.Page/obj/Debug/Client1.Page.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\Client1.Page.dll.config 2 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\Client1.Page.dll 3 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\Client1.Page.pdb 4 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\Microsoft.Web.Infrastructure.dll 5 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\Microsoft.Web.Mvc.FixedDisplayModes.dll 6 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\Newtonsoft.Json.dll 7 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\SharedWebComponents.Contracts.dll 8 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Net.Http.Formatting.dll 9 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Web.Helpers.dll 10 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Web.Http.dll 11 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Web.Http.WebHost.dll 12 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Web.Mvc.dll 13 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Web.Razor.dll 14 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Web.WebPages.Deployment.dll 15 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Web.WebPages.dll 16 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Web.WebPages.Razor.dll 17 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\SharedWebComponents.Contracts.pdb 18 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\Newtonsoft.Json.xml 19 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Net.Http.Formatting.xml 20 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Web.Helpers.xml 21 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Web.Http.xml 22 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Web.Http.WebHost.xml 23 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Web.Mvc.xml 24 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Web.Razor.xml 25 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Web.WebPages.xml 26 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Web.WebPages.Deployment.xml 27 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Web.WebPages.Razor.xml 28 | C:\dev\SharedWebComponentsMef\Client1.Page\obj\Debug\Client1.Page.csprojResolveAssemblyReference.cache 29 | C:\dev\SharedWebComponentsMef\Client1.Page\obj\Debug\Client1.Page.dll 30 | C:\dev\SharedWebComponentsMef\Client1.Page\obj\Debug\Client1.Page.pdb 31 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\Antlr3.Runtime.dll 32 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Web.Optimization.dll 33 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\WebGrease.dll 34 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\Antlr3.Runtime.pdb 35 | C:\dev\SharedWebComponentsMef\Client1.Page\bin\System.Web.Optimization.xml 36 | -------------------------------------------------------------------------------- /Client1.Page/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FNCSoftware/SharedWebComponentsMef/955e1579bcc8ffc043b1ee40b4e87276087e28a4/Client1.Page/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs -------------------------------------------------------------------------------- /Client1.Page/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FNCSoftware/SharedWebComponentsMef/955e1579bcc8ffc043b1ee40b4e87276087e28a4/Client1.Page/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs -------------------------------------------------------------------------------- /Client1.Page/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FNCSoftware/SharedWebComponentsMef/955e1579bcc8ffc043b1ee40b4e87276087e28a4/Client1.Page/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs -------------------------------------------------------------------------------- /Client1.Page/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Client2.Page/Client2.Page.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | 8 | 9 | 2.0 10 | {7B477CBD-BEE7-43E9-A7F6-FBDA0C41C91C} 11 | {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} 12 | Library 13 | Properties 14 | Client2.Page 15 | Client2.Page 16 | v4.5 17 | true 18 | 19 | 20 | 21 | 22 | ..\packages\WebGrease.1.5.2\lib 23 | 24 | 25 | true 26 | full 27 | false 28 | bin\ 29 | DEBUG;TRACE 30 | prompt 31 | 4 32 | 33 | 34 | pdbonly 35 | true 36 | bin\ 37 | TRACE 38 | prompt 39 | 4 40 | 41 | 42 | 43 | ..\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll 44 | 45 | 46 | 47 | ..\packages\Newtonsoft.Json.5.0.4\lib\net45\Newtonsoft.Json.dll 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | ..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | True 72 | ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll 73 | 74 | 75 | True 76 | ..\packages\Microsoft.AspNet.Mvc.FixedDisplayModes.1.0.0\lib\net40\Microsoft.Web.Mvc.FixedDisplayModes.dll 77 | 78 | 79 | 80 | 81 | ..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll 82 | 83 | 84 | 85 | 86 | True 87 | ..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.Helpers.dll 88 | 89 | 90 | ..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll 91 | 92 | 93 | ..\packages\Microsoft.AspNet.WebApi.WebHost.4.0.30506.0\lib\net40\System.Web.Http.WebHost.dll 94 | 95 | 96 | True 97 | ..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll 98 | 99 | 100 | True 101 | ..\packages\Microsoft.AspNet.Razor.2.0.30506.0\lib\net40\System.Web.Razor.dll 102 | 103 | 104 | True 105 | ..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.dll 106 | 107 | 108 | True 109 | ..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.Deployment.dll 110 | 111 | 112 | True 113 | ..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.WebPages.Razor.dll 114 | 115 | 116 | ..\packages\WebGrease.1.5.2\lib\WebGrease.dll 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | Web.config 134 | 135 | 136 | Web.config 137 | 138 | 139 | 140 | 141 | {996766EC-10A6-4E2D-A020-216EE1E7AAD7} 142 | SharedWebComponents.Contracts 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 10.0 151 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | True 194 | True 195 | 52518 196 | / 197 | http://localhost:52518/ 198 | False 199 | False 200 | 201 | 202 | False 203 | 204 | 205 | 206 | 207 | 208 | xcopy "$(ProjectDir)bin\Client2.Page.dll" "$(SolutionDir)SharedWebComponents\Plugins\" /Y /I /R 209 | 210 | 217 | -------------------------------------------------------------------------------- /Client2.Page/Controllers/TestController.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | 3 | namespace Client2.Page.Controllers { 4 | public class TestController : Controller { 5 | public ActionResult Index() { 6 | return View(); 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /Client2.Page/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Client2.Page")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Client2.Page")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [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 23 | [assembly: Guid("a9ff9f3e-4fb8-4ad0-b1e7-c6e9bc8424ba")] 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 Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Client2.Page/Scripts/test.js: -------------------------------------------------------------------------------- 1 | console.log("<<< from test.js"); -------------------------------------------------------------------------------- /Client2.Page/UrlProviders/ShowUrlProvider.cs: -------------------------------------------------------------------------------- 1 | using SharedWebComponents.Contracts; 2 | 3 | namespace Client2.Page.UrlProviders { 4 | //todo: generic way to generate these strings 5 | public class ShowUrlProvider : IUrlProvider { 6 | public string GetUrl() { 7 | return "/Client2/Test/"; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /Client2.Page/Views/Test/Index.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Web.Optimization 2 | 3 | @Scripts.Render("~/Client2/Scripts/test.js") 4 | 5 | From Client 2 -------------------------------------------------------------------------------- /Client2.Page/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 39 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /Client2.Page/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /Client2.Page/Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /Client2.Page/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Client2.Page/bin/Client2.Page.dll.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Client2.Page/bin/System.Web.Http.WebHost.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | System.Web.Http.WebHost 5 | 6 | 7 | 8 | Provides a global for ASP.NET applications. 9 | 10 | 11 | 12 | Gets the default message handler that will be called for all requests. 13 | 14 | 15 | Extension methods for 16 | 17 | 18 | Maps the specified route template. 19 | A reference to the mapped route. 20 | A collection of routes for the application. 21 | The name of the route to map. 22 | The route template for the route. 23 | 24 | 25 | Maps the specified route template and sets default route. 26 | A reference to the mapped route. 27 | A collection of routes for the application. 28 | The name of the route to map. 29 | The route template for the route. 30 | An object that contains default route values. 31 | 32 | 33 | Maps the specified route template and sets default route values and constraints. 34 | A reference to the mapped route. 35 | A collection of routes for the application. 36 | The name of the route to map. 37 | The route template for the route. 38 | An object that contains default route values. 39 | A set of expressions that specify values for routeTemplate. 40 | 41 | 42 | Maps the specified route template and sets default route values, constraints, and end-point message handler. 43 | A reference to the mapped route. 44 | A collection of routes for the application. 45 | The name of the route to map. 46 | The route template for the route. 47 | An object that contains default route values. 48 | A set of expressions that specify values for routeTemplate. 49 | The handler to which the request will be dispatched. 50 | 51 | 52 | A that passes ASP.NET requests into the pipeline and write the result back. 53 | 54 | 55 | Initializes a new instance of the class. 56 | The route data. 57 | 58 | 59 | Begins the process request. 60 | An that contains information about the status of the process. 61 | The HTTP context base. 62 | The callback. 63 | The state. 64 | 65 | 66 | Provides an asynchronous process End method when the process ends. 67 | An that contains information about the status of the process. 68 | 69 | 70 | Gets a value indicating whether another request can use the instance. 71 | 72 | 73 | Processes the request. 74 | The HTTP context base. 75 | 76 | 77 | Begins processing the request. 78 | An that contains information about the status of the process. 79 | The HTTP context. 80 | The callback. 81 | The state. 82 | 83 | 84 | Provides an asynchronous process End method when the process ends. 85 | An that contains information about the status of the process. 86 | 87 | 88 | Gets a value indicating whether another request can use the instance. 89 | 90 | 91 | Processes the request. 92 | The HTTP context base. 93 | 94 | 95 | A that returns instances of that can pass requests to a given instance. 96 | 97 | 98 | Initializes a new instance of the class. 99 | 100 | 101 | Provides the object that processes the request. 102 | An object that processes the request. 103 | An object that encapsulates information about the request. 104 | 105 | 106 | Gets the singleton instance. 107 | 108 | 109 | Provides the object that processes the request. 110 | An object that processes the request. 111 | An object that encapsulates information about the request. 112 | 113 | 114 | Provides a registration point for the simple membership pre-application start code. 115 | 116 | 117 | Registers the simple membership pre-application start code. 118 | 119 | 120 | Represents the web host buffer policy selector. 121 | 122 | 123 | Initializes a new instance of the class. 124 | 125 | 126 | Gets a value that indicates whether the host should buffer the entity body of the HTTP request. 127 | true if buffering should be used; otherwise a streamed request should be used. 128 | The host context. 129 | 130 | 131 | Uses a buffered output stream for the web host. 132 | A buffered output stream. 133 | The response. 134 | 135 | 136 | -------------------------------------------------------------------------------- /Client2.Page/bin/System.Web.WebPages.Deployment.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | System.Web.WebPages.Deployment 5 | 6 | 7 | 8 | Provides a registration point for pre-application start code for Web Pages deployment. 9 | 10 | 11 | Registers pre-application start code for Web Pages deployment. 12 | 13 | 14 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. 15 | 16 | 17 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. 18 | 19 | 20 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. 21 | 22 | 23 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. 24 | 25 | 26 | The path of the root directory for the application. 27 | 28 | 29 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. 30 | 31 | 32 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. 33 | 34 | 35 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. 36 | 37 | 38 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code. 39 | 40 | 41 | -------------------------------------------------------------------------------- /Client2.Page/obj/Debug/Client2.Page.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\Client2.Page.dll.config 2 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\Client2.Page.dll 3 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\Client2.Page.pdb 4 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\SharedWebComponents.Contracts.dll 5 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Web.Mvc.dll 6 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\SharedWebComponents.Contracts.pdb 7 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Web.Mvc.xml 8 | C:\dev\SharedWebComponentsMef\Client2.Page\obj\Debug\Client2.Page.csprojResolveAssemblyReference.cache 9 | C:\dev\SharedWebComponentsMef\Client2.Page\obj\Debug\Client2.Page.dll 10 | C:\dev\SharedWebComponentsMef\Client2.Page\obj\Debug\Client2.Page.pdb 11 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\Microsoft.Web.Infrastructure.dll 12 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\Microsoft.Web.Mvc.FixedDisplayModes.dll 13 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\Newtonsoft.Json.dll 14 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Net.Http.Formatting.dll 15 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Web.Helpers.dll 16 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Web.Http.dll 17 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Web.Http.WebHost.dll 18 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Web.Razor.dll 19 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Web.WebPages.Deployment.dll 20 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Web.WebPages.dll 21 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Web.WebPages.Razor.dll 22 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\Newtonsoft.Json.xml 23 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Net.Http.Formatting.xml 24 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Web.Helpers.xml 25 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Web.Http.xml 26 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Web.Http.WebHost.xml 27 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Web.Razor.xml 28 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Web.WebPages.xml 29 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Web.WebPages.Deployment.xml 30 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Web.WebPages.Razor.xml 31 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\Antlr3.Runtime.dll 32 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Web.Optimization.dll 33 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\WebGrease.dll 34 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\Antlr3.Runtime.pdb 35 | C:\dev\SharedWebComponentsMef\Client2.Page\bin\System.Web.Optimization.xml 36 | -------------------------------------------------------------------------------- /Client2.Page/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FNCSoftware/SharedWebComponentsMef/955e1579bcc8ffc043b1ee40b4e87276087e28a4/Client2.Page/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs -------------------------------------------------------------------------------- /Client2.Page/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FNCSoftware/SharedWebComponentsMef/955e1579bcc8ffc043b1ee40b4e87276087e28a4/Client2.Page/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs -------------------------------------------------------------------------------- /Client2.Page/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FNCSoftware/SharedWebComponentsMef/955e1579bcc8ffc043b1ee40b4e87276087e28a4/Client2.Page/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs -------------------------------------------------------------------------------- /Client2.Page/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SharedWebComponentsMef 2 | A prototype that demonstrates what a plugin-based architecture using MEF looks like. 3 | 4 | # Current features: # 5 | 6 | - Accepts client dll’s by a naming convention (currently using clientName.anything) where clientName will be used for routing (ie clientName/controller/action/id) 7 | - Uses MEF conventions to extract implementations of IController (built-in MVC controller contract) and IUrlResolver (custom implementation that will be used as bridge between main app and client implementations) 8 | - Has a controller factory that prefers controllers from main project to client controllers 9 | - Can extract resources correctly from client dll’s 10 | - Can extract resources from the correct dll given that multiple dll’s are present and they contain resources with the same name 11 | 12 | # To set up a new client: # 13 | 14 | 1. Create solution that includes a client MVC project and SharedWebComponents project 15 | 2. Add sections to base web.config of client MVC project to automatically mark resources as embedded (as seen in Client1.Page and Client2.Page) 16 | 3. Add call to MefConfig.Register() in Application_Start() 17 | -------------------------------------------------------------------------------- /SharedWebComponents.Contracts/IUrlProvider.cs: -------------------------------------------------------------------------------- 1 | namespace SharedWebComponents.Contracts 2 | { 3 | //todo: make a master interface with a member for each required urlprovider and use attributes (or a bool property) to decide if it should be used. 4 | //todo: That way, we can easily validate if a client has conformed to the specification at compile time. 5 | public interface IUrlProvider { 6 | string GetUrl(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /SharedWebComponents.Contracts/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SharedWebComponents.Contracts")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SharedWebComponents.Contracts")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [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 23 | [assembly: Guid("1e7cf229-f7b7-4cf6-a278-ea92ea724e99")] 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")] 37 | -------------------------------------------------------------------------------- /SharedWebComponents.Contracts/SharedWebComponents.Contracts.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {996766EC-10A6-4E2D-A020-216EE1E7AAD7} 8 | Library 9 | Properties 10 | SharedWebComponents.Contracts 11 | SharedWebComponents.Contracts 12 | v4.5 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 53 | -------------------------------------------------------------------------------- /SharedWebComponents.Contracts/obj/Debug/SharedWebComponents.Contracts.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\dev\SharedWebComponentsMef\SharedWebComponents.Contracts\bin\Debug\SharedWebComponents.Contracts.dll 2 | C:\dev\SharedWebComponentsMef\SharedWebComponents.Contracts\bin\Debug\SharedWebComponents.Contracts.pdb 3 | C:\dev\SharedWebComponentsMef\SharedWebComponents.Contracts\obj\Debug\SharedWebComponents.Contracts.dll 4 | C:\dev\SharedWebComponentsMef\SharedWebComponents.Contracts\obj\Debug\SharedWebComponents.Contracts.pdb 5 | C:\dev\SharedWebComponentsMef\SharedWebComponents.Contracts\obj\Debug\SharedWebComponents.Contracts.csprojResolveAssemblyReference.cache 6 | -------------------------------------------------------------------------------- /SharedWebComponents.Contracts/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FNCSoftware/SharedWebComponentsMef/955e1579bcc8ffc043b1ee40b4e87276087e28a4/SharedWebComponents.Contracts/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs -------------------------------------------------------------------------------- /SharedWebComponents.Contracts/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FNCSoftware/SharedWebComponentsMef/955e1579bcc8ffc043b1ee40b4e87276087e28a4/SharedWebComponents.Contracts/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs -------------------------------------------------------------------------------- /SharedWebComponents.Contracts/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FNCSoftware/SharedWebComponentsMef/955e1579bcc8ffc043b1ee40b4e87276087e28a4/SharedWebComponents.Contracts/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs -------------------------------------------------------------------------------- /SharedWebComponents/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace SharedWebComponents 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /SharedWebComponents/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace SharedWebComponents 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{client}/{controller}/{action}/{id}", 19 | defaults: new { client = "Client1", controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | //constraints: new { client = new IsValidClient() } 21 | ); 22 | } 23 | } 24 | 25 | public class IsValidClient : IRouteConstraint { 26 | public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) { 27 | return true; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /SharedWebComponents/App_Start/WebApiConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web.Http; 5 | 6 | namespace SharedWebComponents 7 | { 8 | public static class WebApiConfig 9 | { 10 | public static void Register(HttpConfiguration config) 11 | { 12 | config.Routes.MapHttpRoute( 13 | name: "DefaultApi", 14 | routeTemplate: "api/{controller}/{id}", 15 | defaults: new { id = RouteParameter.Optional } 16 | ); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SharedWebComponents/Content/test.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: lightblue; 3 | padding: 20px; 4 | } 5 | 6 | .container { 7 | background-color: lightgreen; 8 | padding: 20px; 9 | } -------------------------------------------------------------------------------- /SharedWebComponents/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Mvc; 3 | using SharedWebComponents.Infrastructure.Utility; 4 | 5 | namespace SharedWebComponents.Controllers { 6 | public class HomeController : Controller { 7 | public ActionResult Index(string client) { 8 | return RedirectToAction("Show"); 9 | } 10 | 11 | public ActionResult Show(string client) { 12 | var urlProvider = UrlProviderFetcher.Fetch(client, "Show"); 13 | if (urlProvider == null) { 14 | throw new Exception("Required: Destination must be provided for route: Show"); 15 | } 16 | var destinationUrl = urlProvider.GetUrl(); 17 | return Redirect(destinationUrl); 18 | } 19 | 20 | public ActionResult Override(string client) { 21 | var urlProvider = UrlProviderFetcher.Fetch(client, "Override"); 22 | if (urlProvider == null) { 23 | return View(); 24 | } 25 | var destinationUrl = urlProvider.GetUrl(); 26 | return Redirect(destinationUrl); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /SharedWebComponents/Extensions/StreamExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using SharedWebComponents.Infrastructure.EmbeddedResource; 3 | 4 | namespace SharedWebComponents.Extensions { 5 | public static class StreamExtensions { 6 | public static Stream PrependViewStream(this Stream source) { 7 | var view = VirtualFileRazorViewHelper.GetViewString(source); 8 | var result = new MemoryStream(); 9 | var writer = new StreamWriter(result); 10 | writer.Write(view); 11 | writer.Flush(); 12 | result.Position = 0; 13 | return result; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /SharedWebComponents/Extensions/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Text.RegularExpressions; 2 | 3 | namespace SharedWebComponents.Extensions { 4 | public static class StringExtensions { 5 | public static string BetweenExclusive(this string source, string left, string right) { 6 | return Between(source, left, right); 7 | } 8 | 9 | public static string BetweenInclusive(this string source, string left, string right) { 10 | var match = Between(source, left, right); 11 | return left + match + right; 12 | } 13 | 14 | static string Between(string source, string left, string right) { 15 | return Regex.Match(source, string.Format("{0}(.*){1}", left, right)).Groups[1].Value; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /SharedWebComponents/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="SharedWebComponents.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /SharedWebComponents/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Http; 3 | using System.Web.Mvc; 4 | using System.Web.Routing; 5 | using SharedWebComponents.Infrastructure.Mef; 6 | 7 | namespace SharedWebComponents 8 | { 9 | public class MvcApplication : HttpApplication 10 | { 11 | protected void Application_Start() 12 | { 13 | AreaRegistration.RegisterAllAreas(); 14 | WebApiConfig.Register(GlobalConfiguration.Configuration); 15 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 16 | RouteConfig.RegisterRoutes(RouteTable.Routes); 17 | 18 | MefConfig.Register(); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /SharedWebComponents/Infrastructure/EmbeddedResource/EmbeddedResourceHttpHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web; 3 | using System.Web.Routing; 4 | using SharedWebComponents.Extensions; 5 | 6 | namespace SharedWebComponents.Infrastructure.EmbeddedResource { 7 | internal class EmbeddedResourceHttpHandler : IHttpHandler { 8 | readonly RouteData _routeData; 9 | readonly EmbeddedResourceNameResolver _embeddedResourceNameResolver; 10 | readonly VirtualFileStreamFetcher _streamFetcher; 11 | 12 | public EmbeddedResourceHttpHandler(RouteData routeData, EmbeddedResourceNameResolver embeddedResourceNameResolver, VirtualFileStreamFetcher streamFetcher) { 13 | _routeData = routeData; 14 | _embeddedResourceNameResolver = embeddedResourceNameResolver; 15 | _streamFetcher = streamFetcher; 16 | } 17 | 18 | public bool IsReusable { 19 | get { return false; } 20 | } 21 | 22 | public void ProcessRequest(HttpContext context) { 23 | var routeDataValues = _routeData.Values; 24 | var client = routeDataValues["client"].ToString(); 25 | var assemblyName = UrlToAssemblyMapping.GetAssemblyByUrl(client).GetName().Name; 26 | var fileName = routeDataValues["file"].ToString(); 27 | var fileExtension = routeDataValues["extension"].ToString(); 28 | var prefix = _routeData.DataTokens["name"] + "."; 29 | var resourcePath = string.Format("{0}.{1}{2}.{3}", assemblyName, prefix, fileName, fileExtension); 30 | var pathInfo = new EmbeddedResourcePathInfo(resourcePath); 31 | 32 | AssemblyNameResolution assemblyNameResolution; 33 | if (_embeddedResourceNameResolver.TryResolve(pathInfo, out assemblyNameResolution)) { 34 | var stream = _streamFetcher.Fetch(assemblyNameResolution.Assembly, assemblyNameResolution.Name); 35 | context.Response.Clear(); 36 | context.Response.ContentType = MimeTypeMap.GetMimeType(fileExtension); 37 | stream.CopyTo(context.Response.OutputStream); 38 | } else { 39 | throw new Exception("Unable to find resource: " + resourcePath); 40 | } 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /SharedWebComponents/Infrastructure/EmbeddedResource/EmbeddedResourceNameResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | 6 | namespace SharedWebComponents.Infrastructure.EmbeddedResource { 7 | internal interface IEmbeddedResourceNameResolver { 8 | bool TryResolve(EmbeddedResourcePathInfo pathInfo, out AssemblyNameResolution result); 9 | AssemblyNameResolution Resolve(EmbeddedResourcePathInfo pathInfo); 10 | } 11 | 12 | internal class EmbeddedResourceNameResolver : IEmbeddedResourceNameResolver { 13 | Dictionary _resourceMap; 14 | List _resources; 15 | 16 | Dictionary ResourceMap { 17 | get { return _resourceMap ?? (_resourceMap = new Dictionary()); } 18 | } 19 | 20 | List Resources { 21 | get { return _resources ?? (_resources = new List()); } 22 | } 23 | 24 | public EmbeddedResourceNameResolver(IEnumerable assemblies) { 25 | PopulateResources(assemblies); 26 | } 27 | 28 | void PopulateResources(IEnumerable assemblies) { 29 | foreach (var assembly in assemblies) { 30 | foreach (var resourceName in assembly.GetManifestResourceNames()) { 31 | Resources.Add(new AssemblyNameResolution(assembly, resourceName)); 32 | } 33 | } 34 | } 35 | 36 | public bool TryResolve(EmbeddedResourcePathInfo pathInfo, out AssemblyNameResolution result) { 37 | try { 38 | result = Resolve(pathInfo); 39 | } catch { 40 | result = null; 41 | return false; 42 | } 43 | return true; 44 | } 45 | 46 | public AssemblyNameResolution Resolve(EmbeddedResourcePathInfo pathInfo) { 47 | var normalizedResourceName = GetNormalizedResourceName(pathInfo); 48 | AssemblyNameResolution result; 49 | if (ResourceMap.TryGetValue(normalizedResourceName, out result)) { 50 | return result; 51 | } 52 | foreach (var resource in Resources) { 53 | if (normalizedResourceName.EndsWith(resource.Name, StringComparison.InvariantCultureIgnoreCase)) { 54 | ResourceMap.Add(normalizedResourceName, resource); 55 | return resource; 56 | } 57 | } 58 | if (TryGetByName(pathInfo.GetFileName().ToLowerInvariant(), out result)) { 59 | return result; 60 | } 61 | 62 | throw new Exception(string.Format("Resource ({0}) did not exist in assembly.", pathInfo.Path)); 63 | } 64 | 65 | string GetNormalizedResourceName(EmbeddedResourcePathInfo pathInfo) { 66 | var result = pathInfo.Path.Replace("~/", "").Replace("/", ".").ToLowerInvariant(); 67 | return result; 68 | } 69 | 70 | bool TryGetByName(string resourceName, out AssemblyNameResolution result) { 71 | result = null; 72 | var matchingNames = Resources.Where(x => x.Name.EndsWith("." + resourceName, StringComparison.InvariantCultureIgnoreCase)).ToList(); 73 | if (matchingNames.Count() == 1) { 74 | result = matchingNames.First(); 75 | return true; 76 | } 77 | return false; 78 | } 79 | } 80 | 81 | internal class AssemblyNameResolution { 82 | public AssemblyNameResolution(Assembly assembly, string name) { 83 | Assembly = assembly; 84 | Name = name; 85 | } 86 | 87 | public Assembly Assembly { get; set; } 88 | public string Name { get; set; } 89 | } 90 | } -------------------------------------------------------------------------------- /SharedWebComponents/Infrastructure/EmbeddedResource/EmbeddedResourcePathInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace SharedWebComponents.Infrastructure.EmbeddedResource { 4 | internal class EmbeddedResourcePathInfo { 5 | public string Path { get; set; } 6 | readonly string[] _pathTokens; 7 | 8 | public EmbeddedResourcePathInfo(string path) { 9 | Path = path; 10 | _pathTokens = path.Replace("~/", "").Split('/'); 11 | } 12 | 13 | public string GetAssemblyName() { 14 | if (_pathTokens.Length < 2) { 15 | return null; 16 | } 17 | return _pathTokens[1]; 18 | } 19 | 20 | public string GetFileName() { 21 | return _pathTokens.Last(); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /SharedWebComponents/Infrastructure/EmbeddedResource/EmbeddedResourceRouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Routing; 2 | 3 | namespace SharedWebComponents.Infrastructure.EmbeddedResource { 4 | public static class EmbeddedResourceRouteConfig { 5 | static readonly string FileWithExtensionPart = "{file}.{extension}"; 6 | static readonly string ClientPart = "{client}"; 7 | static readonly string Content = "Content"; 8 | static readonly string Scripts = "Scripts"; 9 | static readonly string Images = "Images"; 10 | static readonly string Fonts = "Fonts"; 11 | 12 | public static void Register() { 13 | RouteTable.Routes.Insert(0, 14 | new Route(GetUrl(Content), 15 | new RouteValueDictionary(new { }), 16 | new RouteValueDictionary(new { extension = "css" }), 17 | new RouteValueDictionary(new { name = Content }), 18 | new EmbeddedResourceRouteHandler() 19 | )); 20 | 21 | RouteTable.Routes.Insert(0, 22 | new Route(GetUrl(Scripts), 23 | new RouteValueDictionary(new { }), 24 | new RouteValueDictionary(new { extension = "js" }), 25 | new RouteValueDictionary(new { name = Scripts }), 26 | new EmbeddedResourceRouteHandler() 27 | )); 28 | 29 | RouteTable.Routes.Insert(0, 30 | new Route(GetUrl(Images), 31 | new RouteValueDictionary(new { }), 32 | new RouteValueDictionary(new { }), 33 | new RouteValueDictionary(new { name = Images }), 34 | new EmbeddedResourceRouteHandler() 35 | )); 36 | 37 | RouteTable.Routes.Insert(0, 38 | new Route(GetUrl(Fonts), 39 | new RouteValueDictionary(new { }), 40 | new RouteValueDictionary(new { }), 41 | new RouteValueDictionary(new { name = Fonts }), 42 | new EmbeddedResourceRouteHandler() 43 | )); 44 | } 45 | 46 | static string GetUrl(string fileTypePart) { 47 | return string.Format("{0}/{1}/{2}", ClientPart, fileTypePart, FileWithExtensionPart); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /SharedWebComponents/Infrastructure/EmbeddedResource/EmbeddedResourceRouteHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Routing; 3 | using SharedWebComponents.Infrastructure.Mef; 4 | 5 | namespace SharedWebComponents.Infrastructure.EmbeddedResource { 6 | public class EmbeddedResourceRouteHandler : IRouteHandler { 7 | IHttpHandler IRouteHandler.GetHttpHandler(RequestContext requestContext) { 8 | var embeddedResourceNameResolver = new EmbeddedResourceNameResolver(MefAssemblyFetcher.Fetch()); 9 | var virtualFileStreamFetcher = new VirtualFileStreamFetcher(); 10 | return new EmbeddedResourceHttpHandler(requestContext.RouteData, embeddedResourceNameResolver, virtualFileStreamFetcher); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /SharedWebComponents/Infrastructure/EmbeddedResource/EmbeddedResourceVirtualFile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Web; 4 | using System.Web.Hosting; 5 | 6 | namespace SharedWebComponents.Infrastructure.EmbeddedResource { 7 | internal class EmbeddedResourceVirtualFile : VirtualFile { 8 | readonly IEmbeddedResourceNameResolver _embeddedResourceNameResolver; 9 | readonly VirtualFileStreamFetcher _streamFetcher; 10 | readonly EmbeddedResourcePathInfo _pathInfo; 11 | 12 | public EmbeddedResourceVirtualFile(IEmbeddedResourceNameResolver embeddedResourceNameResolver, string virtualPath) : base(virtualPath) { 13 | _embeddedResourceNameResolver = embeddedResourceNameResolver; 14 | var path = VirtualPathUtility.ToAppRelative(virtualPath); 15 | _pathInfo = new EmbeddedResourcePathInfo(path); 16 | _streamFetcher = new VirtualFileStreamFetcher(); 17 | } 18 | 19 | public override Stream Open() { 20 | AssemblyNameResolution assemblyNameResolution; 21 | if (_embeddedResourceNameResolver.TryResolve(_pathInfo, out assemblyNameResolution)) { 22 | var result = _streamFetcher.Fetch(assemblyNameResolution.Assembly, assemblyNameResolution.Name); 23 | return result; 24 | } 25 | throw new Exception("Unable to open virtual file"); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /SharedWebComponents/Infrastructure/EmbeddedResource/EmbeddedResourceVirtualPathProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Web.Caching; 4 | using System.Web.Hosting; 5 | 6 | namespace SharedWebComponents.Infrastructure.EmbeddedResource { 7 | internal class EmbeddedResourceVirtualPathProvider : VirtualPathProvider { 8 | readonly IEmbeddedResourceNameResolver _embeddedResourceNameResolver; 9 | 10 | public EmbeddedResourceVirtualPathProvider(IEmbeddedResourceNameResolver embeddedResourceNameResolver) { 11 | _embeddedResourceNameResolver = embeddedResourceNameResolver; 12 | } 13 | 14 | bool IsEmbeddedResourcePath(string virtualPath) { 15 | //if path is serving a file... need to fail resolve and pass to httpHandler 16 | //todo: figure out all extensions that should go here (fonts, images, etc) 17 | if (virtualPath.EndsWith(".js", StringComparison.InvariantCultureIgnoreCase) || virtualPath.EndsWith(".css", StringComparison.InvariantCultureIgnoreCase)) { 18 | return false; 19 | } 20 | AssemblyNameResolution result; 21 | var pathInfo = new EmbeddedResourcePathInfo(virtualPath); 22 | return _embeddedResourceNameResolver.TryResolve(pathInfo, out result); 23 | } 24 | 25 | public override bool FileExists(string virtualPath) { 26 | return IsEmbeddedResourcePath(virtualPath) || base.FileExists(virtualPath); 27 | } 28 | 29 | public override VirtualFile GetFile(string virtualPath) { 30 | if (IsEmbeddedResourcePath(virtualPath)) { 31 | return new EmbeddedResourceVirtualFile(_embeddedResourceNameResolver, virtualPath); 32 | } 33 | var result = base.GetFile(virtualPath); 34 | return result; 35 | } 36 | 37 | public override CacheDependency GetCacheDependency(string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart) { 38 | return IsEmbeddedResourcePath(virtualPath) ? null : base.GetCacheDependency(virtualPath, virtualPathDependencies, utcStart); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /SharedWebComponents/Infrastructure/EmbeddedResource/UrlToAssemblyMapping.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Reflection; 3 | 4 | namespace SharedWebComponents.Infrastructure.EmbeddedResource { 5 | internal static class UrlToAssemblyMapping { 6 | //assumes only one dll per client, for now 7 | static readonly IDictionary LookupByUrl = new Dictionary(); 8 | static readonly IDictionary LookupByAssemblyName = new Dictionary(); 9 | 10 | public static void Add(string url, Assembly assembly) { 11 | LookupByUrl.Add(url.ToLowerInvariant(), assembly); 12 | LookupByAssemblyName.Add(assembly.GetName().Name.ToLowerInvariant(), url); 13 | } 14 | 15 | public static Assembly GetAssemblyByUrl(string url) { 16 | Assembly result; 17 | if (LookupByUrl.TryGetValue(url.ToLowerInvariant(), out result)) { 18 | return result; 19 | } 20 | return null; 21 | } 22 | 23 | public static string GetUrlByAssemblyName(string assemblyName) { 24 | string result; 25 | if (LookupByAssemblyName.TryGetValue(assemblyName.ToLowerInvariant(), out result)) { 26 | return result; 27 | } 28 | return null; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /SharedWebComponents/Infrastructure/EmbeddedResource/VirtualFileRazorViewHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using SharedWebComponents.Extensions; 4 | 5 | namespace SharedWebComponents.Infrastructure.EmbeddedResource { 6 | internal class VirtualFileRazorViewHelper { 7 | //todo: need to build this from web config dynamically 8 | static readonly string WebviewpagePrependTemplate = @"@inherits System.Web.Mvc.WebViewPage{0}{1}@using System.Web.Mvc{2}@using System.Web.WebPages{3}@using System.Web.Mvc.Html{4}@using System.Web.Optimization{5}"; 9 | 10 | public static string GetViewString(Stream stream) { 11 | string result; 12 | using (var reader = new StreamReader(stream)) { 13 | result = reader.ReadToEnd(); 14 | } 15 | var modelString = GetModelString(result); 16 | if (!string.IsNullOrWhiteSpace(modelString)) { 17 | result = RemoveModelDeclaration(result); 18 | } 19 | var inheritsAndModelString = GetInheritsAndModelString(modelString); 20 | result = inheritsAndModelString + result; 21 | return result; 22 | } 23 | 24 | static string GetInheritsAndModelString(string modelString) { 25 | var result = string.Format(WebviewpagePrependTemplate, modelString, Environment.NewLine, Environment.NewLine, Environment.NewLine, Environment.NewLine, Environment.NewLine); 26 | return result; 27 | } 28 | 29 | static string RemoveModelDeclaration(string result) { 30 | var modelDeclaration = result.BetweenInclusive("@model", Environment.NewLine); 31 | if (!String.IsNullOrWhiteSpace(modelDeclaration)) { 32 | result = result.Replace(modelDeclaration, ""); 33 | } 34 | return result; 35 | } 36 | 37 | static string GetModelString(string input) { 38 | var model = input.BetweenExclusive("@model", Environment.NewLine).Trim(); 39 | var type = Type.GetType(model, false); 40 | if (type == null) { 41 | return null; 42 | } 43 | var result = String.IsNullOrWhiteSpace(model) ? "" : "<" + model + ">"; 44 | return result; 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /SharedWebComponents/Infrastructure/EmbeddedResource/VirtualFileStreamFetcher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Reflection; 4 | using SharedWebComponents.Extensions; 5 | 6 | namespace SharedWebComponents.Infrastructure.EmbeddedResource { 7 | internal class VirtualFileStreamFetcher { 8 | public Stream Fetch(Assembly assembly, string resourceName) { 9 | var result = assembly.GetManifestResourceStream(resourceName); 10 | if (resourceName.EndsWith(".cshtml", StringComparison.InvariantCultureIgnoreCase)) { 11 | result = result.PrependViewStream(); 12 | } 13 | return result; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /SharedWebComponents/Infrastructure/Mef/MefAssemblyFetcher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Reflection; 6 | 7 | namespace SharedWebComponents.Infrastructure.Mef { 8 | internal class MefAssemblyFetcher { 9 | public static IEnumerable Fetch() { 10 | var assemblyPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, RuntimeDirectoryConstants.MEF_PLUGINS); 11 | var assemblies = new DirectoryInfo(assemblyPath).GetFiles("*.dll").Select(x => Assembly.LoadFile(x.FullName)).ToList(); 12 | return assemblies; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /SharedWebComponents/Infrastructure/Mef/MefBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Composition.Convention; 3 | using System.Composition.Hosting; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.Web.Mvc; 7 | using SharedWebComponents.Contracts; 8 | 9 | namespace SharedWebComponents.Infrastructure.Mef { 10 | public class MefBootstrapper { 11 | static bool isLoaded; 12 | static CompositionHost container; 13 | 14 | public static void Compose(IEnumerable assemblies) { 15 | if (isLoaded) { 16 | return; 17 | } 18 | 19 | container = GetContainer(assemblies); 20 | 21 | isLoaded = true; 22 | } 23 | 24 | static CompositionHost GetContainer(IEnumerable assemblies) { 25 | var conventions = new ConventionBuilder(); 26 | conventions.ForTypesDerivedFrom().Export(); 27 | conventions.ForTypesDerivedFrom().Export(); 28 | return new ContainerConfiguration().WithAssemblies(assemblies, conventions).CreateContainer(); 29 | } 30 | 31 | public static T GetInstance(string assemblyHint = null, string typeName = null) { 32 | var type = default(T); 33 | if (container == null) { 34 | return type; 35 | } 36 | 37 | if (string.IsNullOrWhiteSpace(typeName)) { 38 | type = container.GetExport(); 39 | } else { 40 | var exports = container.GetExports(); 41 | type = exports.FirstOrDefault(x => x.GetType().Name == typeName && (assemblyHint == null || (x.GetType().AssemblyQualifiedName != null && x.GetType().AssemblyQualifiedName.Contains(assemblyHint)))); 42 | } 43 | 44 | return type; 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /SharedWebComponents/Infrastructure/Mef/MefConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Web.Hosting; 3 | using System.Web.Mvc; 4 | using SharedWebComponents.Infrastructure.EmbeddedResource; 5 | 6 | namespace SharedWebComponents.Infrastructure.Mef { 7 | public class MefConfig { 8 | public static void Register() { 9 | var assemblies = MefAssemblyFetcher.Fetch().ToList(); 10 | foreach (var assembly in assemblies) { 11 | //by convention, everything before dot will be client url parameter 12 | var clientUrlParameter = assembly.GetName().Name.Split('.').First(); 13 | UrlToAssemblyMapping.Add(clientUrlParameter, assembly); 14 | } 15 | MefBootstrapper.Compose(assemblies); 16 | EmbeddedResourceRouteConfig.Register(); 17 | ControllerBuilder.Current.SetControllerFactory(new MefFallbackControllerFactory()); 18 | ViewEngines.Engines.Add(new SharedWebComponentsViewEngine("Plugins")); 19 | HostingEnvironment.RegisterVirtualPathProvider(new EmbeddedResourceVirtualPathProvider(new EmbeddedResourceNameResolver(assemblies))); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /SharedWebComponents/Infrastructure/Mef/MefFallbackControllerFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Reflection; 4 | using System.Web.Mvc; 5 | using System.Web.Routing; 6 | using System.Web.SessionState; 7 | 8 | namespace SharedWebComponents.Infrastructure.Mef { 9 | public class MefFallbackControllerFactory : IControllerFactory { 10 | public IController CreateController(RequestContext requestContext, string controllerName) { 11 | var controllerTypeName = controllerName + "Controller"; 12 | var controller = Assembly.GetExecutingAssembly().GetTypes().FirstOrDefault(x => typeof (IController).IsAssignableFrom(x) && x.Name == controllerTypeName); 13 | if (controller != null) { 14 | return (IController) Activator.CreateInstanceFrom(controller.Assembly.CodeBase, controller.FullName).Unwrap(); 15 | } 16 | 17 | var clientName = requestContext.RouteData.Values["client"].ToString(); 18 | var pluginController = MefBootstrapper.GetInstance(clientName, controllerTypeName); 19 | 20 | if (pluginController == null) { 21 | throw new Exception("Controller not found!"); 22 | } 23 | 24 | return pluginController; 25 | } 26 | 27 | public SessionStateBehavior GetControllerSessionBehavior(RequestContext requestContext, string controllerName) { 28 | return SessionStateBehavior.Default; 29 | } 30 | 31 | public void ReleaseController(IController controller) { 32 | var disposableController = controller as IDisposable; 33 | 34 | if (disposableController != null) { 35 | disposableController.Dispose(); 36 | } 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /SharedWebComponents/Infrastructure/RuntimeDirectoryConstants.cs: -------------------------------------------------------------------------------- 1 | namespace SharedWebComponents.Infrastructure { 2 | public class RuntimeDirectoryConstants { 3 | public const string MEF_PLUGINS = "Plugins"; 4 | } 5 | } -------------------------------------------------------------------------------- /SharedWebComponents/Infrastructure/SharedWebComponentsViewEngine.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Web.Mvc; 3 | using SharedWebComponents.Infrastructure.EmbeddedResource; 4 | 5 | namespace SharedWebComponents.Infrastructure { 6 | //http://stackoverflow.com/questions/9838766/implementing-a-custom-razorviewengine 7 | internal class SharedWebComponentsViewEngine : RazorViewEngine { 8 | string Location { get; set; } 9 | 10 | SharedWebComponentsViewEngine() { 11 | AreaViewLocationFormats = AppendLocationFormats(_newAreaViewLocations, AreaViewLocationFormats); 12 | AreaMasterLocationFormats = AppendLocationFormats(_newAreaMasterLocations, AreaMasterLocationFormats); 13 | AreaPartialViewLocationFormats = AppendLocationFormats(_newAreaPartialViewLocations, AreaPartialViewLocationFormats); 14 | ViewLocationFormats = AppendLocationFormats(_newViewLocations, ViewLocationFormats); 15 | MasterLocationFormats = AppendLocationFormats(_newMasterLocations, MasterLocationFormats); 16 | PartialViewLocationFormats = AppendLocationFormats(_newPartialViewLocations, PartialViewLocationFormats); 17 | } 18 | 19 | public SharedWebComponentsViewEngine(string location) : this() { 20 | Location = location; 21 | } 22 | 23 | readonly string[] _newAreaViewLocations = { 24 | "~/Areas/{2}/%1Views/{1}/{0}.cshtml", 25 | "~/Areas/{2}/%1Views/{1}/{0}.vbhtml", 26 | "~/Areas/{2}/%1Views//Shared/{0}.cshtml", 27 | "~/Areas/{2}/%1Views//Shared/{0}.vbhtml" 28 | }; 29 | 30 | readonly string[] _newAreaMasterLocations = { 31 | "~/Areas/{2}/%1Views/{1}/{0}.cshtml", 32 | "~/Areas/{2}/%1Views/{1}/{0}.vbhtml", 33 | "~/Areas/{2}/%1Views/Shared/{0}.cshtml", 34 | "~/Areas/{2}/%1Views/Shared/{0}.vbhtml" 35 | }; 36 | 37 | readonly string[] _newAreaPartialViewLocations = { 38 | "~/Areas/{2}/%1Views/{1}/{0}.cshtml", 39 | "~/Areas/{2}/%1Views/{1}/{0}.vbhtml", 40 | "~/Areas/{2}/%1Views/Shared/{0}.cshtml", 41 | "~/Areas/{2}/%1Views/Shared/{0}.vbhtml" 42 | }; 43 | 44 | readonly string[] _newViewLocations = { 45 | "~/%1Views/{1}/{0}.cshtml", 46 | "~/%1Views/{1}/{0}.vbhtml", 47 | "~/%1Views/Shared/{0}.cshtml", 48 | "~/%1Views/Shared/{0}.vbhtml" 49 | }; 50 | 51 | readonly string[] _newMasterLocations = { 52 | "~/%1Views/{1}/{0}.cshtml", 53 | "~/%1Views/{1}/{0}.vbhtml", 54 | "~/%1Views/Shared/{0}.cshtml", 55 | "~/%1Views/Shared/{0}.vbhtml" 56 | }; 57 | 58 | readonly string[] _newPartialViewLocations = { 59 | "~/%1Views/{1}/{0}.cshtml", 60 | "~/%1Views/{1}/{0}.vbhtml", 61 | "~/%1Views/Shared/{0}.cshtml", 62 | "~/%1Views/Shared/{0}.vbhtml" 63 | }; 64 | 65 | static string[] AppendLocationFormats(IEnumerable newLocations, IEnumerable defaultLocations) { 66 | var viewLocations = new List(); 67 | viewLocations.AddRange(defaultLocations); 68 | viewLocations.AddRange(newLocations); 69 | return viewLocations.ToArray(); 70 | } 71 | 72 | protected override IView CreateView(ControllerContext controllerContext, string viewPath, string masterPath) { 73 | return base.CreateView(controllerContext, GetViewPath(viewPath, controllerContext), masterPath); 74 | } 75 | 76 | protected override IView CreatePartialView(ControllerContext controllerContext, string partialPath) { 77 | return base.CreatePartialView(controllerContext, GetViewPath(partialPath, controllerContext)); 78 | } 79 | 80 | protected override bool FileExists(ControllerContext controllerContext, string virtualPath) { 81 | return base.FileExists(controllerContext, GetViewPath(virtualPath, controllerContext)); 82 | } 83 | 84 | string GetViewPath(string path, ControllerContext controllerContext) { 85 | var clientUrlParameter = controllerContext.RouteData.Values["client"].ToString(); 86 | var assemblyName = UrlToAssemblyMapping.GetAssemblyByUrl(clientUrlParameter).GetName().Name; 87 | return path.Replace("%1", Location + "/" + assemblyName + "/"); 88 | } 89 | } 90 | } -------------------------------------------------------------------------------- /SharedWebComponents/Infrastructure/Utility/UrlProviderFetcher.cs: -------------------------------------------------------------------------------- 1 | using SharedWebComponents.Contracts; 2 | using SharedWebComponents.Infrastructure.Mef; 3 | 4 | namespace SharedWebComponents.Infrastructure.Utility { 5 | internal class UrlProviderFetcher { 6 | public static IUrlProvider Fetch(string client = null, string typePrefix = null) { 7 | var urlProviderName = string.IsNullOrWhiteSpace(client) ? null : typePrefix + "UrlProvider"; 8 | var result = MefBootstrapper.GetInstance(client, urlProviderName); 9 | return result; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /SharedWebComponents/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SharedWebComponents")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SharedWebComponents")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [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 23 | [assembly: Guid("3aaf1c93-224b-44d5-a8fc-90e6189af28b")] 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 Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /SharedWebComponents/Views/Home/Override.cshtml: -------------------------------------------------------------------------------- 1 | This is the default Override view from Shared. -------------------------------------------------------------------------------- /SharedWebComponents/Views/Shared/_CustomLayout.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Web.Optimization 2 | 3 | 4 | 5 | 6 | 7 | @ViewBag.Title - My ASP.NET Application 8 | @Styles.Render("~/Content/test.css")@*test external css inclusion*@ 9 | @RenderSection("styles", false) 10 | 11 | 12 |

This is _CustomLayout

13 |
14 | @RenderBody() 15 |
16 | 17 | @RenderSection("scripts", false) 18 | 19 | 20 | -------------------------------------------------------------------------------- /SharedWebComponents/Views/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 39 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /SharedWebComponents/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_CustomLayout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /SharedWebComponents/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /SharedWebComponents/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /SharedWebComponents/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /SharedWebComponents/adjunct/System/ComponentModel/Composition/CatalogService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.Composition.Hosting; 3 | using System.Diagnostics; 4 | using System.IO; 5 | using System.Net; 6 | 7 | namespace System.ComponentModel.Composition 8 | { 9 | /// 10 | internal sealed class CatalogService : ICatalogService 11 | { 12 | private readonly AggregateCatalog _aggregateCatalog; 13 | 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | /// The aggregate catalog. 18 | public CatalogService(AggregateCatalog aggregateCatalog) 19 | { 20 | _aggregateCatalog = aggregateCatalog; 21 | } 22 | #if SILVERLIGHT 23 | private readonly Dictionary _catalogs = new Dictionary(); 24 | 25 | 26 | /// 27 | public XapCatalog AddXap(string relativeUri, 28 | Action progressAction = null, 29 | Action completedAction = null) 30 | { 31 | Uri uri = new Uri(relativeUri, UriKind.Relative); 32 | return AddXap(uri, progressAction, completedAction); 33 | } 34 | 35 | /// 36 | public XapCatalog AddXap(Uri uri, 37 | Action progressAction, 38 | Action completedAction) 39 | { 40 | Debug.WriteLine("CatalogService: Request for {0}", uri); 41 | if (_catalogs.ContainsKey(uri)) 42 | { 43 | Debug.WriteLine("CatalogService: {0} already downloaded", uri); 44 | return _catalogs[uri]; 45 | } 46 | XapCatalog catalog = new XapCatalog(uri); 47 | if (progressAction != null) 48 | { 49 | catalog.DownloadProgressChanged += (s, e) => progressAction(e); 50 | } 51 | if (completedAction != null) 52 | { 53 | catalog.DownloadCompleted += (s, e) => completedAction(e); 54 | } 55 | else 56 | { 57 | catalog.DownloadCompleted += (s, e) => 58 | { 59 | if (e.Error != null) 60 | { 61 | throw e.Error; 62 | } 63 | }; 64 | } 65 | #if DEBUG 66 | catalog.DownloadCompleted += (s, e) => Debug.WriteLine("CatalogService: Download completed for {0}", uri); 67 | #endif 68 | catalog.DownloadAsync(); 69 | Debug.WriteLine("CatalogService: Download Started for {0}", uri); 70 | _catalogs[uri] = catalog; 71 | _aggregateCatalog.Catalogs.Add(catalog); 72 | return catalog; 73 | } 74 | 75 | /// 76 | public void RemoveXap(string relativeUri) 77 | { 78 | RemoveXap(new Uri(relativeUri, UriKind.Relative)); 79 | } 80 | 81 | /// 82 | public void RemoveXap(Uri uri) 83 | { 84 | XapCatalog catalog; 85 | if (_catalogs.TryGetValue(uri, out catalog)) 86 | { 87 | _aggregateCatalog.Catalogs.Remove(catalog); 88 | } 89 | } 90 | #else 91 | private readonly Dictionary _catalogs = new Dictionary(); 92 | 93 | /// 94 | public void AddDirectory(string path) 95 | { 96 | if (_catalogs.ContainsKey(path) || !Directory.Exists(path)) 97 | { 98 | return; 99 | } 100 | DirectoryCatalog catalog = new DirectoryCatalog(path); 101 | _catalogs[path] = catalog; 102 | _aggregateCatalog.Catalogs.Add(catalog); 103 | } 104 | 105 | /// 106 | public void AddDirectory(string path, string searchPattern) 107 | { 108 | if (_catalogs.ContainsKey(path) || !Directory.Exists(path)) 109 | { 110 | return; 111 | } 112 | DirectoryCatalog catalog = new DirectoryCatalog(path, searchPattern); 113 | _catalogs[path] = catalog; 114 | _aggregateCatalog.Catalogs.Add(catalog); 115 | } 116 | 117 | /// 118 | public void RemoveDirectory(string path) 119 | { 120 | DirectoryCatalog catalog; 121 | if (_catalogs.TryGetValue(path, out catalog)) 122 | { 123 | _aggregateCatalog.Catalogs.Remove(catalog); 124 | } 125 | } 126 | #endif 127 | } 128 | } -------------------------------------------------------------------------------- /SharedWebComponents/adjunct/System/ComponentModel/Composition/ExportFactory.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace System.ComponentModel.Composition 3 | { 4 | /// 5 | /// 6 | /// 7 | /// 8 | internal class ExportFactory 9 | { 10 | private readonly Func> _exportLifetimeContextCreator; 11 | 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | /// The export lifetime context creator. 16 | public ExportFactory(Func> exportLifetimeContextCreator) 17 | { 18 | if (exportLifetimeContextCreator == null) 19 | { 20 | throw new ArgumentNullException("exportLifetimeContextCreator"); 21 | } 22 | _exportLifetimeContextCreator = exportLifetimeContextCreator; 23 | } 24 | 25 | /// 26 | /// Creates the export. 27 | /// 28 | /// 29 | public ExportLifetimeContext CreateExport() 30 | { 31 | Tuple untypedLifetimeContext = _exportLifetimeContextCreator.Invoke(); 32 | return new ExportLifetimeContext(untypedLifetimeContext.Item1, untypedLifetimeContext.Item2); 33 | } 34 | } 35 | 36 | /// 37 | /// 38 | /// 39 | /// 40 | /// The type of the metadata. 41 | internal class ExportFactory : ExportFactory 42 | { 43 | private readonly TMetadata _metadata; 44 | 45 | /// 46 | /// Initializes a new instance of the class. 47 | /// 48 | /// The export lifetime context creator. 49 | /// The metadata. 50 | public ExportFactory(Func> exportLifetimeContextCreator, TMetadata metadata) 51 | : base(exportLifetimeContextCreator) 52 | { 53 | _metadata = metadata; 54 | } 55 | 56 | /// 57 | /// Gets the metadata. 58 | /// 59 | /// The metadata. 60 | public TMetadata Metadata 61 | { 62 | get { return _metadata; } 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /SharedWebComponents/adjunct/System/ComponentModel/Composition/ExportLifetimeContext.cs: -------------------------------------------------------------------------------- 1 | namespace System.ComponentModel.Composition 2 | { 3 | /// 4 | /// 5 | /// 6 | /// 7 | internal sealed class ExportLifetimeContext : IDisposable 8 | { 9 | private readonly Action _disposeAction; 10 | private readonly T _value; 11 | 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | /// The value. 16 | /// The dispose action. 17 | public ExportLifetimeContext(T value, Action disposeAction) 18 | { 19 | _value = value; 20 | _disposeAction = disposeAction; 21 | } 22 | 23 | /// 24 | /// Gets the value. 25 | /// 26 | /// The value. 27 | public T Value 28 | { 29 | get { return _value; } 30 | } 31 | 32 | /// 33 | /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. 34 | /// 35 | public void Dispose() 36 | { 37 | if (_disposeAction != null) 38 | { 39 | _disposeAction.Invoke(); 40 | } 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /SharedWebComponents/adjunct/System/ComponentModel/Composition/ICatalogService.cs: -------------------------------------------------------------------------------- 1 | namespace System.ComponentModel.Composition 2 | { 3 | /// 4 | /// 5 | /// 6 | internal interface ICatalogService 7 | { 8 | #if SILVERLIGHT 9 | /// 10 | /// Adds the xap. 11 | /// 12 | /// The relative URI. 13 | /// The progress action. 14 | /// The completed action. 15 | /// The XapCatalog wrapping the xap 16 | XapCatalog AddXap(string relativeUri, 17 | Action progressAction = null, 18 | Action completedAction = null); 19 | 20 | /// 21 | /// Adds the xap. 22 | /// 23 | /// The URI. 24 | /// The progress action. 25 | /// The completed action. 26 | /// The XapCatalog wrapping the xap 27 | XapCatalog AddXap(Uri uri, 28 | Action progressAction = null, 29 | Action completedAction = null); 30 | 31 | /// 32 | /// Removes the xap. 33 | /// 34 | /// The relative URI. 35 | void RemoveXap(string relativeUri); 36 | 37 | /// 38 | /// Removes the xap. 39 | /// 40 | /// The URI. 41 | void RemoveXap(Uri uri); 42 | #else 43 | /// 44 | /// Adds the directory. 45 | /// 46 | /// The path. 47 | void AddDirectory(string path); 48 | 49 | /// 50 | /// Adds the directory. 51 | /// 52 | /// The path. 53 | /// The search pattern. 54 | void AddDirectory(string path, string searchPattern); 55 | 56 | /// 57 | /// Removes the directory. 58 | /// 59 | /// The path. 60 | void RemoveDirectory(string path); 61 | #endif 62 | } 63 | } -------------------------------------------------------------------------------- /SharedWebComponents/adjunct/System/ComponentModel/Composition/IoCDebugger.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.Composition.Hosting; 3 | using System.ComponentModel.Composition.Primitives; 4 | using System.Diagnostics; 5 | 6 | namespace System.ComponentModel.Composition 7 | { 8 | /// 9 | /// Helper class for debugging MEF 10 | /// 11 | internal class IoCDebugger 12 | { 13 | private const string DbgMefCatalog = "MEF: Found catalog: {0}"; 14 | private const string DbgMefKey = " With key: {0} = {1}"; 15 | private const string DbgMefPart = "MEF: Found part: {0}"; 16 | private const string DbgMefWithExport = " With export:"; 17 | private const string DbgMefWithImport = " With import: {0}"; 18 | private const string DbgMefWithKey = " With key: {0} = {1}"; 19 | private const string MsgAddExport = "Added Export:"; 20 | private const string MsgChangeContract = "Changed contracts:"; 21 | private const string MsgRemovedExport = "Removed Export:"; 22 | private readonly CompositionContainer _container; 23 | 24 | /// 25 | /// Constructor 26 | /// 27 | /// The container to debug 28 | public IoCDebugger(CompositionContainer container) 29 | { 30 | _container = container; 31 | _container.ExportsChanged += ExportsChanged; 32 | DebugCatalog((AggregateCatalog)container.Catalog); 33 | } 34 | 35 | public void Close() 36 | { 37 | LogInfo("MEF Debugger shutting down."); 38 | _container.ExportsChanged -= ExportsChanged; 39 | } 40 | 41 | /// 42 | /// Debug the catalog 43 | /// 44 | /// The source catalog 45 | private void DebugCatalog(AggregateCatalog srcCatalog) 46 | { 47 | foreach (ComposablePartCatalog catalog in srcCatalog.Catalogs) 48 | { 49 | LogInfo(DbgMefCatalog, catalog); 50 | 51 | foreach (ComposablePartDefinition part in catalog.Parts) 52 | { 53 | LogInfo(DbgMefPart, part); 54 | 55 | if (part.Metadata != null) 56 | { 57 | foreach (string key in part.Metadata.Keys) 58 | { 59 | LogInfo(DbgMefWithKey, key, part.Metadata[key]); 60 | } 61 | } 62 | 63 | foreach (ImportDefinition import in part.ImportDefinitions) 64 | { 65 | LogInfo(DbgMefWithImport, import); 66 | } 67 | 68 | ParseExports(DbgMefWithExport, part.ExportDefinitions); 69 | 70 | foreach (ExportDefinition export in part.ExportDefinitions) 71 | { 72 | LogInfo("{0} {1}", DbgMefWithExport, export); 73 | 74 | if (export.Metadata == null) 75 | { 76 | continue; 77 | } 78 | 79 | foreach (string key in export.Metadata.Keys) 80 | { 81 | LogInfo(DbgMefKey, key, export.Metadata[key]); 82 | } 83 | } 84 | } 85 | } 86 | } 87 | 88 | private void ExportsChanged(object sender, ExportsChangeEventArgs args) 89 | { 90 | try 91 | { 92 | if (args.AddedExports != null) 93 | { 94 | ParseExports(MsgAddExport, args.AddedExports); 95 | } 96 | 97 | if (args.RemovedExports != null) 98 | { 99 | ParseExports(MsgRemovedExport, args.RemovedExports); 100 | } 101 | 102 | if (args.ChangedContractNames != null) 103 | { 104 | bool first = true; 105 | foreach (string contract in args.ChangedContractNames) 106 | { 107 | if (first) 108 | { 109 | LogInfo(MsgChangeContract); 110 | first = false; 111 | } 112 | LogInfo(" ==>{0}", contract); 113 | } 114 | } 115 | } 116 | catch (Exception ex) 117 | { 118 | LogWarn(ex.Message); 119 | } 120 | } 121 | 122 | /// 123 | /// Parse the exports 124 | /// 125 | /// 126 | /// 127 | private void ParseExports(string tag, IEnumerable exports) 128 | { 129 | foreach (ExportDefinition export in exports) 130 | { 131 | LogInfo("{0} {1}", tag, export); 132 | 133 | if (export.Metadata == null) 134 | { 135 | continue; 136 | } 137 | 138 | foreach (string key in export.Metadata.Keys) 139 | { 140 | LogInfo(DbgMefKey, key, export.Metadata[key]); 141 | } 142 | } 143 | } 144 | 145 | private static void LogInfo(string format, params object[] args) 146 | { 147 | Debug.WriteLine(string.Format("Info: " + format, args)); 148 | } 149 | 150 | private static void LogWarn(string format, params object[] args) 151 | { 152 | Debug.WriteLine(string.Format("Warn: " + format, args)); 153 | } 154 | } 155 | } -------------------------------------------------------------------------------- /SharedWebComponents/adjunct/System/ComponentModel/Composition/XElementExportProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.Composition.Hosting; 3 | using System.ComponentModel.Composition.Primitives; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Xml.Linq; 7 | 8 | namespace System.ComponentModel.Composition 9 | { 10 | /// 11 | /// 12 | /// 13 | internal class XElementExportProvider : ExportProvider 14 | { 15 | private readonly Dictionary _exportsDictionary; 16 | 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// Includes *.xml and *.config by default. 20 | /// 21 | /// The path. Defaults to Directory.GetCurrentDirectory() 22 | /// A list of additional file filters to include. 23 | public XElementExportProvider(string path = null, IEnumerable filters = null) 24 | { 25 | if (path == null) 26 | { 27 | path = Directory.GetCurrentDirectory(); 28 | } 29 | List include = new List(new[] { "*.xml", "*.config" }); 30 | if (filters != null) 31 | { 32 | foreach (string filter in filters.Where(filter => !string.IsNullOrWhiteSpace(filter)).Where(filter => !include.Contains(filter))) 33 | { 34 | include.Add(filter); 35 | } 36 | } 37 | 38 | List xmlFiles = new List(include.SelectMany(ext => Directory.GetFiles(path, ext))); 39 | 40 | _exportsDictionary = xmlFiles.Select(filePath => new FileInfo(filePath)).ToDictionary( 41 | fileInfo => fileInfo.Name, 42 | fileInfo => 43 | { 44 | ExportDefinition def = new ExportDefinition(fileInfo.Name, null); 45 | Export e = new Export(def, () => XElement.Load(fileInfo.FullName)); 46 | return e; 47 | }); 48 | } 49 | 50 | /// 51 | /// Returns all exports that match the constraint defined by the specified definition. 52 | /// 53 | /// The that defines the conditions of the 54 | /// objects to return. 55 | /// 56 | /// 57 | /// 58 | /// An of objects that match 59 | /// the conditions defined by , if found; otherwise, an 60 | /// empty . 61 | /// 62 | protected override IEnumerable GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition) 63 | { 64 | List exports = new List(); 65 | if (_exportsDictionary.ContainsKey(definition.ContractName)) 66 | { 67 | exports.Add(_exportsDictionary[definition.ContractName]); 68 | } 69 | return exports; 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /SharedWebComponents/adjunct/System/ComponentModel/Composition/XapPackage.cs: -------------------------------------------------------------------------------- 1 | #if SILVERLIGHT 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | using System.Reflection; 6 | using System.Windows; 7 | using System.Windows.Resources; 8 | using System.Xml; 9 | 10 | namespace System.ComponentModel.Composition 11 | { 12 | internal static class XapPackage 13 | { 14 | /// 15 | /// Retrieves The current list of assemblies for the application XAP load. Depends on the Deployment.Current property being setup and 16 | /// so can only be accessed after the Application object has be completely constructed. 17 | /// No caching occurs at this level. 18 | /// 19 | public static IEnumerable CurrentAssemblies 20 | { 21 | get 22 | { 23 | List assemblies = new List(); 24 | 25 | // While this may seem like somewhat of a hack, walking the AssemblyParts in the active 26 | // deployment object is the only way to get the list of assemblies loaded by the initial XAP. 27 | foreach (AssemblyPart ap in Deployment.Current.Parts) 28 | { 29 | StreamResourceInfo sri = Application.GetResourceStream(new Uri(ap.Source, UriKind.Relative)); 30 | if (sri != null) 31 | { 32 | // Keep in mind that calling Load on an assembly that is already loaded will 33 | // be a no-op and simply return the already loaded assembly object. 34 | Assembly assembly = ap.Load(sri.Stream); 35 | assemblies.Add(assembly); 36 | } 37 | } 38 | 39 | return assemblies; 40 | } 41 | } 42 | 43 | public static IEnumerable LoadPackagedAssemblies(Stream packageStream) 44 | { 45 | List assemblies = new List(); 46 | StreamResourceInfo packageStreamInfo = new StreamResourceInfo(packageStream, null); 47 | 48 | IEnumerable parts = GetDeploymentParts(packageStreamInfo); 49 | 50 | foreach (AssemblyPart ap in parts) 51 | { 52 | StreamResourceInfo sri = Application.GetResourceStream(packageStreamInfo, new Uri(ap.Source, UriKind.Relative)); 53 | 54 | assemblies.Add(ap.Load(sri.Stream)); 55 | } 56 | packageStream.Close(); 57 | return assemblies; 58 | } 59 | 60 | /// 61 | /// Only reads AssemblyParts and does not support external parts (aka Platform Extensions or TPEs). 62 | /// 63 | private static IEnumerable GetDeploymentParts(StreamResourceInfo xapStreamInfo) 64 | { 65 | Uri manifestUri = new Uri("AppManifest.xaml", UriKind.Relative); 66 | StreamResourceInfo manifestStreamInfo = Application.GetResourceStream(xapStreamInfo, manifestUri); 67 | List assemblyParts = new List(); 68 | 69 | // The code assumes the following format in AppManifest.xaml 70 | // 71 | // 72 | // 73 | // 74 | // ... 75 | // 76 | // 77 | // 78 | if (manifestStreamInfo != null) 79 | { 80 | Stream manifestStream = manifestStreamInfo.Stream; 81 | using (XmlReader reader = XmlReader.Create(manifestStream)) 82 | { 83 | if (reader.ReadToFollowing("AssemblyPart")) 84 | { 85 | do 86 | { 87 | string source = reader.GetAttribute("Source"); 88 | 89 | if (source != null) 90 | { 91 | assemblyParts.Add( 92 | new AssemblyPart { 93 | Source = source 94 | }); 95 | } 96 | } 97 | while (reader.ReadToNextSibling("AssemblyPart")); 98 | } 99 | } 100 | } 101 | 102 | return assemblyParts; 103 | } 104 | } 105 | } 106 | #endif -------------------------------------------------------------------------------- /SharedWebComponents/adjunct/System/Threading/Lock.cs: -------------------------------------------------------------------------------- 1 | namespace System.Threading 2 | { 3 | /// 4 | /// 5 | /// 6 | internal sealed class Lock : IDisposable 7 | { 8 | /// 9 | /// Generates a disposable object encapsulating a read lock. 10 | /// 11 | /// 12 | public IDisposable ForRead() 13 | { 14 | return new ReadLock(this); 15 | } 16 | 17 | /// 18 | /// Generates a disposable object encapsulating an upgradable read lock. 19 | /// 20 | /// 21 | public IDisposable ForReadUpgradable() 22 | { 23 | return new UpgradableReadLock(this); 24 | } 25 | 26 | /// 27 | /// Generates a disposable object encapsulating a write lock. 28 | /// 29 | /// 30 | public IDisposable ForWrite() 31 | { 32 | return new WriteLock(this); 33 | } 34 | 35 | #if (!SILVERLIGHT) 36 | private readonly ReaderWriterLockSlim _slim = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); 37 | private int _isDisposed; 38 | 39 | private void EnterReadLock() 40 | { 41 | _slim.EnterReadLock(); 42 | } 43 | 44 | private void EnterUpgradableReadLock() 45 | { 46 | _slim.EnterUpgradeableReadLock(); 47 | } 48 | 49 | private void EnterWriteLock() 50 | { 51 | _slim.EnterWriteLock(); 52 | } 53 | 54 | private void ExitReadLock() 55 | { 56 | _slim.ExitReadLock(); 57 | } 58 | 59 | private void ExitUpgradableReadLock() 60 | { 61 | _slim.ExitUpgradeableReadLock(); 62 | } 63 | 64 | private void ExitWriteLock() 65 | { 66 | _slim.ExitWriteLock(); 67 | } 68 | 69 | void IDisposable.Dispose() 70 | { 71 | if (Interlocked.CompareExchange(ref _isDisposed, 1, 0) == 0) 72 | { 73 | _slim.Dispose(); 74 | } 75 | } 76 | #else 77 | // ReaderWriterLockSlim is not yet implemented on SilverLight 78 | // Satisfies our requirements until it is implemented 79 | private readonly object _theLock = new object(); 80 | 81 | private void EnterReadLock() 82 | { 83 | Monitor.Enter(_theLock); 84 | } 85 | 86 | private void EnterUpgradableReadLock() 87 | { 88 | Monitor.Enter(_theLock); 89 | } 90 | 91 | private void EnterWriteLock() 92 | { 93 | Monitor.Enter(_theLock); 94 | } 95 | 96 | private void ExitReadLock() 97 | { 98 | Monitor.Exit(_theLock); 99 | } 100 | 101 | private void ExitUpgradableReadLock() 102 | { 103 | Monitor.Exit(_theLock); 104 | } 105 | 106 | private void ExitWriteLock() 107 | { 108 | Monitor.Exit(_theLock); 109 | } 110 | 111 | void IDisposable.Dispose() {} 112 | #endif 113 | 114 | internal struct ReadLock : IDisposable 115 | { 116 | private readonly Lock _lock; 117 | private int _isDisposed; 118 | 119 | internal ReadLock(Lock @lock) 120 | { 121 | _isDisposed = 0; 122 | _lock = @lock; 123 | _lock.EnterReadLock(); 124 | } 125 | 126 | void IDisposable.Dispose() 127 | { 128 | if (Interlocked.CompareExchange(ref _isDisposed, 1, 0) == 0) 129 | { 130 | _lock.ExitReadLock(); 131 | } 132 | } 133 | } 134 | 135 | internal struct UpgradableReadLock : IDisposable 136 | { 137 | private readonly Lock _lock; 138 | private int _isDisposed; 139 | 140 | internal UpgradableReadLock(Lock @lock) 141 | { 142 | _isDisposed = 0; 143 | _lock = @lock; 144 | _lock.EnterUpgradableReadLock(); 145 | } 146 | 147 | void IDisposable.Dispose() 148 | { 149 | if (Interlocked.CompareExchange(ref _isDisposed, 1, 0) == 0) 150 | { 151 | _lock.ExitUpgradableReadLock(); 152 | } 153 | } 154 | } 155 | 156 | internal struct WriteLock : IDisposable 157 | { 158 | private readonly Lock _lock; 159 | private int _isDisposed; 160 | 161 | internal WriteLock(Lock @lock) 162 | { 163 | _isDisposed = 0; 164 | _lock = @lock; 165 | _lock.EnterWriteLock(); 166 | } 167 | 168 | void IDisposable.Dispose() 169 | { 170 | if (Interlocked.CompareExchange(ref _isDisposed, 1, 0) == 0) 171 | { 172 | _lock.ExitWriteLock(); 173 | } 174 | } 175 | } 176 | 177 | } 178 | } -------------------------------------------------------------------------------- /SharedWebComponents/bin/SharedWebComponents.dll.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /SharedWebComponents/bin/System.Net.Http.Extensions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | System.Net.Http.Extensions 5 | 6 | 7 | 8 | 9 | Extension methods for which expose differences in platform specific capabilities. 10 | 11 | 12 | 13 | 14 | Gets a value that indicates if HttpClientHandler.AllowAutoRedirect is supported by the handler. 15 | When this property is true and HttpClientHandler.SupportsRedirectConfiguration is false, setting HttpClientHandler.AllowAutoRedirect to true will cause the system default to be used for HttpClientHandler.MaximumAutomaticRedirections. 16 | 17 | The to check. 18 | Returns .true if the if the handler supports configuration settings for the property; otherwise false. 19 | 20 | 21 | 22 | Gets a value that indicates if is supported by the handler. 23 | 24 | The to check. 25 | Returns .true if the if the handler supports configuration settings for the property; otherwise false. 26 | 27 | 28 | 29 | Gets a value that indicates if , HttpRequestMessage.ProtocolVersion, and HttpResponseMessage.ProtocolVersion are supported by the handler. 30 | 31 | The to check. 32 | Returns .true if the if the handler supports configuration settings for the , HttpRequestMessage.ProtocolVersion, and HttpResponseMessage.ProtocolVersion properties; otherwise false. 33 | 34 | 35 | 36 | Gets a value that indicates if HttpRequestMessage.Headers with or header value of 'chunked' is supported by the handler. 37 | 38 | The to check. 39 | Returns .true if the if the handler supports setting HttpRequestMessage.Headers with or header value of 'chunked'; otherwise false. 40 | 41 | 42 | 43 | Gets a value that indicates if is supported by the handler. 44 | When this property is true and HttpClientHandler.SupportsProxy is false, setting HttpClientHandler.UseProxy to true will cause the system default to be used for HttpClientHandler.Proxy. 45 | 46 | The to check. 47 | Returns .true if the if the handler supports configuration settings for the property; otherwise false. 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /SharedWebComponents/bin/System.Net.Http.Primitives.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | System.Net.Http.Primitives 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SharedWebComponents/bin/System.Web.Http.WebHost.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | System.Web.Http.WebHost 5 | 6 | 7 | 8 | Provides a global for ASP.NET applications. 9 | 10 | 11 | 12 | 13 | 14 | Gets the global . 15 | 16 | 17 | Extension methods for 18 | 19 | 20 | Maps the specified route template. 21 | A reference to the mapped route. 22 | A collection of routes for the application. 23 | The name of the route to map. 24 | The route template for the route. 25 | 26 | 27 | Maps the specified route template and sets default route. 28 | A reference to the mapped route. 29 | A collection of routes for the application. 30 | The name of the route to map. 31 | The route template for the route. 32 | An object that contains default route values. 33 | 34 | 35 | Maps the specified route template and sets default route values and constraints. 36 | A reference to the mapped route. 37 | A collection of routes for the application. 38 | The name of the route to map. 39 | The route template for the route. 40 | An object that contains default route values. 41 | A set of expressions that specify values for routeTemplate. 42 | 43 | 44 | Maps the specified route template and sets default route values, constraints, and end-point message handler. 45 | A reference to the mapped route. 46 | A collection of routes for the application. 47 | The name of the route to map. 48 | The route template for the route. 49 | An object that contains default route values. 50 | A set of expressions that specify values for routeTemplate. 51 | The handler to which the request will be dispatched. 52 | 53 | 54 | A that passes ASP.NET requests into the pipeline and write the result back. 55 | 56 | 57 | Initializes a new instance of the class. 58 | The route data. 59 | 60 | 61 | Initializes a new instance of the class. 62 | The route data. 63 | The message handler to dispatch requests to. 64 | 65 | 66 | Provides code that handles an asynchronous task 67 | The asynchronous task. 68 | The HTTP context. 69 | 70 | 71 | A that returns instances of that can pass requests to a given instance. 72 | 73 | 74 | Initializes a new instance of the class. 75 | 76 | 77 | Provides the object that processes the request. 78 | An object that processes the request. 79 | An object that encapsulates information about the request. 80 | 81 | 82 | Gets the singleton instance. 83 | 84 | 85 | Provides the object that processes the request. 86 | An object that processes the request. 87 | An object that encapsulates information about the request. 88 | 89 | 90 | Provides a registration point for the simple membership pre-application start code. 91 | 92 | 93 | Registers the simple membership pre-application start code. 94 | 95 | 96 | Represents the web host buffer policy selector. 97 | 98 | 99 | Initializes a new instance of the class. 100 | 101 | 102 | Gets a value that indicates whether the host should buffer the entity body of the HTTP request. 103 | true if buffering should be used; otherwise a streamed request should be used. 104 | The host context. 105 | 106 | 107 | Uses a buffered output stream for the web host. 108 | A buffered output stream. 109 | The response. 110 | 111 | 112 | Provides the catch blocks used within this assembly. 113 | 114 | 115 | Gets the label for the catch block in System.Web.Http.WebHost.HttpControllerHandler.WriteBufferedResponseContentAsync. 116 | The label for the catch block in System.Web.Http.WebHost.HttpControllerHandler.WriteBufferedResponseContentAsync. 117 | 118 | 119 | Gets the label for the catch block in System.Web.Http.WebHost.HttpControllerHandler.WriteErrorResponseContentAsync. 120 | The label for the catch block in System.Web.Http.WebHost.HttpControllerHandler.WriteErrorResponseContentAsync. 121 | 122 | 123 | Gets the label for the catch block in System.Web.Http.WebHost.HttpControllerHandler.ComputeContentLength. 124 | The label for the catch block in System.Web.Http.WebHost.HttpControllerHandler.ComputeContentLength. 125 | 126 | 127 | Gets the label for the catch block in System.Web.Http.WebHost.HttpControllerHandler.WriteStreamedResponseContentAsync. 128 | The label for the catch block in System.Web.Http.WebHost.HttpControllerHandler.WriteStreamedResponseContentAsync. 129 | 130 | 131 | Gets the label for the catch block in System.Web.Http.WebHost.WebHostExceptionCatchBlocks.HttpWebRoute.GetRouteData. 132 | The catch block in System.Web.Http.WebHost.WebHostExceptionCatchBlocks.HttpWebRoute.GetRouteData. 133 | 134 | 135 | -------------------------------------------------------------------------------- /SharedWebComponents/bin/System.Web.WebPages.Deployment.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | System.Web.WebPages.Deployment 5 | 6 | 7 | 8 | Provides a registration point for pre-application start code for Web Pages deployment. 9 | 10 | 11 | Registers pre-application start code for Web Pages deployment. 12 | 13 | 14 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Provides methods that are used to get deployment information about the Web application. 15 | 16 | 17 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets the assembly path for the Web Pages deployment. 18 | The assembly path for the Web Pages deployment. 19 | The Web Pages version. 20 | 21 | 22 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets the Web Pages version from the given binary path. 23 | The Web Pages version. 24 | The binary path for the Web Pages. 25 | 26 | 27 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets the assembly references from the given path regardless of the Web Pages version. 28 | The dictionary containing the assembly references of the Web Pages and its version. 29 | The path to the Web Pages application. 30 | 31 | 32 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets the maximum version of the Web Pages loaded assemblies. 33 | The maximum version of the Web Pages loaded assemblies. 34 | 35 | 36 | Gets the Web Pages version from the given path. 37 | The Web Pages version. 38 | The path of the root directory for the application. 39 | 40 | 41 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets the Web Pages version using the configuration settings with the specified path. 42 | The Web Pages version. 43 | The path to the application settings. 44 | 45 | 46 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Returns the assemblies for this Web Pages deployment. 47 | A list containing the assemblies for this Web Pages deployment. 48 | 49 | 50 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Indicates whether the Web Pages deployment is enabled. 51 | true if the Web Pages deployment is enabled; otherwise, false. 52 | The path to the Web Pages deployment. 53 | 54 | 55 | This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Indicates whether the Web Pages deployment is explicitly disabled. 56 | true if the Web Pages deployment is explicitly disabled; otherwise, false. 57 | The path to the Web Pages deployment. 58 | 59 | 60 | -------------------------------------------------------------------------------- /SharedWebComponents/obj/Debug/SharedWebComponents.csproj.App.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /SharedWebComponents/obj/Debug/SharedWebComponents.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\SharedWebComponents.dll.config 2 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\SharedWebComponents.dll 3 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\SharedWebComponents.pdb 4 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\Microsoft.Web.Infrastructure.dll 5 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\Newtonsoft.Json.dll 6 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\SharedWebComponents.Contracts.dll 7 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Net.Http.Extensions.dll 8 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Net.Http.Formatting.dll 9 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Net.Http.Primitives.dll 10 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Web.Helpers.dll 11 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Web.Http.dll 12 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Web.Http.WebHost.dll 13 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Web.Mvc.dll 14 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Web.Razor.dll 15 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Web.WebPages.Deployment.dll 16 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Web.WebPages.dll 17 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Web.WebPages.Razor.dll 18 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\SharedWebComponents.Contracts.pdb 19 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\Newtonsoft.Json.xml 20 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Net.Http.Extensions.xml 21 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Net.Http.Formatting.xml 22 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Net.Http.Primitives.xml 23 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Web.Helpers.xml 24 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Web.Http.xml 25 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Web.Http.WebHost.xml 26 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Web.Mvc.xml 27 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Web.Razor.xml 28 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Web.WebPages.xml 29 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Web.WebPages.Deployment.xml 30 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Web.WebPages.Razor.xml 31 | C:\dev\SharedWebComponentsMef\SharedWebComponents\obj\Debug\SharedWebComponents.csproj.App.config 32 | C:\dev\SharedWebComponentsMef\SharedWebComponents\obj\Debug\SharedWebComponents.csprojResolveAssemblyReference.cache 33 | C:\dev\SharedWebComponentsMef\SharedWebComponents\obj\Debug\SharedWebComponents.dll 34 | C:\dev\SharedWebComponentsMef\SharedWebComponents\obj\Debug\SharedWebComponents.pdb 35 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\Antlr3.Runtime.dll 36 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Web.Optimization.dll 37 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\WebGrease.dll 38 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\Antlr3.Runtime.pdb 39 | C:\dev\SharedWebComponentsMef\SharedWebComponents\bin\System.Web.Optimization.xml 40 | -------------------------------------------------------------------------------- /SharedWebComponents/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FNCSoftware/SharedWebComponentsMef/955e1579bcc8ffc043b1ee40b4e87276087e28a4/SharedWebComponents/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs -------------------------------------------------------------------------------- /SharedWebComponents/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FNCSoftware/SharedWebComponentsMef/955e1579bcc8ffc043b1ee40b4e87276087e28a4/SharedWebComponents/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs -------------------------------------------------------------------------------- /SharedWebComponents/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FNCSoftware/SharedWebComponentsMef/955e1579bcc8ffc043b1ee40b4e87276087e28a4/SharedWebComponents/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs -------------------------------------------------------------------------------- /SharedWebComponents/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /SharedWebComponentsMef.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedWebComponents", "SharedWebComponents\SharedWebComponents.csproj", "{E87880AF-E18A-422D-9EA0-D7694507602C}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedWebComponents.Contracts", "SharedWebComponents.Contracts\SharedWebComponents.Contracts.csproj", "{996766EC-10A6-4E2D-A020-216EE1E7AAD7}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client1.Page", "Client1.Page\Client1.Page.csproj", "{95E69488-23AB-4A0C-BBD8-62FD784B63E3}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client2.Page", "Client2.Page\Client2.Page.csproj", "{7B477CBD-BEE7-43E9-A7F6-FBDA0C41C91C}" 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {E87880AF-E18A-422D-9EA0-D7694507602C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {E87880AF-E18A-422D-9EA0-D7694507602C}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {E87880AF-E18A-422D-9EA0-D7694507602C}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {E87880AF-E18A-422D-9EA0-D7694507602C}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {996766EC-10A6-4E2D-A020-216EE1E7AAD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {996766EC-10A6-4E2D-A020-216EE1E7AAD7}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {996766EC-10A6-4E2D-A020-216EE1E7AAD7}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {996766EC-10A6-4E2D-A020-216EE1E7AAD7}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {95E69488-23AB-4A0C-BBD8-62FD784B63E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 29 | {95E69488-23AB-4A0C-BBD8-62FD784B63E3}.Debug|Any CPU.Build.0 = Debug|Any CPU 30 | {95E69488-23AB-4A0C-BBD8-62FD784B63E3}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {95E69488-23AB-4A0C-BBD8-62FD784B63E3}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {7B477CBD-BEE7-43E9-A7F6-FBDA0C41C91C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {7B477CBD-BEE7-43E9-A7F6-FBDA0C41C91C}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {7B477CBD-BEE7-43E9-A7F6-FBDA0C41C91C}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {7B477CBD-BEE7-43E9-A7F6-FBDA0C41C91C}.Release|Any CPU.Build.0 = Release|Any CPU 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | EndGlobal 41 | --------------------------------------------------------------------------------