Skip to content

Instantly share code, notes, and snippets.

View jeremydmiller's full-sized avatar

Jeremy D. Miller jeremydmiller

View GitHub Profile
@jeremydmiller
jeremydmiller / post_one.cs
Last active May 16, 2018 13:38
Code Generated for post_one method
public class SqlSender_HomeEndpoint_post_one : Jasper.Http.Model.RouteHandler
{
private readonly SqlServerSettings _sqlServerSettings;
private readonly IMessagingRoot _messagingRoot;
public SqlSender_HomeEndpoint_post_one(SqlServerSettings sqlServerSettings, IMessagingRoot messagingRoot)
{
_sqlServerSettings = sqlServerSettings;
_messagingRoot = messagingRoot;
}
@jeremydmiller
jeremydmiller / bluemilk.txt
Created February 20, 2018 22:28
BlueMilk v. StructureMap Performance
What this benchmark does is bootstrap an ASP.Net Core system with MVC and AddLogging,
then try to create every single registered type that is common between the two
configurations. Throws out the initial run.
Method | Mean | Error | StdDev |
------------- |----------:|---------:|---------:|
StructureMap | 516.72 us | 4.310 us | 3.599 us |
BlueMilk | 86.04 us | 1.214 us | 1.076 us |
public class RavenDBRepository<T, I> : IRepository<T, I> where T: IAggregateRoot<I> where I : struct, IIdentity<I>
{
private readonly IAsyncDocumentSession _session;
public RavenDBRepository(IAsyncDocumentSession session)
{
_session = session;
}
public async Task<T> GetAsync(I identity)
// Yes Dorothy, this is some circular reference action going on here.
// We'll get it sorted out later
using System;
using System.Security.Cryptography.X509Certificates;
namespace BlueMilk.Tests
{
public class WorkItem
{
public DateTime Started { get; set; }
}
protected Upsert(object document)
{
// The first time I checked for "Document == null", so it threw
// EVERY TIME
if (document == null) throw new ArgumentNullException(nameof(document));
Document = document;
}
@jeremydmiller
jeremydmiller / gist:479c9be61cbabdb25b1be4642fb18637
Created January 5, 2017 14:34
Storyteller 4.0 Release Plans
Hey @all, happy New Year to everybody. I’m needing to get Storyteller 4 ready for our internal usage soon and I’m running out of steam, so I’ve pared back the goals for the 4.0 release. You can see everything I’m thinking for a release timeline in the Github milestones: https://github.com/storyteller/Storyteller/milestones
What’s in: markdown persistence, the mechanism to define the fixture language in markdown, the step through mode, bug fixes, and CoreCLR/dotnet cli support
I’m pushing off being able to export spec visualizations, more performance tracking, and spec tagging until 4.1 sometime around maybe the end of the 1st quarter.
Any thoughts on any of this? Anybody willing to try out the 4.0 alpha in a couple weeks?
And I’m definitely bailing out on specification parallelization until a 5.0 release later this year
ASP.Net Core and its MVC framework represent a big change from what's come before from Microsoft.
In this talk I'd like to dive deep into the internals of MVC Core to see what lessons we can
learn about designing software infrastructure in our own work. In specific, I'd like to dive into
MVC Core's usage of middleware, its runtime pipeline, how it supports extensibility scenarios,
diagnostics, and application configuration. As an author and maintainer of a
common IoC tool (StructureMap), I can speak to the much more complicated way that MVC Core
uses IoC containers within its pipeline and the places where I think their usage is going to be
problematic for users.
As the author of a previous OSS web framework (FubuMVC), I can share some insights by comparing
/// <summary>
/// This is a big THANK YOU to the BCL for not hooking a brotha' up
/// This add will tell WHAT KEY you added twice.
/// </summary>
public static void SmartAdd<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue value)
{
try
{
dictionary.Add(key, value);
}
Let's say that you're building HTTP services, and some of your HTTP endpoints will need to return some sort of "readside" representation of your persisted domain model. For the purpose of making Marten shine, let's say that you're going to need to work with hierarchical data. In a common .Net technology stack, you'd:
Load the top level model object through Entity Framework or some other kind of ORM. EF would issue a convoluted SQL query with lots of OUTER JOIN's so that it can make a single call to the database to fetch the entire hierarchy of data you need. EF would then proceed to tear through the sparsely populated recordset coming back and turn that into the actual domain model object represented by the data with lots of internally generated code.
You'd then use something like AutoMapper to transform the domain model object into a "read side" Data Transfer Object (view models, etc.) that's more suitable to going over the wire to clients outside of your service.
Serialize your DTO to a JSON string and wri