View gist:764ed0b37e62c34f14299d41b53ae92b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let queryRUChargeData = AzureDiagnostics | |
| where Category == "DataPlaneRequests" | |
| where OperationName == "Query" | |
| project requestCharge_s, operationType_s, activityId_g, databaseName_s, collectionName_s, requestResourceType_s, requestResourceId_s, OperationName, TimeGenerated, callerId_s, clientIpAddress_s, userAgent_s; | |
AzureDiagnostics | |
| where Category == "QueryRuntimeStatistics" | |
| join queryRUChargeData on $left.activityId_g == $right.activityId_g | |
| summarize SumRU = sum(todouble(requestCharge_s1)), Count = count(requestCharge_s1) by collectionname_s |
View wordpress-to-hugo-migrator.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// it was easier to describe this file on my blog that here: | |
// https://radekmaziarka.pl/2020/04/12/markdown-generation | |
'use strict'; | |
const fs = require('fs'); | |
const path = require('path'); | |
const xml2js = require('xml2js'); | |
const TurndownService = require('turndown'); | |
var moment = require('moment'); |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static async Task Main(string[] args) | |
{ | |
Console.WriteLine("Hello World!"); | |
try | |
{ | |
await CreateTableAsync("tags"); |
View Category.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Category | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } | |
public List<Field> Fields { get; set; } | |
} |
View ProductReadModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProductReadModel | |
{ | |
public ProductReadModel(ProductAddedEvent @event) | |
{ | |
Id = @event.Id; | |
Name = @event.Name; | |
CategoryId = @event.CategoryId; | |
OrderAmount = 0; | |
Review = new ReviewReadModel(); |
View ProductReadModelCreation.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO ProductReadModel | |
SELECT | |
P.[Id], | |
P.[Name], | |
P.[CategoryId], | |
( | |
SELECT | |
COUNT(O.Id) | |
FROM | |
OrderItems AS O |
View EventHandlers.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProductAddedEventHandler: INotificationHandler<ProductAddedEvent> | |
{ | |
private readonly IProductReadModelRepository _repo; | |
public ProductAddedEventHandler(IProductReadModelRepository repo) | |
{ | |
_repo = repo; | |
} | |
public void Handle(ProductAddedEvent @event) |
View CommandHandlers.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AddProductCommandHandler : IRequestHandler<AddProductCommand> | |
{ | |
private readonly ProductDatabase _database; | |
private readonly IMediator _mediator; | |
public AddProductCommandHandler(ProductDatabase database, IMediator mediator) | |
{ | |
_database = database; | |
_mediator = mediator; | |
} |
View Events.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProductAddedEvent : INotification | |
{ | |
public ProductAddedEvent(int id, string name, int categoryId) | |
{ | |
Id = id; | |
Name = name; | |
CategoryId = categoryId; | |
} | |
public int Id { get; } |
View Product.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Product | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } | |
public decimal Price { get; set; } | |
public DateTime CreationDate { get; set; } |
NewerOlder