Eli Weinstock-Herman
"If it wasn't hard, everyone would do it. It's the hard that makes it great."
Tom Hanks

Creating a local Service Fabric Cluster

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

Working with Service Fabric and want a local cluster to test and develop against? Here’s the step-by-step path I took from a set of fresh Windows VMs to a running, secured Service Fabric cluster using self-signed X509 certificates. There are a number of Microsoft docs that cover this subject, this is a single beginning-to-end path that also includes fixes for gaps or errors in those docs as I went.

Here are the technical details:

  • 3 Hyper-V VMs running Windows 2016 x64, single-core, 2046MB RAM
  • ServiceFabric 5.6.220.9494

My VMs are:

  • SFNode0 – 192.168.1.200
  • SFNode1 –...
Continue reading

Multiple NuGet Methods for VS2017 + MSBuild 15 in TeamCity

Original post posted on Wednesday, July 19, 2017 at LessThanDot.com

ASP.Net Projects and NuGet have been a moving target the last couple years. I have an ASP.Net Core project (.Net Framework) with several class libraries and had to work through a number of problems to get NuGet Restore working on a TeamCity CI server. Hopefully this will help someone else along the way.

It turns out I have 3 situations:

  • ASP.Net Core uses the new PackageReference for packages instead of packages.json
  • Other C# Projects still use the packages.json method for packages
  • Solution packages (great for tooling) are (still) not supported after VS 2013 (NuGet #522)

(the last couple...

Continue reading

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

Useful Projects