Skip to content

Instantly share code, notes, and snippets.

@clement911
clement911 / 1_DbContextExtension.cs
Last active February 28, 2024 09:37
Record DB commands generated by EF core queries
public static IReadOnlyCollection<DbBatchCommand> RecordCommands<TContext, TResult>(this TContext dbCtx, params Func<TContext, TResult>[] getResults) where TContext : DbContext
{
using (RecordCommandsScope.StartNew())
{
foreach (var getResult in getResults)
getResult(dbCtx);
return RecordCommandsScope.Current.RecordedCommands;
}
}
let res = await fetch('https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json');
let spec = await res.json();
function printRequiredParametersOnGet()
{
for (let path in spec.paths)
{
if (path.indexOf('{') >= 0)
continue;
let verbs = spec.paths[path];