private void Initialize()
        {
            ControllerTree tree = (ControllerTree)Kernel["mvc.controllerTree"];

            if (_assembly != null)
            {
                Type[] types = _assembly.GetExportedTypes();

                foreach (Type type in types)
                {
                    // Web page / UserControl
                    if (type.IsSubclassOf(typeof(WebFormView)) || type.IsSubclassOf(typeof(WebUserControlView)))
                    {
                        // Retrieve the properties controllers
                        PropertyInfo[] properties = type.GetProperties(BINDING_FLAGS_SET);
                        for (int i = 0; i < properties.Length; i++)
                        {
                            if (properties[i].PropertyType.IsSubclassOf(typeof(Controller)))
                            {
                                tree.AddController(type, properties[i], properties[i].PropertyType);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        private void OnComponentModelCreated(ComponentModel model)
        {
            bool isController = typeof(Controller).IsAssignableFrom(model.Implementation);

            if (!isController && !typeof(ViewComponent).IsAssignableFrom(model.Implementation))
            {
                return;
            }

            // Ensure it's transient
            model.LifestyleType = LifestyleType.Transient;

            if (isController)
            {
                ControllerDescriptor descriptor = ControllerInspectionUtil.Inspect(model.Implementation);

                _tree.AddController(descriptor.Area, descriptor.Name, model.Name);
            }
        }
Esempio n. 3
0
 public void OnBlogAdded(Blog blog)
 {
     _controllerTree.AddController(String.Empty, blog.Author.Login, "blogs.controller");
 }