• 4/7/2015
  • 9156 Views

Comments

9156 Views

DAL 2

Last updated 3 years ago

Comments

Common

(Enter the content of this article below)

Advanced

 

Background

DotNetNuke has introduced a new (optional) datalayer, that utilizes a micro-orm called Peta-Poco. It provides the following:
  • A close-to-the-metal option to execute any sql - basic SqlHelper like functionality. This would allow us to replace SqlHelper with a PetaPocoHelper class, which we have done in the core.
  • Fetch (retrieve) methods that can take a parameterized SQL snippet as a parameter e.g.. “WHERE PortalID = @0”, thus reducing the overhead of creating and managing stored procedures.
  • Page methods that can auto-generate the sql required to return a page of data from the database.
  • Simple methods to Insert, Update and Delete “objects” in the database, with no need to write any sql.
  • An IMapper interface which, while it doesn’t support cross-table mapping, will support things like an object qualifier (or table prefix)
  • Transaction support


Components of the DAL 2

The DAL 2 can be broken down into a number of components/features.
  • A Data Context. The Data Context represents the entry point for most developers. Developers can create a Data Context based on the default connection string or on a named connection string, and all the features of the DAL 2 are available regardless of database used.
  • A Repository. Probably the most important part of the DAL 2 is the built in repository that allows developers to work with objects without writing any SQL at all.
  • An IMapper interface that uses custom mapping attributes to control how the object's properties are mapped to the columns in the database table.

In addition there are a number of helper classes.
  • A PetaPocoHelper class - this class represents the PetaPoco equivalent of the SqlHelper class which has traditionally been used to execute database calls in DotNetNuke

Example Modules



Development help



References


Contents
No sections defined
Subscribe to DNN Digest

DNN Digest is our monthly email newsletter. It highlights news and content from around the DNN ecosystem, such as new modules and themes, messages from leadership, blog posts and notable tweets. Keep your finger on the pulse of the ecosystem by subscribing.  


Copyright 2017 by DNN Corp Terms of Use Privacy
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out