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...Getting StartedGetting StartedDNN6 - Using Razor to Access Table Data?DNN6 - Using Razor to Access Table Data?
Previous
 
Next
New Post
11/10/2011 7:29 PM
 
Given DNN6 and wanting to use Razor Host - what is the best method for getting data out of tables in the current DNN instances database? Linq2SQL, EF, something else?

- Accuraty / Jeremy
 
New Post
11/15/2011 6:50 AM
 
it depends what you want to do - if it's readonly data then the webgrid helper is probably easiest - http://www.asp.net/webmatrix/tutorials/6-displaying-data-in-a-grid

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
11/16/2011 3:04 PM
 

Actually I think I am asking a more basic question than that. Given that I am in DNN, from Razor Host, but technology should I be using to read data from the tables? What @using System.something or @using DotNetNuke.something...

For files it looks like I should be using DotNetNuke.Services.FileSystem and FileManager as of 6.x.

What is the best practice way to open a table or execute a query and get back results that I can then iterate through and display?

 


- Accuraty / Jeremy
 
New Post
11/17/2011 1:51 PM
 
the best thing to do is to install the razor host module and look at the sample scripts - if you look at _PortalInfo.cshtml, _TabInfo.cshtml and _ModuleInfo.cshtml you'll see that there are a few helpers to access the instances of the current values. if you look at _UserList.cshtml you'll see something that runs a direct query and then iterates over the values, however I'd encourage you to bring in the relevant namespaces (via the @Imports Mynamespace razor directive) and use the API to acquire data.

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Getting StartedGetting StartedDNN6 - Using Razor to Access Table Data?DNN6 - Using Razor to Access Table Data?


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.