Skip to content

Instantly share code, notes, and snippets.

View StevenTCramer's full-sized avatar

Steven T. Cramer StevenTCramer

View GitHub Profile
@StevenTCramer
StevenTCramer / Dotnet_Background_Jobs
Last active May 7, 2024 11:48
If you are queuing background jobs/work items today in your .NET applications, how are you doing it and what are you using it for?
David Fowler 🇧🇧🇺🇸💉💉💉 on Twitter: "If you are queuing background jobs/work items today in your .NET applications, how are you doing it and what are you using it for? #dotnet #aspnetcore" / Twitter
https://twitter.com/davidfowl/status/1442566223099666436
Background tasks with hosted services in ASP.NET Core | Microsoft Docs
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-6.0&tabs=visual-studio
Messaging that just works — RabbitMQ
https://www.rabbitmq.com/
.NET/C# Client API Guide — RabbitMQ
 █C:\git\temp\Maui█ dotnet workload install maui
Updated advertising manifest microsoft.net.workload.mono.toolchain.
Updated advertising manifest microsoft.net.sdk.tvos.
Updated advertising manifest microsoft.net.sdk.macos.
Updated advertising manifest microsoft.net.sdk.maccatalyst.
Updated advertising manifest microsoft.net.sdk.maui.
Updated advertising manifest microsoft.net.workload.emscripten.
Updated advertising manifest microsoft.net.sdk.android.
Updated advertising manifest microsoft.net.sdk.ios.
lerna init
$lernajson = Get-Content lerna.json -Raw | ConvertFrom-Json
Add-Member -InputObject $lernajson -Name "npmClient" -Value "yarn" -MemberType NoteProperty;
$lernajson | ConvertTo-Json | Set-Content ".\lerna.json";
mkdir packages
cd .\packages
mkdir app
cd app
yarn init -y
@"
import { createLogic } from 'redux-logic';
import * as actionTypes from './constants';
import {loadInitiation, loadSuccess, loadFailure, loadCancel} from './actionCreators';
const url = 'https://raw.githubusercontent.com/RyanCCollins/scalable-react-ts-boilerplate/master/README.md';
//This logic fails.
export const fetchLogic = createLogic({
type: actionTypes.LOAD_INTIATION,
cancelType: actionTypes.LOAD_CANCEL,
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication1
{
class App
{
public List<List<Item>> Nodes { get; set; }
public Item Head { get; set; }
@StevenTCramer
StevenTCramer / Program.cs
Created July 3, 2016 20:35
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 2163.
using System;
namespace KaggleConsoleApplication
{
class Program
{
static void Main(string[] args)
{
int total=0;
public class Command : IRequest
{
private MyDbContext MyDbContext { get; }
public Command(MyDbContext aMyDbContext)
{
MyDbContext = aMyDbContext;
}
public int ProjectId { get; set; }
public void CreateProject()
{
var createProjectCommand = Resolve<Create.Command>();
createProjectCommand.Description = "Description";
Create.Result result = Send(createProjectCommand);
var project = Query(aDbContext => aDbContext.Projects.Find(result.ProjectId));
project.Description.ShouldEqual(createProjectCommand.Description);
}
@StevenTCramer
StevenTCramer / Project.Create
Created February 5, 2016 19:48
How to get entity Id in result without changing your pipeline.
namespace Feature.Project
public class Create
{
...
public class Result
{
private Project Project{ get; }
public Result(Project aProject)
{
...
if (allEntitiesAttribute != null)
{
var dbContext = new MyDbContext();
return ((IObjectContextAdapter)dbContext)
.ObjectContext
.MetadataWorkspace
.GetItems<EntityType>(DataSpace.OSpace)
.Select(e => Type.GetType(e.FullName))