protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            PortableAreaRegistration.RegisterEmbeddedViewEngine();

            RegisterRoutes(RouteTable.Routes);
        }
        private static string GetLastDBScriptVersion(PortableAreaRegistration portableArea)
        {
            string[] resources = Assembly.GetAssembly(portableArea.GetType()).GetManifestResourceNames();

            //eg: Appleseed.Core.DBScripts._20110413.01. Create_DBVersion_Table.sql

            var dbversions = resources.Where(d => d.Contains(".sql")).Select(d => d.Substring(d.IndexOf("._") + 2, 11));

            return(dbversions.OrderBy(d => d).LastOrDefault());
        }
Beispiel #3
0
        protected void Application_Start()
        {
            /*AreaRegistration.RegisterAllAreas();*/
            AreaRegistrationUtil.RegisterAreasForAssemblyOf <CommonAreaRegistration>();

            //Portable areas configuration
            PortableAreaRegistration.RegisterEmbeddedViewEngine();

            RegisterGlobalFilters(GlobalFilters.Filters);

            RegisterRoutes(RouteTable.Routes);
        }
        public static void RegisterScripts(this PortableAreaRegistration portableArea, System.Web.Mvc.AreaRegistrationContext context, MvcContrib.PortableAreas.IApplicationBus bus)
        {
            bus.Send(new BusMessage {
                Message = portableArea.AreaName + " registered"
            });

            bus.Send(new DBScriptsMessage
            {
                AreaName    = portableArea.AreaName,
                LastVersion = GetLastDBScriptVersion(portableArea),
                Scripts     = GetScripts(portableArea)
            });
        }
 /// <summary>
 /// Register the received area with the associated context while ignoring potential exception
 /// about already registered area.
 /// </summary>
 public static void Register(PortableAreaRegistration areaRegistration, AreaRegistrationContext registrationContext)
 {
     try
     {
         areaRegistration.RegisterArea(registrationContext);
     }
     catch (ArgumentException e)
     {
         if (!e.Message.Contains("An item with the same key has already been added."))
         {
             throw;
         }
     }
 }
Beispiel #6
0
 public AreaRegistrationHelper(PortableAreaRegistration protablAreaRegistration, AreaRegistrationContext context)
 {
     if (protablAreaRegistration == null)
     {
         throw new ArgumentNullException("protablAreaRegistration");
     }
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     _protablAreaRegistration = protablAreaRegistration;
     _context = context;
     protablAreaRegistration.EmbedResourceRegisted += protablAreaRegistration_RegistedEmbedResource;
 }
        private static List <DBScriptDescriptor> GetScripts(PortableAreaRegistration portableArea)
        {
            string[] resources = Assembly.GetAssembly(portableArea.GetType()).GetManifestResourceNames();

            var result = new List <DBScriptDescriptor>();

            foreach (var resource in resources.Where(d => d.Contains(".sql")))
            {
                var version = resource.Substring(resource.IndexOf("._") + 2, 11).Replace(".", "_");

                result.Add(new DBScriptDescriptor {
                    Url = resource, Version = version
                });
            }

            return(result);
        }
Beispiel #8
0
        public override void RegisterRoutes(RouteCollection routes)
        {
            AreaRegistration.RegisterAllAreas();

            PortableAreaRegistration.RegisterEmbeddedViewEngine();
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                namespaces: new[] { typeof(HomeController).Namespace }
                );
        }
Beispiel #9
0
        protected void Application_Start()
        {
            //Configure logging
            XmlConfigurator.Configure();
            ClassLogger.Configure();

            AreaRegistration.RegisterAllAreas();

            PortableAreaRegistration.RegisterEmbeddedViewEngine();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            new TagCategoryManager().CreateDefaultCategories();
            RoleBusinessLogic.CreateRolesAndNavigationInfo();

            TenantHelper.TenantCreated += TenantHelperOnTenantCreated;
            ContextRoleRegister.RegisteredRoles.Add("ItemRegistration", RoleFlags.TenantOwner);
            ContextRoleRegister.RegisteredRoles.Add("InviteUser", RoleFlags.OwnerAndTenantOwners);
        }
        private void RegisterTestArea(PortableAreaRegistration areaRegistration, string areaName)
        {
            var registrationContext = new AreaRegistrationContext(areaName, new RouteCollection());

            TestingAreaRegistration.Register(areaRegistration, registrationContext);
        }