Ejemplo n.º 1
0
        public static async Task Run(
            [CosmosDBTrigger(
                 databaseName: "%DatabaseName%",
                 collectionName: "%RawCollectionName%",
                 ConnectionStringSetting = "ConnectionString",
                 LeaseCollectionName = "leases",
                 FeedPollDelay = 1000
                 )] IReadOnlyList <Document> input,
            [CosmosDB(
                 databaseName: "%DatabaseName%",
                 collectionName: "%ViewCollectionName%",
                 ConnectionStringSetting = "ConnectionString"
                 )] DocumentClient client,
            ILogger log
            )
        {
            if (input != null && input.Count > 0)
            {
                var p = new ViewProcessor(client, log);

                log.LogInformation($"Processing {input.Count} events");

                foreach (var d in input)
                {
                    var device = Device.FromDocument(d);

                    var tasks = new List <Task>();

                    tasks.Add(p.UpdateDeviceMaterializedView(device));
                    tasks.Add(p.UpdateGlobalMaterializedView(device));

                    await Task.WhenAll(tasks);
                }
            }
        }
Ejemplo n.º 2
0
        private static void BuildDocumentation(string content, List <string> matches)
        {
            ICollection <PgView> views = ViewProcessor.GetViews(Program.SchemaPattern, Program.xSchemaPattern);

            content = content.Replace("[DBName]", Program.Database.ToUpperInvariant());

            content = Parsers.ViewParser.Parse(content, matches, views);

            FileHelper.WriteFile(content, OutputPath);
        }
Ejemplo n.º 3
0
 public IResponse Render(string view, object model, Action <Exception> callback)
 {
     if (callback == null)
     {
         throw new ArgumentNullException("callback");
     }
     if (ViewProcessor == null)
     {
         throw new InvalidOperationException("ViewProcessor is null, unable to process view.");
     }
     ViewProcessor.Render(view, model, (ex, rendered) =>
     {
         Write(rendered);
         callback(ex);
     });
     return(this);
 }