Fork me on GitHub
DNN Apps - Demo-Zone
Discover DNN-Apps - simple and elegant, easy to customize
You are here: Home  >  Apps  >  SQL Data - Examples

Automatic 2sxc Pipeline SqlDataSource

This demo uses the 2sxc Pipeline (req. 2sxc 6.0.6+). More info here.

The top 10 files in this portal as returned by the Pipeline

  1. Hydrangeas.jpg
  2. Koala.jpg
  3. Penguins.jpg
  4. Google Tag Manager Source Code Demo 2014-03-13.png
  5. Beni.jpg
  6. Daniel.jpg
  7. Raphael.jpg
  8. GettingStarted.css
  9. Chrysanthemum.jpg
  10. Lighthouse.jpg

Pros

  1. Typed / dynamic entities
  2. nice syntax, same as any other 2sxc data
  3. Easy to configure
  4. Configuration instead of programming (less error-prone and less security risks)
  5. Benefits from automatic Configuration-Injection (like when @IdFilter can be [QueryString:ProductId|0] )
  6. Entity-Framework-like feeling without needing pre-compile
  7. Less code than all other methods (SQL Reader, DataTable, PetaPoco)
  8. No boilerplate / plumbing code (like PetaPoco)
  9. Can benefit from other pipeline-features like additional filtering, paging, attribute-stripping
  10. Can be auto-serialized using 2sxc and is then in the default format for JavaScript use - try here

Cons

  1. Probably a bit more performance overhead
  2. Might not fit all complex scenarios
  3. No built-in paging like with PetaPoco, probably in the future

Simple Demo with PetaPoco Data access

This demo uses PetaPoco as a mini-ORM to get the data. More info on PetaPoco here.

The top 10 files found in this portal as returned by PetaPoco

  1. Hydrangeas.jpg (613)
  2. Koala.jpg (614)
  3. Penguins.jpg (615)
  4. Google Tag Manager Source Code Demo 2014-03-13.png (616)
  5. Beni.jpg (620)
  6. Daniel.jpg (621)
  7. Raphael.jpg (622)
  8. GettingStarted.css (653)
  9. Chrysanthemum.jpg (659)
  10. Lighthouse.jpg (660)

Pros

  1. Typed data
  2. Entity-Framework-like feeling without needing pre-compile
  3. Less code than the other direct data methods (SQL & DataTable)
  4. Short, brief syntax
  5. Would already support paging and other features (read the PetaPoco docs)

Cons

  1. Requires you to write classes for each type you need
  2. Lots of boilerplate / plumbing code for typed classes
  3. Numbered Parameters @0 instead of @PortalId
  4. Default mode with Query is forward-only like using a SQLReader
  5. Can't use 2sxc pipelines
  6. Can't use 2sxc-built-in serializers and other features

Simple Demo using DataReader access

This demo accesses the data directly, uses a SQL parameter for the PortalId then shows the first 10 files it finds. More intro-material for direct database access in this article on codeplex.

The top 10 files found in this portal

  1. Hydrangeas.jpg
  2. Koala.jpg
  3. Penguins.jpg
  4. Google Tag Manager Source Code Demo 2014-03-13.png
  5. Beni.jpg
  6. Daniel.jpg
  7. Raphael.jpg
  8. GettingStarted.css
  9. Chrysanthemum.jpg
  10. Lighthouse.jpg

Pros

  1. Easy - copy paste etc.
  2. Standard .net, no learning curve
  3. Probably best performance of all shown samples because almost no abstractions

Cons

  1. Only forward looping through the reader
  2. Code feels technical and maybe difficult
  3. Can't use 2sxc pipelines
  4. Can't use 2sxc-built-in serializers and other features

Simple Demo with DataTable access

This demo accesses the data by filling it into a DataTable.

The top 10 files found in this portal with reverse sorting

  1. Raphael.jpg
  2. Penguins.jpg
  3. Lighthouse.jpg
  4. Koala.jpg
  5. Hydrangeas.jpg
  6. Google Tag Manager Source Code Demo 2014-03-13.png
  7. GettingStarted.css
  8. Daniel.jpg
  9. Chrysanthemum.jpg
  10. Beni.jpg

The top 10 files found in this portal as returned from DB

  1. Hydrangeas.jpg
  2. Koala.jpg
  3. Penguins.jpg
  4. Google Tag Manager Source Code Demo 2014-03-13.png
  5. Beni.jpg
  6. Daniel.jpg
  7. Raphael.jpg
  8. GettingStarted.css
  9. Chrysanthemum.jpg
  10. Lighthouse.jpg

Pros

  1. Standard .net, no learning curve
  2. Allows further data manipulation in memory
  3. You can use the data a few times (reader is forward-only)
  4. Connection handling open/close is done automatically by the Adapter

Cons

  1. Code feels technical and maybe difficult
  2. no nice Object.Property-syntax
  3. Can't use 2sxc pipelines
  4. Can't use 2sxc-built-in serializers and other features

Simple Demo with custom data (for example to use non-SQL data)

This demo uses the 2sxc Pipeline (req. 2sxc 6.0.6+). More info here.

These entities resources are constructed by code

  1. de-de - Herzlich Willkommen
  2. en-us - Welcome

Pros

  1. Typed / dynamic entities
  2. lots of control over object structure
  3. nice syntax, same as any other 2sxc data
  4. any kind of source could be used - XML, file-lists, etc.
  5. Entity-Framework-like feeling without needing pre-compile
  6. Can benefit from other pipeline-features like additional filtering, paging, attribute-stripping
  7. Can be auto-serialized using 2sxc and is then in the default format for JavaScript use
  8. to see the automatic RSS-feed try here

Cons

  1. Probably a bit more performance overhead
  2. more boilerplate / plumbing code (like PetaPoco)
Error rendering template
2serve . 2invent . 2create is 2be.