Request For Change: Make GetView method of Bxf.ViewFactory class virtual

Developer
Nov 15, 2010 at 9:50 AM

I have a scenario where I would like to re-use the core logic of the ViewFactory class and extend it a little.

To this end, the proposal to change the following method declaration in the Bxf.ViewFactory class:

Current:

    /// <summary>
    /// Creates a populated IView object, including
    /// the instance of the view.
    /// </summary>
    /// <param name="viewName">Name of the view.</param>
    /// <param name="bindingResourceKey">Name of the binding resource.</param>
    /// <param name="model">Reference to the model or viewmodel for the view.</param>
    public IView GetView(string viewName, string bindingResourceKey, object model)
    {
      return new View(viewName, CreateUserControl(viewName), bindingResourceKey, model);
    }

Proposed:

    /// <summary>
    /// Creates a populated IView object, including
    /// the instance of the view.
    /// </summary>
    /// <param name="viewName">Name of the view.</param>
    /// <param name="bindingResourceKey">Name of the binding resource.</param>
    /// <param name="model">Reference to the model or viewmodel for the view.</param>
    public virtual IView GetView(string viewName, string bindingResourceKey, object model)
    {
      return new View(viewName, CreateUserControl(viewName), bindingResourceKey, model);
    }

NB: Rocky, I'd be happy to make the change and check it in, provided you agree with the change.

Regards,
Jaans

Coordinator
Nov 15, 2010 at 6:29 PM

This is fine with me. I didn't anticipate that people would use and extend the existing functionality (as it isn't complex) as much as just create their own IViewFactory implementation. But if you think there's value in extending the existing class, I'm fine with that.

Developer
Nov 15, 2010 at 11:23 PM
Edited Nov 15, 2010 at 11:24 PM

Thanks Rocky

Done and checked-in - http://bxf.codeplex.com/workitem/29446/