Sdl.Web.Common/Models/ModelTypeRegistry.cs
/// <summary>
/// Get the View Model Type for a given View.
/// </summary>
/// <param name="viewData">The data for the View.</param>
/// <returns>The View Model Type.</returns>
Get the View Model Type for a given View.
Get the View Model Type for a given View .
public static Type GetViewModelType(MvcData viewData)
        {
            Type modelType;
            MvcData bareMvcData = new MvcData
            {
                AreaName = viewData.AreaName,
                ControllerName = viewData.ControllerName,
                ViewName = viewData.ViewName
            };
            if (!_viewToModelTypeMapping.TryGetValue(bareMvcData, out modelType))
            {
                throw new DxaException(
                    String.Format("No View Model registered for View '{0}'. Check that you have registered this View in the '{1}' area registration.", viewData, viewData.AreaName)
                    );
            }
            return modelType;
        }
public static Type GetViewModelType ( MvcData viewData ) { Type modelType ; MvcData bareMvcData = new MvcData { AreaName = viewData . AreaName , ControllerName = viewData . ControllerName , ViewName = viewData . ViewName } ; if ( ! _viewToModelTypeMapping . TryGetValue ( bareMvcData , out modelType ) ) { throw new DxaException ( String . Format ( " " , viewData , viewData . AreaName ) ) ; } return modelType ; }
Get the View Model Type for a given View.
Get the View Model Type for a given View .
The View Model Type.
The View Model Type .
viewData
MvcData
The data for the View.
The data for the View .