|
using System;
using System.Configuration;
using System.Reflection;
using PauloMorgado.Web.UI;
namespace PauloMorgado.Web.Configuration
{
internal class PageModuleEntry
{
private string name;
private Type type;
internal PageModuleEntry(string name, string typeName, string propertyName, ConfigurationElement configurationElement)
{
this.name = name ?? string.Empty;
this.type = TypeUtils.GetType(typeName, propertyName, configurationElement);
if (!typeof(IPageModule).IsAssignableFrom(this.type))
{
if (configurationElement == null)
{
throw new ConfigurationErrorsException(string.Format(Properties.Resources.TypeNotModule, typeName));
}
throw new ConfigurationErrorsException(string.Format(Properties.Resources.TypeNotModule, typeName), configurationElement.ElementInformation.Properties["type"].Source, configurationElement.ElementInformation.Properties["type"].LineNumber);
}
}
internal IPageModule Create()
{
return (IPageModule)Activator.CreateInstance(type, BindingFlags.CreateInstance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, null, null);
}
internal string ModuleName
{
get
{
return this.name;
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.