Eli Weinstock-Herman
"Great ideas need landing gear as well as wings."
C.D. Jackson

Mapping Complex types to/from JSON with JSON.Net

Original post posted on Friday, July 7, 2017 at LessThanDot.com

In an earlier post I introduced a strongly typed Identity object I am using in an ASP.Net Core application to make my code and error messages more readable. I didn’t wanted that extra complexity reflected in my database or over the wire with an API. In this post we’ll look at a simple method to map my strongly typed properties in C# to simpler values in JSON.

This is my desired state:

I want a strongly typed Identity object in my API backend that transparently converts into a simple int value to/from the database and converts to an int or null for the front-end (null in cases...

Continue reading

SPA Routing in ASP.Net Core

Original post posted on Friday, June 30, 2017 at LessThanDot.com

One of the challenges of SPA applications is making sure a bookmark or hard refresh knows how to load just enough of the content from the server before applying the client-side routing logic to that base page.

This is not guaranteed to be the only way to do this, just the one that worked for me.

Goals:
1. Static files to live in “Assets” instead of “wwwroot”
2. Client-side routes like ~/configure/userScenarios to return ~/index.html when the browser loads them
3. No extra work to remember when I add new configuration pages client-side

Program.cs – Rename WebRoot

...
Continue reading

Mapping Complex Types to/from the DB with PetaPoco

Original post posted on Tuesday, June 20, 2017 at LessThanDot.com

Recently I was working on an application with rich C# objects that I wanted to store simplified in the database, without having to write custom logic for each new save or query that I add to the application. Luckily, the library I had chosen for data access (AsyncPoco, a variant Petapoco) has a mechanism that can automatically map complex C# Types to simpler SQL types.

Case 1: Strongly Typed Identities to SQL ints

A complex web application can end up passing object id’s...

Continue reading

Creating a Static-Generated Marketing Site

Original post posted on Wednesday, April 26, 2017 at LessThanDot.com

If you’re working on a free product or startup, you’re probably thinking frequently about how to balance your time across all the things that need doing. One of those millions of things is getting a marketing site up to tell people about your amazing thing, and do so in a way that looks professional, is easy to update and redeploy, doesn’t turn into a whole separate coding project, and so on.

Because I spend cycles thinking about things like this in my free time, I started looking into static site generators as a potential way to balance dynamic-enough with...

Continue reading

Learning Elixir and Phoenix – Getting a handle on the language

Original post posted on Thursday, March 23, 2017 at LessThanDot.com

Recently I started learning Elixir and the Phoenix framework. I’ve found that mixing hands on programming with reading is the fastest way for me to get up to speed with a new language or framework, so if that’s your style you might find this useful. In this post I started at zero and ended at being able to write small modules, run unit tests, and work with the interactive console.

Previous Post: Learning Elixir and Phoenix – Environments and Editors

As I stated before, my goal is to get from “barely able to read it” to “able to ship readable, idiomatic, testable apps”. This ...

Continue reading

Useful Projects

Recent Bookmarks