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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Windows Form Accessing DNN Methods and DALWindows Form Accessing DNN Methods and DAL
Previous
 
Next
New Post
7/5/2007 5:49 PM
 

Hello all,

I have an invoicing application that consists of multiple DNN modules.  There are a some critical background processes that I have running on threads within the web application. And pretty much as expected, running these in a web context is not reliable enough to ensure completion.  The best laid plans...... I am trying to determine the best way to move these processes to a Windows Form (or Service).  I have been investigating the alternatives and so far I have not found anything that looks promising.

A little more background.  A background job request is written to a table in the database, a master background thread looks for work in the table and assigns it to a worker thread.  If the web application happens to restart while any background threads are being processed, the threads abort, the processing fails and I get to clean up the mess.

The biggest issues I currently have:  I would like to be able integrate with the our custom DAL, of course this is Context based and a Form or Service does not have a web context.  I knew this going in and I was hoping maybe a Web Service, similar to IWeb maybe, might be the answer but, I am pretty sure it is not.  A webservice would have the same reliability issue I am currently trying to eliminate.  Another possible issue: since the cutom DAL uses the datacache there needs to be work done to ensure they are in sync, or at least cleared on both sides after some critical updates happen, hence the need to call DNN methods.

What I see as the optimal solution would be a way to use the existing DAL and DNN methods, of course.  Maybe by tricking DNN with a virtual context or something like that. 

I am interested to hear any ideas or feedback anyone has.

 
New Post
7/5/2007 10:01 PM
 

You can use a lot of the IWeb code without actually calling the code through a web service. IWeb provides examples of calling the DotNetNuke API from something other than a module. A module always has "context" so it took a minute to figure out what you needed to do when you don't have this context.

IWeb contains a bunch of examples.



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
7/6/2007 7:30 AM
 

Thanks Michael,

I will check it out.

 
New Post
7/6/2007 8:59 AM
 

I looked at the IWeb code and created a test Windows Form and I did not get any promising results.  My suspicion is that because a WebService runs within a web application context, it has availaible to it the same things a module has, making it easy to call the DNN DAL and/or Methods.

When I looked through the IWeb code, I did not see anything that I was not expecting, IWeb does work nicely.  To access the DNN Core DAL It looks like IWeb is importing DotNetNuke and make a call to DotNetNuke.Data.DataProvider.Instance() or some other method and away you go (Am I missing something?). When loading a Windows Form, the DataProvider.Instance(), and a whole bunch of other DNN stuff, does not get initialized, no web.config file etc.  So all of these methods/initializations returns on error like.

 The type initializer for 'DotNetNuke.Data.DataProvider' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectProviderName, String ObjectNamespace, String ObjectAssemblyName, Boolean UseCache)
   at DotNetNuke.Data.DataProvider.CreateProvider()
   at DotNetNuke.Data.DataProvider..cctor()
   --- End of inner exception stack trace ---
   at DotNetNuke.Entities.Portals.PortalController.GetPortals()

Wanting to be complete as possibile I created a Windows Form with a listbox and a button and this code, taken mostly from IWeb.  It returns the error above on load and after hitting the button a very similar one.

Imports System
Imports System.Web   'Not sure why it even lets me do this-Maybe the key is here
Imports System.Data
Imports System.Reflection
Imports System.Collections.Generic
Imports DotNetNuke
Imports DotNetNuke.Security.Roles
Imports DotNetNuke.Security.Membership

Public Class MainForm

Private Sub btnResetCache_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 

DotNetNuke.Common.Utilities.DataCache.ClearPortalCache(0, True)

End Sub

Private Sub MainForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 

PortalList()

End Sub

Private Function PortalList() As List(Of IWebPortalInfo)
Dim colPortalList As New List(Of IWebPortalInfo)
Dim colPortalController As New DotNetNuke.Entities.Portals.PortalController()
Dim colPortalInfo As DotNetNuke.Entities.Portals.PortalInfo
Dim arrArraylist As ArrayList
arrArraylist = colPortalController.GetPortals()

For Each colPortalInfo In arrArraylist
Dim objIWebPortalInfo As New IWebPortalInfo()
objIWebPortalInfo.PortalID = colPortalInfo.PortalID
objIWebPortalInfo.PotalName = "Portal: [" & CStr(colPortalInfo.PortalID) & "] " & colPortalInfo.PortalName 
'New addition
LbProcs.Items.Add(objIWebPortalInfo.PotalName)

colPortalList.Add(objIWebPortalInfo)
Next
Return colPortalList
End Function

End Class

Public Class IWebPortalInfo
Private _PortalID As Integer
Private _PotalName As String

' initialization
Public Sub New()
End Sub

' public properties
Public Property PortalID() As Integer
Get
Return _PortalID
End Get
Set(ByVal Value As Integer)
_PortalID = Value
End Set
End Property

Public Property PotalName() As String
Get
Return _PotalName
End Get
Set(ByVal Value As String)
_PotalName = Value
End Set
End Property

End Class

I Hope I have miseed something or I am making this harder than it has to be. Any and all feedback is appreciated.

 
New Post
2/22/2010 11:06 PM
 

I know this is an old post, but I bumped into something similar.

I am in need of using DNN libraries from a Windows Form applicaiton. Basically ListController to get some lists

I have added all the config from web.config to the app.config of the window forms. But it fails in DataProvider initialization

InnerException: System.ArgumentNullException
       Message="Value cannot be null.\r\nParameter name: type"
       Source="mscorlib"
       ParamName="type"

Any suggestions, leads?

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Windows Form Accessing DNN Methods and DALWindows Form Accessing DNN Methods and DAL


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