Ejemplo n.º 1
0
 internal void AddRequiredBy(ControllerType controller)
 {
     requiredBy.Add(controller);
     controller.Register(this);
 }
Ejemplo n.º 2
0
 internal void AddProvider(ControllerType controller)
 {
     providers.Add(controller);
     controller.Register(this);
 }
Ejemplo n.º 3
0
 internal void AddDependents(ControllerType controller)
 {
     dependents.Add(controller);
     controller.Register(this);
 }
Ejemplo n.º 4
0
        //internal void Register(Controller controller)
        //{
        //    controllers.Add(controller);
        //    controller.Type.Register(controller);
        //    foreach (string resourceName in controller.Type.Provides)
        //        lookupResource(resourceName).AddProvider(controller.Type);
        //    foreach (string resourceName in controller.Type.Requires)
        //        lookupResource(resourceName).AddRequiredBy(controller.Type);
        //    foreach (string resourceName in controller.Type.DependsOn)
        //        lookupResource(resourceName).AddDependents(controller.Type);
        //}

        internal void Register(Binding binding,ControllerType ctrType, string methodUrl)
        {
            foreach (Controller ctr in controllers)
            {
                if (ctr.Type == ctrType)
                    return;
            }
            Controller controller = new Controller(binding, ctrType, methodUrl);
            controllers.Add(controller);
            ctrType.Register(controller);
            foreach (string resourceName in controller.Type.Provides)
                lookupResource(resourceName).AddProvider(controller.Type);
            foreach (string resourceName in controller.Type.Requires)
                lookupResource(resourceName).AddRequiredBy(controller.Type);
            foreach (string resourceName in controller.Type.DependsOn)
                lookupResource(resourceName).AddDependents(controller.Type);
        }