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 ExtensionsModulesModulesUsing a module's business logic that access data persisted in database through new Web API 2 projectUsing a module's business logic that access data persisted in database through new Web API 2 project
Previous
 
Next
New Post
8/27/2016 4:39 PM
 

Hi all,

I'm trying to build API for my website which uses custom developed module for DNN 6.2 and I experienced an issue that I would like to share with you hoping that some of you would help me.

The Scenario

  • I developed custom DNN module (DNN_VBU) that I already use for my website without any issues. (I'm using DNN 6.2)
  • The DNN module has some business logic that uses SqlDataProvider class through DataProvider abstract class to access a database.
  • Everything works perfect when I create an instance of DataProvider to call some of my methods that access database to load/save data.
  • I created complete new Web API 2 Visual Studio Project which has to implement API Layer that will uses the business logic already implemented in DNN_VBU module. So, DNN_VBU has Models (DTOs) and Controllers that I want to reuse in WEB API project (VBUMR_API) which will be a kind of Facade layer that external system will access it to get the business data in JSON or XML format.
  • I created simple Controller and WS method which looks like this one:

    Very simple, HTTP REQUEST have to call api\albums\1000 and "Get" method executes. VBU is alias to my DNN module (DNN_VBU) and call business logic wrapped in "GetAlbum" method which is another assembly (DNN module).
  • The error that I receive is the following:
  • After debugging I can see that provider configuration member is null.

  • When I'm calling the same method from the assembly which is DNN module itself in which this class is included everything works fine.

If someone can help with this issue I would be really grateful. 

Best regards,

 
New Post
8/28/2016 3:42 AM
 
I managed to resolve the problem by adding configuration parts about DotNetNuke from web.config in Module to WEB API project. Of course I copied DNN DLLs in bin folder of WEB API project as well.
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesUsing a module's business logic that access data persisted in database through new Web API 2 projectUsing a module's business logic that access data persisted in database through new Web API 2 project


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