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

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsProvidersProvidersCustom DataProvider w/ Framework.Reflection.CreateObjectCustom DataProvider w/ Framework.Reflection.CreateObject
Previous
 
Next
New Post
10/5/2011 5:23 PM
 
I am designing a somewhat complex Module/Application for a client. Many tables are required to hold all the information needed. As such, I started my application development with a single table and built my first ControlPages. Now I am moving on to another table, which is a child table to the first one I designed. I figured I'd create a new DataProvider class for it, along with the Abstraction Class and Implementation Class, etc. All seemed to work fine, until my new class ran the line of code in my new DatProvider Class's CreateProvider() method that stated:

CType(Framework.Reflection.CreateObject("data", "ESB.Modules.EAP_Provider.Data", ""), DataProviderLocation)

It claims that the object created is of datatype DataProvider (my original one) and cannot be cast into DataProviderLocation (my second one). I am assuming that Framework.Reflection.CreateObject() is hard coded to instantiate a "SqlDataProvider" class object within the Namespace provided. "SqlDataProvider" is coded to inherit from DataProvider...which makes sense why I get the error I am getting.

My question is, is there a way to override the default and have it in this instance, instantiate a different class, the correct class needed.  I was thinking of just hard coding the class needed, but since the original code is using reflection, I was afraid that hardcoding the correct class, would break something else down the line.  I would have assumed that multiple DataProvider classes wouldn't have been a problem.  Figured it was a normal enough thing to do...

Any advice?

Ben Santiago, MCP Certified & A+ Certified
Programmer Analyst
(SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS, Cognos ReportNet)
 
New Post
10/5/2011 6:13 PM
 
Update:

Ok, so I downloaded the DNN Source, installed C# so I could read it, and spent about an hour tracking down the code to the best of my ability regarding what Framework.Reflection.CreateObject() actually does. After researching the code, I modified my call to say the following:

CType(Framework.Reflection.CreateObject("data", "SqlDataProviderLocation", "ESB.Modules.EAP_Provider.Data", ""), DataProviderLocation)

I added the parameter in bold. And...it seems to work.  I am getting other errors but those are understandable, missing some SP's in SQL...have yet to write them.

If anyone reads this, understands what I am talking about, and knows the code involved.  Please let me know if what I did was correct, or did I just override something inproperly?

Thanks!

Ben Santiago, MCP Certified & A+ Certified
Programmer Analyst
(SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS, Cognos ReportNet)
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsProvidersProvidersCustom DataProvider w/ Framework.Reflection.CreateObjectCustom DataProvider w/ Framework.Reflection.CreateObject


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