Fork me on GitHub
Blog
The journal that this archive was targeting has been deleted. Please update your configuration.
« View Reference | Main | Controller »
Wednesday
Oct102012

Container

The container contains the controller and the main views, and it's in charge of behavior binding by dynamically mapping Behaviors to Views. Depending on runtime conditions such as the role of the current user or any other application level variables the container would bind a Behavior Reference (BR) to a View Reference (VR) which translates later to a Transition Event.
public partial class Container {

    protected override void OnBehaviorBinding()
    {
        base.OnBehaviorBinding();

        // runtime conditional application context
        var isAdminRole = false;

        //dynamic behavior binding
        if(isAdminRole) 
            base.BehaviorBinding.Add(
                BehaviorReference.OpenHomeBehavior, 
                ViewReference.HomeAdminView);
        else 
            base.BehaviorBinding.Add(
                BehaviorReference.OpenHomeBehavior, 
                ViewReference.HomeView);

        base.BehaviorBinding.Add(
            BehaviorReference.OpenStudentProfileBehavior, 
            ViewReference.StudentProfileView);

    }
}

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>