Commits

davidebbo committed 4de5072

Renamed a couple files to match class names

  • Participants
  • Parent commits 36c1e91

Comments (0)

Files changed (4)

File TestLibrary/MyStartupCode.cs

+using System.Web.Mvc;
+using System.Web.Routing;
+
+[assembly: WebActivator.PreApplicationStartMethod(typeof(TestLibrary.MyStartupCode), "Start")]
+[assembly: WebActivator.PreApplicationStartMethod(typeof(TestLibrary.MyStartupCode), "Start2")]
+[assembly: WebActivator.PreApplicationStartMethod(typeof(TestLibrary.MyStartupCode), "CallMeAfterAppStart", callAfterGlobalAppStart: true)]
+
+namespace TestLibrary {
+    public static class MyStartupCode {
+        private static bool _startCalled;
+        private static bool _start2Called;
+        private static bool _callMeAfterAppStartCalled;
+
+        internal static void Start() {
+            _startCalled = true;
+
+            var routes = RouteTable.Routes;
+
+            routes.MapRoute(
+                "Bar", // Route name
+                "CoolAbout", // URL with parameters
+                new { controller = "Home", action = "About", id = UrlParameter.Optional } // Parameter defaults
+            );
+        }
+
+        public static void Start2() {
+            _start2Called = true;
+
+            var routes = RouteTable.Routes;
+
+            routes.MapRoute(
+                "Bar2", // Route name
+                "CoolAbout2", // URL with parameters
+                new { controller = "Home", action = "About", id = UrlParameter.Optional } // Parameter defaults
+            );
+        }
+
+        public static void CallMeAfterAppStart() {
+            // This gets called after global.asax's Application_Start
+
+            _callMeAfterAppStartCalled = true;
+        }
+
+        // Called by the unit test
+        public static bool AllStartMethodsWereCalled() {
+            return _startCalled && _start2Called && _callMeAfterAppStartCalled;
+        }
+    }
+}

File TestLibrary/MyStartupCode2.cs

-using System.Web.Mvc;
-using System.Web.Routing;
-
-[assembly: WebActivator.PreApplicationStartMethod(typeof(TestLibrary.MyStartupCode), "Start")]
-[assembly: WebActivator.PreApplicationStartMethod(typeof(TestLibrary.MyStartupCode), "Start2")]
-[assembly: WebActivator.PreApplicationStartMethod(typeof(TestLibrary.MyStartupCode), "CallMeAfterAppStart", callAfterGlobalAppStart: true)]
-
-namespace TestLibrary {
-    public static class MyStartupCode {
-        private static bool _startCalled;
-        private static bool _start2Called;
-        private static bool _callMeAfterAppStartCalled;
-
-        internal static void Start() {
-            _startCalled = true;
-
-            var routes = RouteTable.Routes;
-
-            routes.MapRoute(
-                "Bar", // Route name
-                "CoolAbout", // URL with parameters
-                new { controller = "Home", action = "About", id = UrlParameter.Optional } // Parameter defaults
-            );
-        }
-
-        public static void Start2() {
-            _start2Called = true;
-
-            var routes = RouteTable.Routes;
-
-            routes.MapRoute(
-                "Bar2", // Route name
-                "CoolAbout2", // URL with parameters
-                new { controller = "Home", action = "About", id = UrlParameter.Optional } // Parameter defaults
-            );
-        }
-
-        public static void CallMeAfterAppStart() {
-            // This gets called after global.asax's Application_Start
-
-            _callMeAfterAppStartCalled = true;
-        }
-
-        // Called by the unit test
-        public static bool AllStartMethodsWereCalled() {
-            return _startCalled && _start2Called && _callMeAfterAppStartCalled;
-        }
-    }
-}

File WebActivator/ActivationManager.cs

+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using System.Web;
+using System.Web.Hosting;
+
+namespace WebActivator {
+    public class ActivationManager {
+        static List<PreApplicationStartMethodAttribute> attribsToCallAfterStart = new List<PreApplicationStartMethodAttribute>();
+        private static object initLock = new object();
+        private static bool hasInited;
+
+        public static void Run() {
+            lock (initLock) {
+                if (!hasInited) {
+                    // Go through all the bin assemblies
+                    foreach (var assemblyFile in GetAssemblyFiles()) {
+                        var assembly = Assembly.LoadFrom(assemblyFile);
+
+                        // Go through all the PreApplicationStartMethodAttribute attributes
+                        // Note that this is *our* attribute, not the System.Web namesake
+                        foreach (PreApplicationStartMethodAttribute preStartAttrib in assembly.GetCustomAttributes(
+                            typeof(PreApplicationStartMethodAttribute),
+                            inherit: false)) {
+
+                            // If it asks to be called after global.asax App_Start, keep track of the method. Otherwise call it now
+                            if (preStartAttrib.CallAfterGlobalAppStart && HostingEnvironment.IsHosted) {
+                                attribsToCallAfterStart.Add(preStartAttrib);
+                            }
+                            else {
+                                // Invoke the method that the attribute points to
+                                preStartAttrib.InvokeMethod();
+                            }
+                        }
+                    }
+
+                    // If any method needs to be called later, register our module to do it
+                    if (attribsToCallAfterStart.Count > 0) {
+                        Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleUtility.RegisterModule(typeof(StartMethodCallingModule));
+                    }
+
+                    hasInited = true;
+                }
+            }
+        }
+
+        private static IEnumerable<string> GetAssemblyFiles() {
+            // When running under ASP.NET, find assemblies in the bin folder.
+            // Outside of ASP.NET, use whatever folder WebActivator itself is in
+            string directory = HostingEnvironment.IsHosted 
+                ? HttpRuntime.BinDirectory 
+                : Path.GetDirectoryName(typeof(ActivationManager).Assembly.Location);
+            return Directory.GetFiles(directory, "*.dll");
+        }
+
+        class StartMethodCallingModule : IHttpModule {
+            private static object initLock = new object();
+            private static bool hasInited;
+
+            public void Init(HttpApplication context) {
+                // Make sure we only call the methods once per app domain
+                lock (initLock) {
+                    if (!hasInited) {
+                        attribsToCallAfterStart.ForEach(a => a.InvokeMethod());
+                        hasInited = true;
+                    }
+                }
+            }
+
+            public void Dispose() {
+            }
+        }
+    }
+}

File WebActivator/PreApplicationStartCode.cs

-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Reflection;
-using System.Web;
-using System.Web.Hosting;
-
-namespace WebActivator {
-    public class ActivationManager {
-        static List<PreApplicationStartMethodAttribute> attribsToCallAfterStart = new List<PreApplicationStartMethodAttribute>();
-        private static object initLock = new object();
-        private static bool hasInited;
-
-        public static void Run() {
-            lock (initLock) {
-                if (!hasInited) {
-                    // Go through all the bin assemblies
-                    foreach (var assemblyFile in GetAssemblyFiles()) {
-                        var assembly = Assembly.LoadFrom(assemblyFile);
-
-                        // Go through all the PreApplicationStartMethodAttribute attributes
-                        // Note that this is *our* attribute, not the System.Web namesake
-                        foreach (PreApplicationStartMethodAttribute preStartAttrib in assembly.GetCustomAttributes(
-                            typeof(PreApplicationStartMethodAttribute),
-                            inherit: false)) {
-
-                            // If it asks to be called after global.asax App_Start, keep track of the method. Otherwise call it now
-                            if (preStartAttrib.CallAfterGlobalAppStart && HostingEnvironment.IsHosted) {
-                                attribsToCallAfterStart.Add(preStartAttrib);
-                            }
-                            else {
-                                // Invoke the method that the attribute points to
-                                preStartAttrib.InvokeMethod();
-                            }
-                        }
-                    }
-
-                    // If any method needs to be called later, register our module to do it
-                    if (attribsToCallAfterStart.Count > 0) {
-                        Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleUtility.RegisterModule(typeof(StartMethodCallingModule));
-                    }
-
-                    hasInited = true;
-                }
-            }
-        }
-
-        private static IEnumerable<string> GetAssemblyFiles() {
-            // When running under ASP.NET, find assemblies in the bin folder.
-            // Outside of ASP.NET, use whatever folder WebActivator itself is in
-            string directory = HostingEnvironment.IsHosted 
-                ? HttpRuntime.BinDirectory 
-                : Path.GetDirectoryName(typeof(ActivationManager).Assembly.Location);
-            return Directory.GetFiles(directory, "*.dll");
-        }
-
-        class StartMethodCallingModule : IHttpModule {
-            private static object initLock = new object();
-            private static bool hasInited;
-
-            public void Init(HttpApplication context) {
-                // Make sure we only call the methods once per app domain
-                lock (initLock) {
-                    if (!hasInited) {
-                        attribsToCallAfterStart.ForEach(a => a.InvokeMethod());
-                        hasInited = true;
-                    }
-                }
-            }
-
-            public void Dispose() {
-            }
-        }
-    }
-}