Hello,
I am trying to use the TabController API to create a series of pages automatically from another windows application. I am however, running into problems when I try and use the following line of code:
DataProvider
provider = DotNetNuke.Data.DataProvider.Instance();
I get the exception :
System.TypeInitializationException was unhandled
Message="The type initializer for 'DotNetNuke.Data.DataProvider' threw an exception."
Source="DotNetNuke"
TypeName="DotNetNuke.Data.DataProvider"
StackTrace:
at DotNetNuke.Data.DataProvider.Instance()
at ENERG.VEM.DNN.VEMS_DNN_Synchroniser..ctor() in C:\Code\VEMS2005\DNN_VEM_BusinessLogic\VEMS_DNN_Synchroniser.cs:line 24
at EnergAnalysisHostApp.Form1.btnDNN_Click(Object sender, EventArgs e) in C:\Code\VEMS2005\EnergAnalysisHostApp\Form1.cs:line 189
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at EnergAnalysisHostApp.Form1.Main() in C:\Code\VEMS2005\EnergAnalysisHostApp\Form1.cs:line 141
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
I expect this is to do with Reflection and inability for it to create the SqlDataProvider concrete class, but I do now know how to tell DNN which data provider to use. I have guessed that the app.config file is the place to do it in the section called: <data> which I have attempted to mimic in the windows's app.config by copying most of the web.config into it.
<
data defaultProvider="SqlDataProvider">
<
providers>
<
clear/>
<
add name="SqlDataProvider" type="DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider" connectionStringName="SiteSqlServer" upgradeConnectionString="" providerPath="c:\code\dnn\Providers\DataProviders\SqlDataProvider\" objectQualifier="" databaseOwner="dbo"/>
</
providers>
</
data>
Does anyone have any suggestions, or I am unable to do what I am trying to do?
Best regards,
Chris.