Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Using DNN controller classes from a Windows Forms applicationUsing DNN controller classes from a Windows Forms application
Previous
 
Next
New Post
9/12/2006 6:15 PM
 

I need to be able to call methods on a controller class from one of our company's modules from a Windows Application.  Apparently the activator cannot read the appropriate string that generates the fully qualified type for the SQLDataProvider from the app.config.  The module works fine from within the web portal.

Has anyone here been successful calling into the DotNetNuke controller classes from outside of the DNN web project (from within a windows form application)?  Any insight into what you did to make it work would be useful.  I am using DNN 4.3.4 and 2.0 Framework.  Here is details of the error and a snapshot of my app.config from the Windows Application:

Outer exception: "The type initializer for 'AGS.Modules.CoreServices.DataProvider' threw an exception."

Inner exception: Value cannot be null.  Parameter name: type

Stack Trace:

   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 AGS.Modules.CoreServices.DataProvider.CreateProvider()
   at AGS.Modules.CoreServices.DataProvider..cctor()

Here is a look at the app.config:

<configuration>

<!-- register local configuration handlers -->

<configSections>

<sectionGroup name="dotnetnuke">

<!-- the requirePermission attribute will cause a syntax warning - please ignore - it is required for Medium Trust support-->

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

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

</sectionGroup>

</configSections>

<connectionStrings>

<add name="SiteSqlServer" connectionString="Server=**;Database=**;uid=**;pwd=**;" providerName="System.Data.SqlClient" />

</connectionStrings>

<dotnetnuke>

<data defaultProvider="SqlDataProvider">

<providers>

<clear />

<add name="SqlDataProvider" type="DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider" connectionStringName="SiteSqlServer" upgradeConnectionString="" providerPath="" objectQualifier="" databaseOwner="dbo" />

</providers>

</data>

<caching defaultProvider="FileBasedCachingProvider">

<providers>

<clear />

<add name="FileBasedCachingProvider" type="DotNetNuke.Services.Cache.FileBasedCachingProvider.FBCachingProvider, DotNetNuke.Caching.FileBasedCachingProvider" providerPath="~\Providers\CachingProviders\FileBasedCachingProvider\" />

<add name="BroadcastPollingCachingProvider" type="DotNetNuke.Services.Cache.BroadcastPollingCachingProvider.BPCachingProvider, DotNetNuke.Caching.BroadcastPollingCachingProvider" providerPath="~\Providers\CachingProviders\BroadcastPollingCachingProvider\" />

</providers>

</caching>

</dotnetnuke>

</configuration>

 

 
New Post
9/13/2006 8:29 AM
 
Mark Hoskins on the core team has done a lot of work in this area.  I will ping him to see if he can respond here.

Joe Brinkman
DNN Corp.
 
New Post
9/17/2006 5:13 PM
 

I have spent some time dwelling on this and believe there is an underlying issue with the implementation of DNN's provider model if the various controller objects are tightly coupled to classes/configuration sections that are specific to a web project.  It seems to me that any controller-level class should be able to be instantiated from any other type of project (windows form, windows service) as long as the appropriate data provider configuration groups are specified in the app.config.

If anyone has been successful doing this, please post here because I imagine that this is something that many people may need to know (now or sometime on another project).

 
New Post
9/19/2006 5:28 PM
 

   I too have written some custome data providers for DotNetNuke (3.x) then tried to load them with a Widnows Desktop App. Including the actual DotNetNuke & my data providers in the Windows Desktop App solution I tried loading the providers. There are a couple of problems I was able to pin point when I watch the Windows App go up in flames.

1. Common.Globals.$variables are utilized all over the place in the base providers (cache, logging, etc) and controllers. These variables need to be intialized by the Windows App or each provider that utilizes them needs to be re-written specificly for a Windows App.

2. Cache &\or Logging providers are utilized everytime another provider is loaded up. If you set the default cache provider to XMLLoggingProvider you would think the log provider would work fine, but it utilizes those Common.Global.$variables to set it's filepaths, etc. The two cache providers can't operate without a web-server or database-server, so they are ruled out (I think).

   It seems like someone needs to write a "DesktopProviderModel" sperate from the entire DotNetNuke namespace and a Logging and Cache provider that can operate in a Windows App environment (seperate from web and maybe database).

   I started writing but have not finished. Let me know if I'm barking up the wrong tree.

            PS I didn't have winword to spell check & you know I'm a lazy programmer.

 
New Post
9/20/2006 5:16 AM
 

Another approach (which has worked well for me) is to create a web service to do what you want.  I install the web service (that is, the asmx files and the dll) as a module inside DNN, (along with a "dummy" ascx file so DNN doesn't go crazy if you try to add it to a page!).  The web service code runs "inside" dotnetnuke, so you don't have any of the problems noted above.

Edit:  Forgot to add "and call it from your WinForms application!"


 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Using DNN controller classes from a Windows Forms applicationUsing DNN controller classes from a Windows Forms application


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out