/// <summary>
/// Creates and returns instance of a <see cref="Core.EditControlAdapter"/> based on the site configuration.
/// </summary>
/// <returns>An instance of <see cref="Core.EditControlAdapter"/></returns>
public static EditControlAdapter CreateEditControl <TDefault>()
where TDefault : EditControlAdapter, new()
{
SiteConfig siteConfig = SiteConfig.GetSiteConfig();
string configuredEditControl = siteConfig.EntryEditControl;
Core.EditControlAdapter editControl;
Type editControlType;
// try the configured control
if (TryGetType(configuredEditControl, out editControlType) && TryCreateControl(editControlType, out editControl))
{
return(editControl);
}
// try the requested default
if (TryCreateControl(typeof(TDefault), out editControl))
{
return(editControl);
}
// if all else failed, default to the plain textbox, since that doesn't depend on external assemblies.
return(new TextBoxAdapter());
}