Fredrick Lackey - 112 - Apr 5, 2014

Anyone ever use a CHAR data type as a PK / FK on SQL Server using ServiceStack?  Any issues doing this?  The goal is to have a very small PK (similar to TinyInt) but with a bit cleaner control within C#.

Just try it, can’t see why it would be an issue.

Fredrick Lackey:

Had to ditch the idea.  Haven’t had time to look into the underlying reasons, however many of the extensions / helpers were mismatched while querying.  For example, some would convert to int while others to string.  Ended up reverting back to a string data type with a StringLength(1) attribute.  Even though that’ll create a varchar data type in the database, if I want to reduce it to a char(1) I can override the creation of the table.