Products

Solutions

Resources

Partners

Community

About

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

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsStoreStoreNeed advice on "Best Practice" for extending the Store moduleNeed advice on "Best Practice" for extending the Store module
Previous
 
Next
New Post
5/31/2006 3:24 PM
 

Hi Store guys. Thanks for doing this module. This is not a easy one to do and i think in time this will show the power of DNN.

My question is of a architecture nature. I am extending the Store module, by creating a Promotions module that will show the products that are currently on promotion discount. Being a lazy developer, i want to be able to use all the code-gen stuff provided by CodeSmith template and want to steer away from complex Store Procedures(if i can).

In your opinion, what is the best way to go about building a module with relationships (1:1, 1:many, many:many) with some of the Store tables.

Should one make InnerJoin StoreProcedures, ot is it better to use the out.of-the-box xxxController methods e.g. GetProducts and GetPromotions and somehow use those collections to populate datafield that should give the user the possibility to update 2 tables at the same time?

 
New Post
6/1/2006 6:24 AM
 

That's funny, I'm just working on a similar application. My approach is to leave the Store as it is (especially when something is in beta) and use utility functions to get/set the information as required.

For example, I have an Excel spreadsheet with a list of Products that already includes a Category column with 1000's of rows. Using a standard OledbDataReader I can get a list of unique Categories like this...

Public Function ExportCategories() as OleDbDataReader
Return New OleDbCommand("select distinct category from [items$] group by category", Connection).ExecuteReader

Then I with a collection of Store CategoryIDs...

Public Function GetStoreCategories() As Collection
Dim s As String = String.Format("select categoryid,categoryname from Store_Categories where PortalID={0}", PortalID)
Dim cc As New Collection
Dim cdr As SqlDataReader = New SqlCommand(s, Connection).ExecuteReader
While cdr.Read
   cc.Add(cdr(0), cdr(1))
End While
Return cc

...Now I can add MyProducts to the StoreProducts Table. To verify a category I use Collection.Contains("Cat1") or to get the StoreCategoryID I use Collection("Cat1") 

I have written many system using this approach. I rarely use 1 to 1 relationships because something will always get out of sync or worse. I treat the Store tables as "foreign keys", but I would never allow my application or DotNetNuke to enforce the constraints. Sure you can add your own stored procs but you also have to provide a mechanism to remove them as well.

As far as best practices, I prefer real world use. If an application already works, any added functionality should not break it.

I would be happy to discuss any other ideas or suggestions about this thread. It is a very interesting (and common) programming issue.


Dwayne J. Baldwin
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsStoreStoreNeed advice on "Best Practice" for extending the Store moduleNeed advice on "Best Practice" for extending the Store module


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