Giter Club home page Giter Club logo

transformalize.provider.velocity's Introduction

Overview

This adds a velocity provider and transform to Transformalize using NVelocity.

Build the Autofac project and put it's output into Transformalize's plugins folder.

Write Usage

<add name='TestProcess' mode='init'>
  <connections>
    <add name='input' provider='bogus' seed='1' />
    <add name='output' provider='Velocity' template='template.vtl' file='output.html' />
  </connections>
  <entities>
    <add name='Contact' size='1000'>
      <fields>
        <add name='Identity' type='int' primary-key='true' />
        <add name='FirstName' />
        <add name='LastName' />
        <add name='Stars' type='byte' min='1' max='5' />
        <add name='Reviewers' type='int' min='0' max='500' />
      </fields>
    </add>
  </entities>
</add>

This writes 1000 rows of bogus data to output.html.

The template template.vtl is passed a VelocityModel. The template in this example looks like this:

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title>Velocity Output</title>
</head>
<body>
    <table>
        <thead>
            <tr>
                #foreach($field in $Model.Entity.Fields)
                    #if(!$field.System)<th>$field.Label</th> #end
                #end
            </tr>
        </thead>
        <tbody>
            #foreach($row in $Model.Rows)
                <tr>
                    #foreach($field in $Model.Entity.Fields)
                        #if(!$field.System)<td>$row.get_Item($field)</td> #end
                    #end
                </tr>
                #set( $Model.Entity.Inserts = $Model.Entity.Inserts + 1 )
            #end
        </tbody>
    </table>
</body>
</html>

The table in output.html looks like this (clipped for brevity):

Identity FirstName LastName Stars Reviewers
1 Justin Konopelski 3 153
2 Eula Schinner 2 41
3 Tanya Shanahan 4 412
4 Emilio Hand 4 469
5 Rachel Abshire 3 341

Benchmark

Note: Numbers get better with more records.

BenchmarkDotNet=v0.11.4, OS=Windows 10.0.17134.407 (1803/April2018Update/Redstone4)
Intel Core i7-7700HQ CPU 2.80GHz (Kaby Lake), 1 CPU, 8 logical and 4 physical cores
Frequency=2742192 Hz, Resolution=364.6718 ns, Timer=TSC
  [Host]       : .NET Framework 4.7.2 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.7.3221.0
  LegacyJitX64 : .NET Framework 4.7.2 (CLR 4.0.30319.42000), 64bit LegacyJIT/clrjit-v4.7.3221.0;compatjit-v4.7.3221.0

Job=LegacyJitX64  Jit=LegacyJit  Platform=X64  
Runtime=Clr  
Method Mean Error StdDev Median Ratio RatioSD
'10000 test rows' 987.5 ms 22.37 ms 44.68 ms 968.8 ms 1.00 0.00
'10000 rows with 1 Velocity' 1,726.7 ms 27.51 ms 25.74 ms 1,722.5 ms 1.75 0.07

transformalize.provider.velocity's People

Contributors

dalenewman avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.