// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using Microsoft.AspNet.Mvc.Core; using Microsoft.AspNet.Mvc.Rendering; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc { /// /// Encapsulates information that describes an . /// public class ViewEngineDescriptor { /// /// Creates a new instance of . /// /// The type that the descriptor represents. public ViewEngineDescriptor([NotNull] Type type) { if (!typeof(IViewEngine).IsAssignableFrom(type)) { var message = Resources.FormatTypeMustDeriveFromType(type.FullName, typeof(IViewEngine).FullName); throw new ArgumentException(message, nameof(type)); } ViewEngineType = type; } /// /// Creates a new instance of using the specified type. /// /// An instance of that the descriptor represents. public ViewEngineDescriptor([NotNull] IViewEngine viewEngine) { ViewEngine = viewEngine; ViewEngineType = viewEngine.GetType(); } /// /// Gets the type of the described by this . /// public Type ViewEngineType { get; } /// /// Gets the instance described by this . /// public IViewEngine ViewEngine { get; } } }