We have a requirement to access implementations of ManagerBase<ContentProviderBase> outside of a running web-context. This is part of a proposed deployment process where we would want to script all updates to the database via a class prior to upgrading the code base deployed to a server. That is how it is, and is typical for large enterprise deployments that are built in house.
I have attempted to do this by building a console application and using an implementation of the ManagerBase<ContentProviderBase> based on a the Product example
. We are using that example as a basis for a Employees module (just as an example for us to build a case study around).
I have pulled in the application's web.config into the console application's app.config yet we get the following ConfigurationErrorsException:
"Provider with name 'Employees' has not been set"
at Telerik.ManagerBase`1.SetProvider(String providerName)
at Telerik.ManagerBase`1..ctor(String providerName)
at XXX.Ww.XXX.Modules.Employees.EmployeeManager..ctor(String providerName) in C:\Projects\XXX-sitefinity-branch\src\XXX.Ww.XXX.Modules.Employees\EmployeeManager.cs:line 27
at XXX.Ww.XXX.Modules.Employees.EmployeeManager..ctor() in C:\Projects\XXX-sitefinity-branch\src\XXX.Ww.XXX.Modules.Employees\EmployeeManager.cs:line 17
at XXX.Ww.XXX.Tools.EmployeeExporter.Program.Main(String args) in C:\Projects\XXX-sitefinity-branch\src\XXX.Ww.XXX.Tools.EmployeeExporter\Program.cs:line 11
at System.AppDomain._nExecuteAssembly(Assembly assembly, String args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String args)
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
This appears to be due to ConfigHelper.Handler having 0 items in it's Providers property.
Is this a limitation on the example? Certainly the configuration mentions no specific "provider" named Employees but a "genericContentProvider(s)":
<add providerName="Employees" urlRewriteFormat="[Name].aspx" urlDateTimeFormat="yy-MM-dd" urlWhitespaceChar="_"/>
This is how the Products example laid out it's stall, so to speak, but specifying a genericContentProviders.