Select the search type
  • Site
  • Web
Search
You are here:  Support/Forums
Support

Bring2mind Forums

API usage outside of DNN
Last Post 01/27/2010 3:23 PM by THirsh. 3 Replies.
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
THirsh
New Member
New Member
Posts:3


--
01/26/2010 9:39 PM

I'd like to use the DMX API outside the context of DNN to provide Entry Info data to another system.  I've been trying to get an instance of the SqlDataProvider using the following code:

Bring2mind.DNN.Modules.DMX.Data.

DataProvider dmxDataProvider = (Bring2mind.DNN.Modules.DMX.Data.DataProvider)DotNetNuke.Framework.Reflection.CreateObject("dmxdata");

with the following configuration:

<

<

configSections>sectionGroup name="dotnetnuke">

<

section name="dmxdata" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke" />

<

sectionGroup>configSections>dotnetnuke>

<

<

<

<

dmxdata defaultProvider="dmxSqlDataProvider">providers>clear />add name="dmxSqlDataProvider" type="Bring2mind.DNN.Modules.DMX.Data.SqlDataProvider, Bring2mind.DNN.Modules.DMX.Core" connectionString="SiteSqlServer" upgradeConnectionString="" providerPath="" objectQualifier="" databaseOwner="dbo" />providers>dmxdata>

dotnetnuke>

but get the following exception:

System.ArgumentNullException : Value cannot be null.
Parameter name: type
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at DotNetNuke.Framework.Reflection.CreateObject(String TypeName, String CacheKey, Boolean UseCache)
   at DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectProviderName, String ObjectNamespace, String ObjectAssemblyName, Boolean UseCache)
   at DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectNamespace, String ObjectAssemblyName)...

 

What needs to be done in order to get the DMX data provider instance when executing outside of DNN?

THirsh
New Member
New Member
Posts:3


--
01/26/2010 9:43 PM

Looks like the forum tool completely munged the config section, but you get the idea...

Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
01/27/2010 12:34 PM
Hi Todd,

Never tried it. But what I'd try is the following. Import the DMX.Core dll into your project. Then create a New SqlDataProvider that is in there and manually set the properties: databaseOwner (normally "dbo."), objectQualifier, and connectionString. Then the methods should work I think.

I don't think the DNN constructors will work outside DNN.

Peter
THirsh
New Member
New Member
Posts:3


--
01/27/2010 3:23 PM

But creating a SqlDataProvider is where the problem occurrs.  The following throws an exception within its constructor:

Bring2mind.DNN.Modules.DMX.Data.

SqlDataProvider dataprovider = new Bring2mind.DNN.Modules.DMX.Data.SqlDataProvider();

 

--ArgumentNullException

at System.Activator.CreateInstance(Type type, Boolean nonPublic)

at System.Activator.CreateInstance(Type type)

at DotNetNuke.Framework.Reflection.CreateObject(String TypeName, String CacheKey, Boolean UseCache)

at DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectProviderName, String ObjectNamespace, String ObjectAssemblyName, Boolean UseCache)

at DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectNamespace, String ObjectAssemblyName)

at Bring2mind.DNN.Modules.DMX.Data.DataProvider.()

at Bring2mind.DNN.Modules.DMX.Data.DataProvider..cctor()

You are not authorized to post a reply.