Skip to content

Instantly share code, notes, and snippets.

@agrath
agrath / SmartPropertyType.cs
Last active March 26, 2018 10:49
An example of dynamically generated strong properties for Umbraco ModelsBuilder
//A PublishEventHandler catches the DataTypeService.Saved method as a developer workflow entry point;
//When the data type is saved this kicks off the generation and writes a model to our models folder
//This could be app_code if you don't use VS to build your solution, but we generate our ModelsBuilder models
//into a class which is then built as part of the solution
internal class PublishEventHandler : ApplicationEventHandler
{
public const string FileSuffix = ".smartpropertytype.cs";
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
Date Value
2016-06-30T15:27:00 81.5
2016-06-30T15:27:05 93.9
2016-06-30T15:27:06 9
2016-06-30T15:27:41 31.4
2016-06-30T15:29:39 50.6
2016-06-30T15:30:12 32.4
2016-06-30T15:39:46 39.8
2016-06-30T15:42:49 62.5
2016-06-30T15:47:08 26.3
function eachAsync(collection, iterator, callback) {
var iterate = function(i) {
setTimeout(function() {
iterator(collection[i]);
if (i < collection.length-1) {
iterate(i + 1);
} else {
if(callback) callback();
}
}, 0);