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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Do we have to type all the DAL Controller Code in?Do we have to type all the DAL Controller Code in?
Previous
 
Next
New Post
8/11/2006 1:35 PM
 

I was using Mr. Washington's code example ThingForSale as a template for things that I need.  This is the first time I have tried to develop with DNN.  I don't mean to sound too lazy (though it is probably true), but do we have to type in the code by hand to use databases?  For example, on his tutorial for creating modules in 4.3+ the super easy way it has:

Namespace YourCompany.Modules.ThingsForSale

    Public Class ThingsForSaleController

        <DataObjectMethod(DataObjectMethodType.Insert)> _
        Public Shared Sub ThingsForSale_Insert(ByVal ThingsForSaleInfo As ThingsForSaleInfo)
            DataProvider.Instance().ExecuteNonQuery("ThingsForSale_Insert", ThingsForSaleInfo.ModuleId, GetNull(ThingsForSaleInfo.UserID), GetNull(ThingsForSaleInfo.Category.ToString), GetNull(ThingsForSaleInfo.Description.ToString), GetNull(ThingsForSaleInfo.Price))
        End Sub

        <DataObjectMethod(DataObjectMethodType.Delete)> _
        Public Shared Sub ThingsForSale_Delete(ByVal ThingsForSaleInfo As ThingsForSaleInfo)
            DataProvider.Instance().ExecuteNonQuery("ThingsForSale_Delete", ThingsForSaleInfo.ID)
        End Sub

        <DataObjectMethod(DataObjectMethodType.Update)> _
        Public Shared Sub ThingsForSale_Update(ByVal ThingsForSaleInfo As ThingsForSaleInfo)
            DataProvider.Instance().ExecuteNonQuery("ThingsForSale_Update", ThingsForSaleInfo.ID, ThingsForSaleInfo.ModuleId, GetNull(ThingsForSaleInfo.UserID), GetNull(ThingsForSaleInfo.Category.ToString), GetNull(ThingsForSaleInfo.Description.ToString), GetNull(ThingsForSaleInfo.Price))
        End Sub

        <DataObjectMethod(DataObjectMethodType.Select)> _
        Public Shared Function ThingsForSale_SelectAll(ByVal ModuleId As Integer) As List(Of ThingsForSaleInfo)
            Return CBO.FillCollection(Of ThingsForSaleInfo)(CType(DataProvider.Instance().ExecuteReader("ThingsForSale_SelectAll", ModuleId), IDataReader))
        End Function

        Private Shared Function GetNull(ByVal Field As Object) As Object
            Return Null.GetNull(Field, DBNull.Value)
        End Function

    End Class

 

All that was copy and paste, so it was very easy.  I just want to know about the next time I do something.  Maybe I just don't know enough about asp.net, but a lot of the stuff I have done VS created the ObjectDataSource methods automatically.

I am not complaining.  Please don't read it this way.  I am thankful for the tutorial, and I realize that DNN is a complex system.  I don't expect it to be super-easy.  But I do need to get a good grasp on how to proceeed.  I can't copy and paste forever because I don't understand.

Thank you.

 
New Post
8/11/2006 5:58 PM
 

dnn_johnny,

I'm new too.., but I finally understand the very basics. I'm in no position to be giving advise, but I found the very basics were not heavily discussed, so I'll put my two cents in and maybe it will help you, maybe somebody else will correct me and we can both learn. Michael  has given you the basis of the four methods, Select, Insert, Update, and Delete.  Anthing you are going to do is going to be based on these.  Your ObjectDataSource is going to call a method from the Controller file, which uses the DataProvider to talk to the SqlDataProvider, and finally access the Stored Procedures in the DB. You also have to configure the Info file so the controller knows what your talking about. I discovered writing the Stored Procedure and working backward from there to the Presentation Layer (your *View.ascx file) was the easiest way to figure out what goes where and how they interact.  It was hard for me to understand at first, and then the lightbulb came on.  Good luck, maybe my ramblings will get some thin started here.


John
 
New Post
8/12/2006 6:49 PM
 

You might check out dnnjungle they have some templates and codesmith scripts to generate a lot of code once you create the database table.  I'm not sure if it is updated to dnn 4 though.

mj

 


Michael Jackson
Brillnat.com
Custom module development
Database access tokenized HTML modules
 
New Post
8/14/2006 8:52 AM
 
mhj96813 wrote

You might check out dnnjungle they have some templates and codesmith scripts to generate a lot of code once you create the database table.  I'm not sure if it is updated to dnn 4 though.

mj

 

I thought the whole point of being integrated with VS 2005 was to get away from all that.  I have seen the videos and tutorials that deal with all the extra programs.  That is why I only deal with the newer version.

 
New Post
8/14/2006 9:10 AM
 
Give EntitySpaces a look, we have templates that generate a DAL/Object Persistence layer with far more features than the DNN DAL. It works on ASP.NET/Winforms/DNN/whatever runs under .NET 2.0. EntitySpaces also has a massive battery of NUnit tests for QA purposes. We also have templates that can generate entire DotNetNuke module UI's to manage DB tables complete with fk lookups, validation, etc which you can demo here. Or continue to write it by hand like your some kind of robot, the choice is yours;)
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Do we have to type all the DAL Controller Code in?Do we have to type all the DAL Controller Code in?


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