I'm working on a WPF application. I've tons of Usercontrols and im trying to load them dynamically to the user from a central place. I want to store Usercontrol name (or whatever?) in database and load them to users according to permission level. Here I'm planning to store only the GUID of the UserControl Class Type
var typeGuid = typeof(MyUserControl).GUID.ToString("N");
and store this GUID in database. When I want to load this Usercontrol,
string typeGuid = // Get the GUID From database
var myUserControlType = Type.GetTypeFromCLSID(new Guid(typeGuid));
var userControl= (UserControl)Activator.CreateInstance(myUserControlType);
Here I'm getting flowing error,
Retrieving the COM class factory for component with CLSID
{A355C352-38B2-3A88-864D-09DA12BE89FE} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
Also, Is this saving GUID in database is a good idea ?
User contributions licensed under CC BY-SA 3.0