CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > starter_kits_and_source_projects.dotnetnuke.custom_modules Tags:
Item Type: NewsGroup Date Entered: 11/8/2005 10:15:58 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 0 Views: 29 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
6 Items, 1 Pages 1 |< << Go >> >|
[email protected]
Asp.Net User
Problem with - dynamically create provider11/8/2005 10:15:58 PM

0/0

Could any one please explain how the "dynamic create provider" works in the DataProvider class?  what is the proper "name space" and "assembly name" that I should use to make this work. 

Any suggestion is greatly appreciated or please gear me in the right direction.  I have been stucked at this for a while now. 

this is my code

Private
Shared Sub CreateProvider()

objProvider = CType(Framework.Reflection.CreateObject("data", "PAS.DNN.Modules.pasStateVB.Data", "PAS.DNN.Modules.pasStateVB"), DataProvider)

End Sub

this is the error I get
DotNetNuke.Services.Exceptions.ModuleLoadException: The type initializer for "PAS.DNN.Modules.pasStateVB.Data.DataProvider" threw an exception. ---> System.TypeInitializationException: The type initializer for "PAS.DNN.Modules.pasStateVB.Data.DataProvider" threw an 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) in C:\DotNetNuke\components\Shared\Reflection.vb:line 102 at DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectNamespace, String ObjectAssemblyName) in C:\DotNetNuke\components\Shared\Reflection.vb:line 67 at PAS.DNN.Modules.pasStateVB.Data.DataProvider.CreateProvider() in C:\dotnetnuke\DesktopModules\pasStateVB\Components\DataProvider.vb:line 20 at PAS.DNN.Modules.pasStateVB.Data.DataProvider..cctor() in C:\dotnetnuke\DesktopModules\pasStateVB\Components\DataProvider.vb:line 15 --- End of inner exception stack trace --- at PAS.DNN.Modules.pasStateVB.Data.DataProvider.Instance() at PAS.DNN.Modules.pasStateVB.Business.pasStateController.Add(pasStateInfo objpasState) in C:\dotnetnuke\DesktopModules\pasStateVB\Components\pasStateVBController.vb:line 26 at PAS.DNN.Modules.pasStateVB.pasStateVBEdit.cmdUpdate_Click(Object sender, EventArgs e) in C:\dotnetnuke\DesktopModules\pasStateVB\pasStateVBEdit.ascx.vb:line 76 --- End of inner exception stack trace ---
thecrispy1
Asp.Net User
Re: Problem with - dynamically create provider11/9/2005 1:46:28 PM

0/0

Private Const [NameSpace] As String = "DotNetNuke.Modules.Forum" ' project namespace

Private Const [AssemblyName] As String = "DotNetNuke.Modules.Forum" ' project assemblyname

I am not sure exactly what you are asking but I am guessing that you are not properly labeling this in your modules DataProvider file located in the module project. 


Chris Paterra


ikamiksok
Asp.Net User
Re: Problem with - dynamically create provider11/9/2005 9:14:08 PM

0/0

I don't have code in front of me but hopefully my memory serves me correctly....

Note that the names are also case sensitive. Miscapitalize a letter and it won't work. Note the DNN data provider makes assumptions for reflection on certain naming.

Your provider dll file name should be exactly as the assembly name I believe. So it should be PAS.DNN.Modules.pasStateVB.dll. Note that your data provider class should be of the namespace PAS.DNN.Modules.pasStateVB.Data also. And these should be written like thecrispy1 said.

So

Private Const [NameSpace] As String = "PAS.DNN.Modules.pasStateVB.Data "
Private Const [AssemblyName] As String = "PAS.DNN.Modules.pasStateVB"
Actual file name: PAS.DNN.Modules.pasStateVB.dll
Namespace for your dataprovider class: PAS.DNN.Modules.pasStateVB.Data

namespace used

Make sure your namespaces and dll file name all match correctly including case. This has been asked a lot so you can search the forums on data provider for more examples and advice.

jason

[email protected]
Asp.Net User
Re: Problem with - dynamically create provider12/5/2005 10:51:51 PM

0/0

Thank Jason

I was able to get it to work

[email protected]
Asp.Net User
Re: Problem with - dynamically create provider12/13/2005 11:46:13 PM

0/0

Jason,

I was able to over come this issue.  however I have another question.  Can we have two different DataProvider.cs in the same module and also have the two SqlDataProvider.cs.  Each access different tables in the database.

this is what I have

public class SqlDataProvider : DataProvider

{...}

public class SqlDataProviderTM : DataProviderTM

{...}

but have this error on the line below shown in red

public abstract class DataProviderTM

{

private static void CreateProvider()

{

objProvider = ((DataProviderTM)DotNetNuke.Framework.Reflection.CreateObject("data", "PAS.AgentAdmin", "PAS.AgentAdmin"));

}

....}

this is an error I get on this line

 System.InvalidCastException: Specified cast is not valid.

 

the question is does dotnetnuke allow to have more than one dataprovider or just one?  what if my module need to access more than one tables and I would like to break the sqldataprovider on muliple class.

 

 

 

 

 

 

RobProProgger
Asp.Net User
Re: Problem with - dynamically create provider1/8/2006 5:02:47 PM

0/0

Hello!

I have got the same problem as [email protected].
I have written the correct NameSpace and Assemblyname but I
just keep getting this error in Visual Studio.

Errormessage:
"An unhandled exception of type 'System.MemberAccessException' ocurred
in mscorib.dll
Additional information: Cannot Create an abstract class."

Exception:
System.TypeInitializationException
----Inner exception:     System.MemberAccessException
----Message:               "Cannot create an abstract class." 
----Source:                  mscorlib

Code:
Imports System
Imports System.Web.Caching
Imports System.Reflection

Namespace INVID.DNN.Modules.HelloWorld.Data

    Public MustInherit Class DataProvider

#Region "Shared/Static Methods"
        ' singleton reference to the instantiated object
      Private Shared objProvider As DataProvider = Nothing

        ' constructor
        Shared Sub New()
            CreateProvider()
        End Sub

        ' dynamically create provider
      
'  This sub gets called, It is calling the methods that will raise the exception
      Private Shared Sub CreateProvider()
         objProvider = CType(Framework.Reflection.CreateObject( _
            "data", _
            "INVID.DNN.Modules.HelloWorld.Data", _
            "INVID.DNN.Modules.HelloWorld"), DataProvider)
      End Sub

      ' return the provider
      Public Shared Shadows Function Instance() As DataProvider
         Return objProvider
      End Function
#End Region
    End Class
End Namespace

Code that is called in (The Step were it goes wrong) Components\Shared\Reflection.vb:

   ' dynamically create an object from a TypeName using a CacheKey
        Public Shared Function CreateObject(ByVal TypeName As String,  _
            ByVal CacheKey As String) As Object

            If CacheKey = "" Then
                CacheKey = TypeName
            End If

            ' use the cache for performance
            Dim objType As Type = CType(DataCache.GetCache(CacheKey), Type)

            ' is the type in the cache?
            If objType Is Nothing Then
                Try
                    ' use reflection to get the type of the class
                    objType = Type.GetType(TypeName, True)
                    ' insert the type into the cache
                    DataCache.SetCache(CacheKey, objType)
                Catch exc As Exception
                    ' could not load the type
                    LogException(exc)
                End Try
            End If

            ' dynamically create the object
            Return Activator.CreateInstance(objType) ' This line raises the error mentioned before
        End Function



Any help on this error will be much appreciated!
Best regards [email protected]


6 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Grid Computing: On Demand Series Authors: Joshy Joseph, Craig Fellenstein, Pages: 378, Published: 2004
Object-oriented Construction Handbook: Developing Application-oriented Software with the Tools & Materials Approach Authors: Heinz Züllighoven, Robert F. Beeger, Pages: 520, Published: 2004
On the Move to Meaningful Internet Systems 2005: OTM 2005 Workshops : OTM Confederated International Workshops and Posters : AWeSOMe, CAMS, GADA, MIOS+INTEROP, ORM, PhDS, SeBGIS, SWWS, and WOSE 2005, Agia Napa, Cyprus, October 31-November 4, 2005 : Proceedings Authors: R. Meersman, Pages: 1228, Published: 2005
Intelligent Problem Solving: Methodologies and Approaches : 13th International Conference on Industrial and Engineering Applications of Artificial Intelligence and Expert Systems, IEA/AIE 2000, New Orleans, Lousiana, USA, June 19-22, 2000 : Proceedings Authors: Rasiah Loganantharaj, Günther Palm, Moonis Ali, Pages: 751, Published: 2000
SQL Server 2005 Bible Authors: Paul Nielsen, Pages: 1293, Published: 2006
Professional Windows PowerShell Programming: Snapins, Cmdlets, Hosts and Providers Authors: Arul Kumaravel, Jon White, Michael Naixin Li, Scott Happell, Guohui Xie, Krishna C. Vutukuri, Pages: 336, Published: 2008
strategic management and online selling: Creating Competitive Advantage with Intangible Web Goods Authors: Susanne Royer, Pages: 240, Published: 2005
Management of Multimedia on the Internet: 4th IFIP/IEEE International Conference on Management of Multimedia Networks and Services, MMNS 2001, Chicago, IL, USA, October 29-November 1, 2001 : Proceedings Authors: Ehab S. Al-Shaer, Giovanni Pacifici, International Federation for Information Processing, Pages: 372, Published: 2001
Special Edition Using Java 2: Standard Edition Authors: Brian Keeton, Chuck Cavaness, Geoff Friesen, Pages: 1126, Published: 2000
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005

Web:
Matt Berseth: Dynamic Data and Custom Metadata Providers Aug 24, 2008 ... No problem, move these rules from the TypeDescriptor and into your build ... I already downloaded the vs template to create dynamic data ...
CREATING A FTP SERVER USING DYNAMIC DNS Using dynamic DNS to create a FTP server involves three steps– 1. choosing a dynamic DNS service provider; 2. installing a dynamic DNS software application; ...
Bruce Phillips Blog on Java, ColdFusion, Flex and Spry ... Tutorials on using Java, ColdFusion, Flex, and Spry: Dynamically Create CheckBoxes, ... will create a checkbox for each object stored in the data provider. ...
SharpMap - Open Source Interactive Geospatial Application ... Discussions List | Create New Discussion. Wiki Link: [discussion:36344]. Creating Label dynamically on geometry provider 2.0 Tags: v2.0 ...
Dynamically create an SSIS Bulk Insert Package - SQL Server - A four-part name was supplied, but the provider does not expose the necessary interfaces to use a catalog or schema. Tag: Dynamically create an SSIS Bulk ...
Urgent: Problem in creating the Dynamic control for a dynamic ... Feb 11, 2008 ... MSDN Forums » Data Platform Development » ADO.NET Data Providers » Urgent: Problem in creating the Dynamic control for a dynamic listbox ...
Multiple dynamic MembershipProviders - ASP.NET Forums So my problem right now, which seems to have no solution is that there is no way to dynamically add Membership-providers at application ...
ILOG Elixir Blog » Blog Archive » Dynamically add or remove items ... Make sure to create unique objects. If you create objects that are equal (in the == sense), you expose yourself to problems (especially if you are using ...
Blogs - EPiServer Labs Problem: How to create a EPiServer property which contains other EpiServer ... More dynamic content resources: Video: Using Dynamic Content to Create ...
Winston Prakash's Weblog : weblog Hello, i have a dynamic create table component, and i want to do a single .... Creator Tip: Work around for Object List Data Provider design time problem ...

Videos:
Register.com Coupons http://www.EscapeTheCycle.com Register.com Coupons get Register.com Coupons savings and cash back, click the link above. Register.com provides all...
Mark Ress Money Making Niche Sites for Site Flipping & VRE http://hopurl.com/47783 http://www.vrecoach.com/mini-niche-sites/index.htm Mark Ress introduces his MONEY MAKING Niche sites. Let Me and My Team Cre...
NBA Live 09 presents Live 365 PS3,Xbox 360 Release Date: October 2008 DYNAMIC DNA -- The brain behind the game is powered by Synergy Sports Technology , the premier analytics prov...
Business tv: getting maximum impact from your office space In this business tv show, Pier Paolo Mucelli, Founder and CEO of eOffice, Lyndon Gasking, Commercial Director UK, BzzAgent and Paul Casey, Research M...
Why To Use IncNow to Form Your Delaware Corporation or LLC Agents and Corporations, Inc. (http://www.incnow.com) is a Delaware company that specializes in the formation of Delaware corporations, limited liabi...
A New Way to look at Networking Google Tech Talks August 30, 2006 Van Jacobson is a Research Fellow at PARC. Prior to that he was Chief Scientist and co-founder of Packet Design. P...
Business tv: getting maximum impact from your office space In this business tv show, Pier Paolo Mucelli, Founder and CEO of eOffice, Lyndon Gasking, Commercial Director UK, BzzAgent and Paul Cascey, Research ...
NBA Live 09 Tutorial video - EA Sports http://plaza.fi/edome/arvostelut/ferrari-challenge-trofeo-pirelli http://plaza.fi/edome/arvostelut/crusaders-thy-kingdom-come http://plaza.fi/edome...
Objects: they just work Google London Test Automation Conference (LTAC) Google Tech Talks September 8th, 2006 Presenter: Bob Binder
iDesktop Tutorial So what is iDesktop.tv? iDesktop.tv is an incredibly cool dynamic web 2.0 application, with a terrific modern design, that brings you a better way to...




Search This Site:










3 strikes login control

2.0 - generic module settings control?

imagebutton problem

check when site was last updated

vb not working.

need little help understanding working of adaptors

problem: login in to a personalized page!

vs2005 and paypal

what the different between asp.net and asp.net web matrix version?

let users access own account/msg

visual sourcesafe 2005 msg - "failed to check in one or more files. some files remain checked out or not added."

(store)locator

speed - using ssl on the whole site or on partial site???

need new isp that does db backups daily

news letter troubles - please help

time validation

asp.net 2.0 menu control in a masterpage display problem

objects added at design not showing during execution

at what point should i encrypt / decrypt

create .aspx in runtime and then save to file?

aaaaaaah! ucanuse

writexml(), access to the path is denied!

sitemap menus - can use get dynamic flyouts using sitempa?

function with parameters in the asp.net file

error in form authantication very urgent

mystery with automatically generated javascript by asp.net 2.0

cannot view asp.net site

any news on the update

can't get excludefrombuild to work....

the right way to add styles?

 
All Times Are GMT