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.0To DAL or not To DALTo DAL or not To DAL
Previous
 
Next
New Post
2/5/2007 7:16 PM
 

Ok, I think I asked this before A Long Time ago, in a Forum, Far, Far Away (the asp.net forum to be exact), but didn't really get a clear answer then, so I want to try again.

My modules will use another database seperate from the database containing the DotNetNuke tables, and I was wondering other then portability (to Oracle or some other database), is there any valid reason I should use the DAL instead of accessing the database directly in code?

Here is why I ask.  I tried with and without the DAL and there are significant performance differences.  Please do not mis-understand, I am not knocking DNN at all.  However, I will take the path of better performance, unless there is some earth-shattering reason to use the DAL that might impact my DNN site in the future.

As always, Thanks in Advance!!

Greg

 
New Post
2/6/2007 9:41 AM
 

Have you tried the new DAL+ ? The advantage of using it is that you will have a significant reduction in code. You can use code such as this:

Dim mySqlString As New StringBuilder()
mySqlString.Append(
"SELECT FriendlyName, Description ")
mySqlString.Append(
"FROM {databaseOwner}{objectQualifier}DesktopModules ")
mySqlString.Append(
"WHERE Description like '%' + @SearchString + '%' ")
mySqlString.Append(
"ORDER BY FriendlyName")Dim myParam As SqlParameter = New SqlParameter("@SearchString", SqlDbType.VarChar, 150)
myParam.Value = SearchString
Me.GridView1.DataSource = CType(DataProvider.Instance().ExecuteSQL(mySqlString.ToString(), myParam), IDataReader)
Me
.GridView1.DataBind()

 

See:

  • Super-Simple Module (DAL+)
  • Super-Fast Super-Easy Module (DAL+)


  • Michael Washington
    http://ADefWebserver.com
    www.ADefHelpDesk.com
    A Free Open Source DotNetNuke Help Desk Module
     
    New Post
    2/6/2007 11:55 AM
     

    Greg - you can most certainly choose not to use the DAL without any problems. In your case, you've mentioned that you want to connect to a different database than what DNN is running on (i.e. DNN running on SQL Server but you're wanting to connect to an Oracle datasource). In this case, yes you can create your version of the data access layer (or even code it directly within your module's code if neccessary).
    The advantages of DAL which come to mind are as follows:
    a) You can create your module independent of the database access layer and if at some point in the future you do want to create a version of your module that connects to a different data source/database, it's as easy as writing the dataprovider for your module and you're up and running.
    b) The DAL exposes methods (ExecuteReader/ExecuteNonQuery etc) which are preferred ways of getting access to the database (now incorporated in EnterpriseLibrary by MS) and as such it becomes easier to write less lines of code to accomplish the same thing.

    That being said, what performance improvements are you seeing when not using the DAL?

     


    AcuitiDP - Oracle Data Provider for DotNetNuke
     
    New Post
    2/6/2007 3:56 PM
     
    I am also curious to hear more about the performance differences Greg noticed.
     
    New Post
    2/6/2007 4:22 PM
     
    gregfig wrote

    Here is why I ask.  I tried with and without the DAL and there are significant performance differences.  Please do not mis-understand, I am not knocking DNN at all.  However, I will take the path of better performance, unless there is some earth-shattering reason to use the DAL that might impact my DNN site in the future.

    AFAIK, the difference comes from the expensive use of reflection to be able to use the Provider model for data access. As others have pointed out, if you don't need to make your module portable, there's no reason whatsoever to use the DNN DAL. Of course you do want to keep a layered design and use your own DAL.


    Do you know the truth when you hear it?
    Néstor Sánchez
    The Dúnadan Raptor -->Follow Me on Twitter Now!
     
    Previous
     
    Next
    HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0To DAL or not To DALTo DAL or not To DAL


    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