Permalink
Browse files

Initial implementation sketch. Updated solution to restore packages.

  • Loading branch information...
Haacked committed Oct 12, 2011
1 parent 7229675 commit 4e813cd9f98a254f64082d71551dab8b542daf6d
Showing with 1,287 additions and 1 deletion.
  1. +1 −1 .gitignore
  2. BIN src/.nuget/NuGet.exe
  3. +41 −0 src/.nuget/NuGet.settings.targets
  4. +15 −0 src/.nuget/NuGet.targets
  5. +75 −0 src/WebBackgrounder.DemoWeb/Content/Site.css
  6. +10 −0 src/WebBackgrounder.DemoWeb/Controllers/HomeController.cs
  7. +1 −0 src/WebBackgrounder.DemoWeb/Global.asax
  8. +35 −0 src/WebBackgrounder.DemoWeb/Global.asax.cs
  9. +35 −0 src/WebBackgrounder.DemoWeb/Properties/AssemblyInfo.cs
  10. +9 −0 src/WebBackgrounder.DemoWeb/Views/Home/Index.cshtml
  11. +15 −0 src/WebBackgrounder.DemoWeb/Views/Shared/Error.cshtml
  12. +11 −0 src/WebBackgrounder.DemoWeb/Views/Shared/_Layout.cshtml
  13. +58 −0 src/WebBackgrounder.DemoWeb/Views/Web.config
  14. +3 −0 src/WebBackgrounder.DemoWeb/Views/_ViewStart.cshtml
  15. +30 −0 src/WebBackgrounder.DemoWeb/Web.Debug.config
  16. +31 −0 src/WebBackgrounder.DemoWeb/Web.Release.config
  17. +54 −0 src/WebBackgrounder.DemoWeb/Web.config
  18. +125 −0 src/WebBackgrounder.DemoWeb/WebBackgrounder.DemoWeb.csproj
  19. +10 −0 src/WebBackgrounder.EntityFramework/Entities/Job.cs
  20. +7 −0 src/WebBackgrounder.EntityFramework/Entities/JobContext.cs
  21. +82 −0 src/WebBackgrounder.EntityFramework/EntityJobRepository.cs
  22. +37 −0 src/WebBackgrounder.EntityFramework/IJobRepository.cs
  23. +9 −0 src/WebBackgrounder.EntityFramework/JobStatus.cs
  24. +36 −0 src/WebBackgrounder.EntityFramework/Properties/AssemblyInfo.cs
  25. +77 −0 src/WebBackgrounder.EntityFramework/WebBackgrounder.EntityFramework.csproj
  26. +54 −0 src/WebBackgrounder.EntityFramework/WebFarmJobCoordinator.cs
  27. +4 −0 src/WebBackgrounder.EntityFramework/packages.config
  28. +39 −0 src/WebBackgrounder.UnitTests/AspNetTaskHostFacts.cs
  29. +36 −0 src/WebBackgrounder.UnitTests/Properties/AssemblyInfo.cs
  30. +33 −0 src/WebBackgrounder.UnitTests/TaskManagerFacts.cs
  31. +79 −0 src/WebBackgrounder.UnitTests/WebBackgrounder.UnitTests.csproj
  32. +5 −0 src/WebBackgrounder.UnitTests/WebFarmJobCoordinatorFacts.cs
  33. +5 −0 src/WebBackgrounder.UnitTests/packages.config
  34. +20 −0 src/WebBackgrounder/AspNetTaskHost.cs
  35. +9 −0 src/WebBackgrounder/IJobCoordinator.cs
  36. +8 −0 src/WebBackgrounder/ITask.cs
  37. +10 −0 src/WebBackgrounder/ITaskHost.cs
  38. +36 −0 src/WebBackgrounder/Properties/AssemblyInfo.cs
  39. +42 −0 src/WebBackgrounder/TaskManager.cs
  40. +62 −0 src/WebBackgrounder/WebBackgrounder.csproj
  41. +38 −0 src/WebBackgrounderSolution.sln
View
@@ -4,4 +4,4 @@ obj
*.suo
App_Data
*.results.xml
-/packages
+/src/packages
View
Binary file not shown.
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
+ <NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
+ <NuGetExePath>$(NuGetToolsPath)\nuget.exe</NuGetExePath>
+ <PackagesConfig>$(ProjectDir)packages.config</PackagesConfig>
+ <PackagesDir>$(SolutionDir)packages</PackagesDir>
+ <PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
+
+ <!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
+ <PackageSources>""</PackageSources>
+
+ <!-- Enable the restore command to run before builds -->
+ <RestorePackages Condition="$(RestorePackages) == ''">false</RestorePackages>
+
+ <!-- Property that enables building a package from a project -->
+ <BuildPackage Condition="$(BuildPackage) == ''">false</BuildPackage>
+
+ <!-- Commands -->
+ <RestoreCommand>"$(NuGetExePath)" install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)"</RestoreCommand>
+ <BuildCommand>"$(NuGetExePath)" pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
+
+ <!-- Make the build depend on restore packages -->
+ <BuildDependsOn Condition="$(RestorePackages) == 'true'">
+ RestorePackages;
+ $(BuildDependsOn);
+ </BuildDependsOn>
+
+ <!-- Make the build depend on restore packages -->
+ <BuildDependsOn Condition="$(BuildPackage) == 'true'">
+ $(BuildDependsOn);
+ BuildPackage;
+ </BuildDependsOn>
+ </PropertyGroup>
+
+ <Target Name="CheckPrerequisites">
+ <!-- Raise an error if we're unable to locate nuget.exe -->
+ <Error Condition="!Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
+ </Target>
+</Project>
View
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="NuGet.settings.targets"/>
+
+ <Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
+ <Exec Command="$(RestoreCommand)"
+ LogStandardErrorAsError="true"
+ Condition="Exists('$(PackagesConfig)')" />
+ </Target>
+
+ <Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
+ <Exec Command="$(BuildCommand)"
+ LogStandardErrorAsError="true" />
+ </Target>
+</Project>
@@ -0,0 +1,75 @@
+body
+{
+ font-size: .85em;
+ font-family: "Trebuchet MS", Verdana, Helvetica, Sans-Serif;
+ color: #232323;
+ background-color: #fff;
+}
+
+header,
+footer,
+nav,
+section {
+ display: block;
+}
+
+/* Styles for basic forms
+-----------------------------------------------------------*/
+
+fieldset
+{
+ border:1px solid #ddd;
+ padding:0 1.4em 1.4em 1.4em;
+ margin:0 0 1.5em 0;
+}
+
+legend
+{
+ font-size:1.2em;
+ font-weight: bold;
+}
+
+textarea
+{
+ min-height: 75px;
+}
+
+.editor-label
+{
+ margin: 1em 0 0 0;
+}
+
+.editor-field
+{
+ margin:0.5em 0 0 0;
+}
+
+
+/* Styles for validation helpers
+-----------------------------------------------------------*/
+.field-validation-error
+{
+ color: #ff0000;
+}
+
+.field-validation-valid
+{
+ display: none;
+}
+
+.input-validation-error
+{
+ border: 1px solid #ff0000;
+ background-color: #ffeeee;
+}
+
+.validation-summary-errors
+{
+ font-weight: bold;
+ color: #ff0000;
+}
+
+.validation-summary-valid
+{
+ display: none;
+}
@@ -0,0 +1,10 @@
+using System.Web.Mvc;
+
+namespace WebBackgrounder.DemoWeb.Controllers {
+ public class HomeController : Controller {
+ public ActionResult Index() {
+ return View();
+ }
+
+ }
+}
@@ -0,0 +1 @@
+<%@ Application Codebehind="Global.asax.cs" Inherits="WebBackgrounder.DemoWeb.MvcApplication" Language="C#" %>
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using System.Web.Routing;
+
+namespace WebBackgrounder.DemoWeb {
+ // Note: For instructions on enabling IIS6 or IIS7 classic mode,
+ // visit http://go.microsoft.com/?LinkId=9394801
+
+ public class MvcApplication : System.Web.HttpApplication {
+ public static void RegisterGlobalFilters(GlobalFilterCollection filters) {
+ filters.Add(new HandleErrorAttribute());
+ }
+
+ public static void RegisterRoutes(RouteCollection routes) {
+ routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
+
+ routes.MapRoute(
+ "Default", // Route name
+ "{controller}/{action}/{id}", // URL with parameters
+ new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
+ );
+
+ }
+
+ protected void Application_Start() {
+ AreaRegistration.RegisterAllAreas();
+
+ RegisterGlobalFilters(GlobalFilters.Filters);
+ RegisterRoutes(RouteTable.Routes);
+ }
+ }
+}
@@ -0,0 +1,35 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("WebBackgrounder.DemoWeb")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("WebBackgrounder.DemoWeb")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("9ca43cf3-f32e-4151-b218-345a3502e24a")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,9 @@
+@{
+ ViewBag.Title = "Index";
+}
+
+<h2>WebBackgrounder Demo Site</h2>
+
+<p>
+This site is used to test and demonstrate WebBackgrounder
+</p>
@@ -0,0 +1,15 @@
+@{
+ Layout = null;
+}
+
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Error</title>
+</head>
+<body>
+ <h2>
+ Sorry, an error occurred while processing your request.
+ </h2>
+</body>
+</html>
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>@ViewBag.Title</title>
+ <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
+</head>
+
+<body>
+ @RenderBody()
+</body>
+</html>
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+
+<configuration>
+ <configSections>
+ <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
+ <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
+ </sectionGroup>
+ </configSections>
+
+ <system.web.webPages.razor>
+ <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
+ <pages pageBaseType="System.Web.Mvc.WebViewPage">
+ <namespaces>
+ <add namespace="System.Web.Mvc" />
+ <add namespace="System.Web.Mvc.Ajax" />
+ <add namespace="System.Web.Mvc.Html" />
+ <add namespace="System.Web.Routing" />
+ </namespaces>
+ </pages>
+ </system.web.webPages.razor>
+
+ <appSettings>
+ <add key="webpages:Enabled" value="false" />
+ </appSettings>
+
+ <system.web>
+ <httpHandlers>
+ <add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
+ </httpHandlers>
+
+ <!--
+ Enabling request validation in view pages would cause validation to occur
+ after the input has already been processed by the controller. By default
+ MVC performs request validation before a controller processes the input.
+ To change this behavior apply the ValidateInputAttribute to a
+ controller or action.
+ -->
+ <pages
+ validateRequest="false"
+ pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
+ pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
+ userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ <controls>
+ <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
+ </controls>
+ </pages>
+ </system.web>
+
+ <system.webServer>
+ <validation validateIntegratedModeConfiguration="false" />
+
+ <handlers>
+ <remove name="BlockViewHandler"/>
+ <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
+ </handlers>
+ </system.webServer>
+</configuration>
@@ -0,0 +1,3 @@
+@{
+ Layout = "~/Views/Shared/_Layout.cshtml";
+}
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+
+<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
+
+<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
+ <!--
+ In the example below, the "SetAttributes" transform will change the value of
+ "connectionString" to use "ReleaseSQLServer" only when the "Match" locator
+ finds an atrribute "name" that has a value of "MyDB".
+
+ <connectionStrings>
+ <add name="MyDB"
+ connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
+ xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
+ </connectionStrings>
+ -->
+ <system.web>
+ <!--
+ In the example below, the "Replace" transform will replace the entire
+ <customErrors> section of your web.config file.
+ Note that because there is only one customErrors section under the
+ <system.web> node, there is no need to use the "xdt:Locator" attribute.
+
+ <customErrors defaultRedirect="GenericError.htm"
+ mode="RemoteOnly" xdt:Transform="Replace">
+ <error statusCode="500" redirect="InternalError.htm"/>
+ </customErrors>
+ -->
+ </system.web>
+</configuration>
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+
+<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
+
+<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
+ <!--
+ In the example below, the "SetAttributes" transform will change the value of
+ "connectionString" to use "ReleaseSQLServer" only when the "Match" locator
+ finds an atrribute "name" that has a value of "MyDB".
+
+ <connectionStrings>
+ <add name="MyDB"
+ connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
+ xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
+ </connectionStrings>
+ -->
+ <system.web>
+ <compilation xdt:Transform="RemoveAttributes(debug)" />
+ <!--
+ In the example below, the "Replace" transform will replace the entire
+ <customErrors> section of your web.config file.
+ Note that because there is only one customErrors section under the
+ <system.web> node, there is no need to use the "xdt:Locator" attribute.
+
+ <customErrors defaultRedirect="GenericError.htm"
+ mode="RemoteOnly" xdt:Transform="Replace">
+ <error statusCode="500" redirect="InternalError.htm"/>
+ </customErrors>
+ -->
+ </system.web>
+</configuration>
Oops, something went wrong.

0 comments on commit 4e813cd

Please sign in to comment.