Radical Documentation
View on GitHub
release-2
release-2
  • Home
  • Presentation
    • AbstractViewModel
    • Conventions
      • Bootstrap Conventions
      • Runtime Conventions
      • Conventions override
    • Commands and DelegateCommand
    • IViewResolver
      • Default view behaviors
      • view life cycle events
        • Callback expectations
        • notify messages
    • Message broker MVVM built-in messages
    • Application boot process
      • Application configuration
      • Application shutdown
      • Singleton applications
    • AbstractMementoViewModel
      • Simple ViewModel graphs
      • Collections and complex ViewModel graphs
    • Validation and Validation Services
    • Resources
      • Services as resources
      • ViewModels as resources
    • UI Composition
      • Region content lifecycle
      • TabControl region
      • Create a custom region
  • Concepts
    • Inversion of Control
      • Third party DI containers
    • Entities
      • Property System
    • Messaging and Message Broker
      • POCO messages
      • Standalone message handlers
    • Observers
      • PropertyObserver
      • MementoObserver
      • BrokerObserver
  • Memento
    • Change Tracking Service
      • MementoEntity and MementoEntityCollection
      • Handling change tracking:
        • Simple model
        • Collections
        • Complex objects graph
      • Atomic operations
      • Change Tracking Service API
      • Property Metadata for the ChangeTrackingService
      • Handling collection sync
      • Property State
  • Behaviors
    • DataGrid Behaviors
    • Password
    • Generic routed event handler to command behavior
    • Overlay adorner
      • Busy status manager
    • TextBox behaviors:
      • Command
      • Auto select
      • DisableUndoManager (.Net 3.5 only)
  • Markup Extensions
    • Editor binding
    • Auto Command binding
  • How to
    • Get the view of a given view model
    • Bi-directional communication between different windows/views
    • Handle the busy status during async/long running operations
    • Implement a customer improvement program
    • Manage focus
    • Create a splash screen
    • Access view model after view is closed
    • Intercept ViewModels before they are used
  • Upgrade guides
    • Radical Presentation 1.x to Radical 2.x for .NET Core
Powered by GitBook
On this page
  1. Presentation
  2. Conventions

Bootstrap Conventions

As we have already said the whole bootstrap process is completely based on conventions, especially the IoC container setup. Bootstrap conventions are mainly related to the way components are registered into the container:

  • every class that is defined in a namespace ending with Services (*.Services) will be considered a service and will be registered as singleton using as the service contract the first interface, if any, otherwise using the class type;

  • every class that is defined in a namespace ending with Presentation (*.Presentation) and whose type name ends with ViewModel (*ViewModel) will be considered as a view model and registered as transient;

    • following the same logic every type in the same namespace whose name ends with View (*View) will be considered a view, a transient view;

    • if a view or a view model are a shell, type name beginning with Shell* or Main*, they will be registered as singleton

    • be default views and view models will be registered using as service contract the class type and no interface is searched along the way;

  • every type defined in a namespace ending with Messaging.Handlers (*.Messaging.Handlers) will be considered a message broker message handler and will be registered as singleton and automatically attached, as an handler, to the broker pipeline;

These are the main conventions used at boot time, there are a few more but less important. Obviously all these behaviors can be replaced or extended to accomplish the end user needs:

public partial class App : Application
{
    public App()
    {
        this.AddRadicalApplication<MainView>(configuration => 
        {
           configuration.BootstrapConventions.IsViewModel = type => 
           {
              if (type.Namespace == "MyViewModelsNamespace") 
              {
                 return true;
              }

              return configuration.BootstrapConventions.DefaultIsViewModel(type);
            };
         });
    }
}

In the above sample we are integrating the conventions used to determine if a type is a view model.

PreviousConventionsNextRuntime Conventions

Last updated 4 years ago