[{"data":1,"prerenderedAt":1799},["ShallowReactive",2],{"blog:2018:model-binding-form-posts-to-immutable-objects":3,"blogMore-Development":1738,"comments-model-binding-form-posts-to-immutable-objects":1751},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"category":11,"tags":12,"excerpt":16,"body":31,"_type":1730,"_id":1731,"_source":1732,"_file":1733,"_stem":1734,"_extension":1735,"url":1736,"wordCount":1737,"minutes":261,"commentCount":104},"/blog/2018/model-binding-form-posts-to-immutable-objects","2018",false,"en","Model binding form posts to immutable objects","I've been working on porting over my blog to a static site generator. I fired up an Azure Function to handle the form-comment to PR process to enable user comments to still be part of the site without using a 3rd party commenting system - more on that in the next post - and found the ASP.NET model binding for form posts distinctly lacking.","2018-04-11T22:30:00","Development",[13,14,15],".NET","Azure","C#",{"type":17,"children":18},"root",[19,26],{"type":20,"tag":21,"props":22,"children":23},"element","p",{},[24],{"type":25,"value":9},"text",{"type":20,"tag":21,"props":27,"children":28},{},[29],{"type":25,"value":30},"It's been great getting back into .NET and brushing up some skills making the code clear, short and reusable. What I wanted was a super-clear action on my controller that tried to collect, validate and sanitize the data then, if all was well, create the pull request or report errors.",{"type":17,"children":32,"toc":1728},[33,37,41,46,439,444,449,1155,1183,1195,1699,1713,1722],{"type":20,"tag":21,"props":34,"children":35},{},[36],{"type":25,"value":9},{"type":20,"tag":21,"props":38,"children":39},{},[40],{"type":25,"value":30},{"type":20,"tag":21,"props":42,"children":43},{},[44],{"type":25,"value":45},"Ideally, it would look like this;",{"type":20,"tag":47,"props":48,"children":53},"pre",{"className":49,"code":50,"language":51,"meta":52,"style":52},"language-csharp shiki shiki-themes everforest-light dracula","[FunctionName(\"PostComment\")]\npublic static async Task\u003CHttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, \"post\")] HttpRequestMessage request) {\n    var form = await request.Content.ReadAsFormDataAsync();\n    if (TryCreateComment(form, out Comment comment, out var errors))\n        await CreateCommentAsPullRequest(comment);\n    return request.CreateResponse(errors.Any()\n      ? HttpStatusCode.BadRequest : HttpStatusCode.OK, String.Join(\"\\n\", errors));\n}\n","csharp","",[54],{"type":20,"tag":55,"props":56,"children":57},"code",{"__ignoreMap":52},[58,102,208,259,312,331,364,430],{"type":20,"tag":59,"props":60,"children":63},"span",{"class":61,"line":62},"line",1,[64,70,76,81,87,93,97],{"type":20,"tag":59,"props":65,"children":67},{"style":66},"--shiki-default:#5C6A72;--shiki-dark:#F8F8F2",[68],{"type":25,"value":69},"[",{"type":20,"tag":59,"props":71,"children":73},{"style":72},"--shiki-default:#3A94C5;--shiki-default-font-style:inherit;--shiki-dark:#8BE9FD;--shiki-dark-font-style:italic",[74],{"type":25,"value":75},"FunctionName",{"type":20,"tag":59,"props":77,"children":78},{"style":66},[79],{"type":25,"value":80},"(",{"type":20,"tag":59,"props":82,"children":84},{"style":83},"--shiki-default:#8DA101;--shiki-dark:#E9F284",[85],{"type":25,"value":86},"\"",{"type":20,"tag":59,"props":88,"children":90},{"style":89},"--shiki-default:#8DA101;--shiki-dark:#F1FA8C",[91],{"type":25,"value":92},"PostComment",{"type":20,"tag":59,"props":94,"children":95},{"style":83},[96],{"type":25,"value":86},{"type":20,"tag":59,"props":98,"children":99},{"style":66},[100],{"type":25,"value":101},")]\n",{"type":20,"tag":59,"props":103,"children":105},{"class":61,"line":104},2,[106,112,117,122,127,132,137,142,148,153,158,163,169,174,178,183,187,192,197,203],{"type":20,"tag":59,"props":107,"children":109},{"style":108},"--shiki-default:#F57D26;--shiki-dark:#FF79C6",[110],{"type":25,"value":111},"public",{"type":20,"tag":59,"props":113,"children":114},{"style":108},[115],{"type":25,"value":116}," static",{"type":20,"tag":59,"props":118,"children":119},{"style":108},[120],{"type":25,"value":121}," async",{"type":20,"tag":59,"props":123,"children":124},{"style":72},[125],{"type":25,"value":126}," Task",{"type":20,"tag":59,"props":128,"children":129},{"style":66},[130],{"type":25,"value":131},"\u003C",{"type":20,"tag":59,"props":133,"children":134},{"style":72},[135],{"type":25,"value":136},"HttpResponseMessage",{"type":20,"tag":59,"props":138,"children":139},{"style":66},[140],{"type":25,"value":141},"> ",{"type":20,"tag":59,"props":143,"children":145},{"style":144},"--shiki-default:#8DA101;--shiki-dark:#50FA7B",[146],{"type":25,"value":147},"Run",{"type":20,"tag":59,"props":149,"children":150},{"style":66},[151],{"type":25,"value":152},"([",{"type":20,"tag":59,"props":154,"children":155},{"style":72},[156],{"type":25,"value":157},"HttpTrigger",{"type":20,"tag":59,"props":159,"children":160},{"style":66},[161],{"type":25,"value":162},"(AuthorizationLevel.",{"type":20,"tag":59,"props":164,"children":166},{"style":165},"--shiki-default:#35A77C;--shiki-dark:#F8F8F2",[167],{"type":25,"value":168},"Anonymous",{"type":20,"tag":59,"props":170,"children":171},{"style":66},[172],{"type":25,"value":173},", ",{"type":20,"tag":59,"props":175,"children":176},{"style":83},[177],{"type":25,"value":86},{"type":20,"tag":59,"props":179,"children":180},{"style":89},[181],{"type":25,"value":182},"post",{"type":20,"tag":59,"props":184,"children":185},{"style":83},[186],{"type":25,"value":86},{"type":20,"tag":59,"props":188,"children":189},{"style":66},[190],{"type":25,"value":191},")] ",{"type":20,"tag":59,"props":193,"children":194},{"style":72},[195],{"type":25,"value":196},"HttpRequestMessage",{"type":20,"tag":59,"props":198,"children":200},{"style":199},"--shiki-default:#5C6A72;--shiki-default-font-style:inherit;--shiki-dark:#FFB86C;--shiki-dark-font-style:italic",[201],{"type":25,"value":202}," request",{"type":20,"tag":59,"props":204,"children":205},{"style":66},[206],{"type":25,"value":207},") {\n",{"type":20,"tag":59,"props":209,"children":211},{"class":61,"line":210},3,[212,218,223,228,234,239,244,249,254],{"type":20,"tag":59,"props":213,"children":215},{"style":214},"--shiki-default:#3A94C5;--shiki-dark:#FF79C6",[216],{"type":25,"value":217},"    var",{"type":20,"tag":59,"props":219,"children":220},{"style":66},[221],{"type":25,"value":222}," form ",{"type":20,"tag":59,"props":224,"children":225},{"style":108},[226],{"type":25,"value":227},"=",{"type":20,"tag":59,"props":229,"children":231},{"style":230},"--shiki-default:#F85552;--shiki-dark:#FF79C6",[232],{"type":25,"value":233}," await",{"type":20,"tag":59,"props":235,"children":236},{"style":66},[237],{"type":25,"value":238}," request.",{"type":20,"tag":59,"props":240,"children":241},{"style":165},[242],{"type":25,"value":243},"Content",{"type":20,"tag":59,"props":245,"children":246},{"style":66},[247],{"type":25,"value":248},".",{"type":20,"tag":59,"props":250,"children":251},{"style":144},[252],{"type":25,"value":253},"ReadAsFormDataAsync",{"type":20,"tag":59,"props":255,"children":256},{"style":66},[257],{"type":25,"value":258},"();\n",{"type":20,"tag":59,"props":260,"children":262},{"class":61,"line":261},4,[263,268,273,278,283,288,293,298,302,307],{"type":20,"tag":59,"props":264,"children":265},{"style":230},[266],{"type":25,"value":267},"    if",{"type":20,"tag":59,"props":269,"children":270},{"style":66},[271],{"type":25,"value":272}," (",{"type":20,"tag":59,"props":274,"children":275},{"style":144},[276],{"type":25,"value":277},"TryCreateComment",{"type":20,"tag":59,"props":279,"children":280},{"style":66},[281],{"type":25,"value":282},"(form, ",{"type":20,"tag":59,"props":284,"children":285},{"style":108},[286],{"type":25,"value":287},"out",{"type":20,"tag":59,"props":289,"children":290},{"style":72},[291],{"type":25,"value":292}," Comment",{"type":20,"tag":59,"props":294,"children":295},{"style":66},[296],{"type":25,"value":297}," comment, ",{"type":20,"tag":59,"props":299,"children":300},{"style":108},[301],{"type":25,"value":287},{"type":20,"tag":59,"props":303,"children":304},{"style":214},[305],{"type":25,"value":306}," var",{"type":20,"tag":59,"props":308,"children":309},{"style":66},[310],{"type":25,"value":311}," errors))\n",{"type":20,"tag":59,"props":313,"children":315},{"class":61,"line":314},5,[316,321,326],{"type":20,"tag":59,"props":317,"children":318},{"style":230},[319],{"type":25,"value":320},"        await",{"type":20,"tag":59,"props":322,"children":323},{"style":144},[324],{"type":25,"value":325}," CreateCommentAsPullRequest",{"type":20,"tag":59,"props":327,"children":328},{"style":66},[329],{"type":25,"value":330},"(comment);\n",{"type":20,"tag":59,"props":332,"children":334},{"class":61,"line":333},6,[335,340,344,349,354,359],{"type":20,"tag":59,"props":336,"children":337},{"style":230},[338],{"type":25,"value":339},"    return",{"type":20,"tag":59,"props":341,"children":342},{"style":66},[343],{"type":25,"value":238},{"type":20,"tag":59,"props":345,"children":346},{"style":144},[347],{"type":25,"value":348},"CreateResponse",{"type":20,"tag":59,"props":350,"children":351},{"style":66},[352],{"type":25,"value":353},"(errors.",{"type":20,"tag":59,"props":355,"children":356},{"style":144},[357],{"type":25,"value":358},"Any",{"type":20,"tag":59,"props":360,"children":361},{"style":66},[362],{"type":25,"value":363},"()\n",{"type":20,"tag":59,"props":365,"children":367},{"class":61,"line":366},7,[368,373,378,383,388,392,397,402,407,411,415,421,425],{"type":20,"tag":59,"props":369,"children":370},{"style":108},[371],{"type":25,"value":372},"      ?",{"type":20,"tag":59,"props":374,"children":375},{"style":66},[376],{"type":25,"value":377}," HttpStatusCode.",{"type":20,"tag":59,"props":379,"children":380},{"style":165},[381],{"type":25,"value":382},"BadRequest",{"type":20,"tag":59,"props":384,"children":385},{"style":108},[386],{"type":25,"value":387}," :",{"type":20,"tag":59,"props":389,"children":390},{"style":66},[391],{"type":25,"value":377},{"type":20,"tag":59,"props":393,"children":394},{"style":165},[395],{"type":25,"value":396},"OK",{"type":20,"tag":59,"props":398,"children":399},{"style":66},[400],{"type":25,"value":401},", String.",{"type":20,"tag":59,"props":403,"children":404},{"style":144},[405],{"type":25,"value":406},"Join",{"type":20,"tag":59,"props":408,"children":409},{"style":66},[410],{"type":25,"value":80},{"type":20,"tag":59,"props":412,"children":413},{"style":83},[414],{"type":25,"value":86},{"type":20,"tag":59,"props":416,"children":418},{"style":417},"--shiki-default:#DFA000;--shiki-dark:#FF79C6",[419],{"type":25,"value":420},"\\n",{"type":20,"tag":59,"props":422,"children":423},{"style":83},[424],{"type":25,"value":86},{"type":20,"tag":59,"props":426,"children":427},{"style":66},[428],{"type":25,"value":429},", errors));\n",{"type":20,"tag":59,"props":431,"children":433},{"class":61,"line":432},8,[434],{"type":20,"tag":59,"props":435,"children":436},{"style":66},[437],{"type":25,"value":438},"}\n",{"type":20,"tag":21,"props":440,"children":441},{},[442],{"type":25,"value":443},"To do that, we need a function capable of creating the Comment class from the form post. You could manually do it field by field, but that's not reusable, highly repetitive, and, of course, no fun. The Comment class is - like all well-behaved little objects - immutable.",{"type":20,"tag":21,"props":445,"children":446},{},[447],{"type":25,"value":448},"Creating a function to do this is simple with a little bit of reflection;",{"type":20,"tag":47,"props":450,"children":452},{"className":49,"code":451,"language":51,"meta":52,"style":52},"private static object ConvertParameter(string parameter, Type targetType) {\n    return String.IsNullOrWhiteSpace(parameter)\n           ? null : TypeDescriptor.GetConverter(targetType).ConvertFrom(parameter);\n}\n\nprivate static bool TryCreateCommentFromForm(NameValueCollection form, out Comment comment, out List\u003Cstring> errors) {\n    var constructor = typeof(Comment).GetConstructors()[0];\n    var values = constructor.GetParameters()\n                            .ToDictionary(p => p.Name, p => ConvertParameter(form[p.Name], p.ParameterType)\n                                      ?? (p.HasDefaultValue ? p.DefaultValue : new MissingRequiredValue()));\n    errors = values.Where(p => p.Value is MissingRequiredValue)\n                   .Select(p => $\"Form value missing for '{p.Key}'\").ToList();\n    comment = errors.Any() ? null : (Comment)constructor.Invoke(values.Values.ToArray());\n    return !errors.Any();\n}\n",[453],{"type":20,"tag":55,"props":454,"children":455},{"__ignoreMap":52},[456,510,532,575,582,591,677,732,762,848,900,957,1039,1121,1147],{"type":20,"tag":59,"props":457,"children":458},{"class":61,"line":62},[459,464,468,473,478,482,487,492,496,501,506],{"type":20,"tag":59,"props":460,"children":461},{"style":108},[462],{"type":25,"value":463},"private",{"type":20,"tag":59,"props":465,"children":466},{"style":108},[467],{"type":25,"value":116},{"type":20,"tag":59,"props":469,"children":470},{"style":214},[471],{"type":25,"value":472}," object",{"type":20,"tag":59,"props":474,"children":475},{"style":144},[476],{"type":25,"value":477}," ConvertParameter",{"type":20,"tag":59,"props":479,"children":480},{"style":66},[481],{"type":25,"value":80},{"type":20,"tag":59,"props":483,"children":484},{"style":214},[485],{"type":25,"value":486},"string",{"type":20,"tag":59,"props":488,"children":489},{"style":199},[490],{"type":25,"value":491}," parameter",{"type":20,"tag":59,"props":493,"children":494},{"style":66},[495],{"type":25,"value":173},{"type":20,"tag":59,"props":497,"children":498},{"style":72},[499],{"type":25,"value":500},"Type",{"type":20,"tag":59,"props":502,"children":503},{"style":199},[504],{"type":25,"value":505}," targetType",{"type":20,"tag":59,"props":507,"children":508},{"style":66},[509],{"type":25,"value":207},{"type":20,"tag":59,"props":511,"children":512},{"class":61,"line":104},[513,517,522,527],{"type":20,"tag":59,"props":514,"children":515},{"style":230},[516],{"type":25,"value":339},{"type":20,"tag":59,"props":518,"children":519},{"style":66},[520],{"type":25,"value":521}," String.",{"type":20,"tag":59,"props":523,"children":524},{"style":144},[525],{"type":25,"value":526},"IsNullOrWhiteSpace",{"type":20,"tag":59,"props":528,"children":529},{"style":66},[530],{"type":25,"value":531},"(parameter)\n",{"type":20,"tag":59,"props":533,"children":534},{"class":61,"line":210},[535,540,546,550,555,560,565,570],{"type":20,"tag":59,"props":536,"children":537},{"style":108},[538],{"type":25,"value":539},"           ?",{"type":20,"tag":59,"props":541,"children":543},{"style":542},"--shiki-default:#DF69BA;--shiki-dark:#BD93F9",[544],{"type":25,"value":545}," null",{"type":20,"tag":59,"props":547,"children":548},{"style":108},[549],{"type":25,"value":387},{"type":20,"tag":59,"props":551,"children":552},{"style":66},[553],{"type":25,"value":554}," TypeDescriptor.",{"type":20,"tag":59,"props":556,"children":557},{"style":144},[558],{"type":25,"value":559},"GetConverter",{"type":20,"tag":59,"props":561,"children":562},{"style":66},[563],{"type":25,"value":564},"(targetType).",{"type":20,"tag":59,"props":566,"children":567},{"style":144},[568],{"type":25,"value":569},"ConvertFrom",{"type":20,"tag":59,"props":571,"children":572},{"style":66},[573],{"type":25,"value":574},"(parameter);\n",{"type":20,"tag":59,"props":576,"children":577},{"class":61,"line":261},[578],{"type":20,"tag":59,"props":579,"children":580},{"style":66},[581],{"type":25,"value":438},{"type":20,"tag":59,"props":583,"children":584},{"class":61,"line":314},[585],{"type":20,"tag":59,"props":586,"children":588},{"emptyLinePlaceholder":587},true,[589],{"type":25,"value":590},"\n",{"type":20,"tag":59,"props":592,"children":593},{"class":61,"line":333},[594,598,602,607,612,616,621,626,630,634,638,643,647,651,656,660,664,668,673],{"type":20,"tag":59,"props":595,"children":596},{"style":108},[597],{"type":25,"value":463},{"type":20,"tag":59,"props":599,"children":600},{"style":108},[601],{"type":25,"value":116},{"type":20,"tag":59,"props":603,"children":604},{"style":214},[605],{"type":25,"value":606}," bool",{"type":20,"tag":59,"props":608,"children":609},{"style":144},[610],{"type":25,"value":611}," TryCreateCommentFromForm",{"type":20,"tag":59,"props":613,"children":614},{"style":66},[615],{"type":25,"value":80},{"type":20,"tag":59,"props":617,"children":618},{"style":72},[619],{"type":25,"value":620},"NameValueCollection",{"type":20,"tag":59,"props":622,"children":623},{"style":199},[624],{"type":25,"value":625}," form",{"type":20,"tag":59,"props":627,"children":628},{"style":66},[629],{"type":25,"value":173},{"type":20,"tag":59,"props":631,"children":632},{"style":108},[633],{"type":25,"value":287},{"type":20,"tag":59,"props":635,"children":636},{"style":72},[637],{"type":25,"value":292},{"type":20,"tag":59,"props":639,"children":640},{"style":199},[641],{"type":25,"value":642}," comment",{"type":20,"tag":59,"props":644,"children":645},{"style":66},[646],{"type":25,"value":173},{"type":20,"tag":59,"props":648,"children":649},{"style":108},[650],{"type":25,"value":287},{"type":20,"tag":59,"props":652,"children":653},{"style":72},[654],{"type":25,"value":655}," List",{"type":20,"tag":59,"props":657,"children":658},{"style":66},[659],{"type":25,"value":131},{"type":20,"tag":59,"props":661,"children":662},{"style":214},[663],{"type":25,"value":486},{"type":20,"tag":59,"props":665,"children":666},{"style":66},[667],{"type":25,"value":141},{"type":20,"tag":59,"props":669,"children":670},{"style":199},[671],{"type":25,"value":672},"errors",{"type":20,"tag":59,"props":674,"children":675},{"style":66},[676],{"type":25,"value":207},{"type":20,"tag":59,"props":678,"children":679},{"class":61,"line":366},[680,684,689,693,698,702,707,712,717,722,727],{"type":20,"tag":59,"props":681,"children":682},{"style":214},[683],{"type":25,"value":217},{"type":20,"tag":59,"props":685,"children":686},{"style":66},[687],{"type":25,"value":688}," constructor ",{"type":20,"tag":59,"props":690,"children":691},{"style":108},[692],{"type":25,"value":227},{"type":20,"tag":59,"props":694,"children":695},{"style":230},[696],{"type":25,"value":697}," typeof",{"type":20,"tag":59,"props":699,"children":700},{"style":66},[701],{"type":25,"value":80},{"type":20,"tag":59,"props":703,"children":704},{"style":72},[705],{"type":25,"value":706},"Comment",{"type":20,"tag":59,"props":708,"children":709},{"style":66},[710],{"type":25,"value":711},").",{"type":20,"tag":59,"props":713,"children":714},{"style":144},[715],{"type":25,"value":716},"GetConstructors",{"type":20,"tag":59,"props":718,"children":719},{"style":66},[720],{"type":25,"value":721},"()[",{"type":20,"tag":59,"props":723,"children":724},{"style":542},[725],{"type":25,"value":726},"0",{"type":20,"tag":59,"props":728,"children":729},{"style":66},[730],{"type":25,"value":731},"];\n",{"type":20,"tag":59,"props":733,"children":734},{"class":61,"line":432},[735,739,744,748,753,758],{"type":20,"tag":59,"props":736,"children":737},{"style":214},[738],{"type":25,"value":217},{"type":20,"tag":59,"props":740,"children":741},{"style":66},[742],{"type":25,"value":743}," values ",{"type":20,"tag":59,"props":745,"children":746},{"style":108},[747],{"type":25,"value":227},{"type":20,"tag":59,"props":749,"children":750},{"style":66},[751],{"type":25,"value":752}," constructor.",{"type":20,"tag":59,"props":754,"children":755},{"style":144},[756],{"type":25,"value":757},"GetParameters",{"type":20,"tag":59,"props":759,"children":760},{"style":66},[761],{"type":25,"value":363},{"type":20,"tag":59,"props":763,"children":765},{"class":61,"line":764},9,[766,771,776,780,784,789,794,799,803,807,811,815,819,824,829,833,838,843],{"type":20,"tag":59,"props":767,"children":768},{"style":66},[769],{"type":25,"value":770},"                            .",{"type":20,"tag":59,"props":772,"children":773},{"style":144},[774],{"type":25,"value":775},"ToDictionary",{"type":20,"tag":59,"props":777,"children":778},{"style":66},[779],{"type":25,"value":80},{"type":20,"tag":59,"props":781,"children":782},{"style":199},[783],{"type":25,"value":21},{"type":20,"tag":59,"props":785,"children":786},{"style":108},[787],{"type":25,"value":788}," =>",{"type":20,"tag":59,"props":790,"children":791},{"style":66},[792],{"type":25,"value":793}," p.",{"type":20,"tag":59,"props":795,"children":796},{"style":165},[797],{"type":25,"value":798},"Name",{"type":20,"tag":59,"props":800,"children":801},{"style":66},[802],{"type":25,"value":173},{"type":20,"tag":59,"props":804,"children":805},{"style":199},[806],{"type":25,"value":21},{"type":20,"tag":59,"props":808,"children":809},{"style":108},[810],{"type":25,"value":788},{"type":20,"tag":59,"props":812,"children":813},{"style":144},[814],{"type":25,"value":477},{"type":20,"tag":59,"props":816,"children":817},{"style":66},[818],{"type":25,"value":80},{"type":20,"tag":59,"props":820,"children":821},{"style":165},[822],{"type":25,"value":823},"form",{"type":20,"tag":59,"props":825,"children":826},{"style":66},[827],{"type":25,"value":828},"[p.",{"type":20,"tag":59,"props":830,"children":831},{"style":165},[832],{"type":25,"value":798},{"type":20,"tag":59,"props":834,"children":835},{"style":66},[836],{"type":25,"value":837},"], p.",{"type":20,"tag":59,"props":839,"children":840},{"style":165},[841],{"type":25,"value":842},"ParameterType",{"type":20,"tag":59,"props":844,"children":845},{"style":66},[846],{"type":25,"value":847},")\n",{"type":20,"tag":59,"props":849,"children":851},{"class":61,"line":850},10,[852,857,862,867,872,876,881,885,890,895],{"type":20,"tag":59,"props":853,"children":854},{"style":108},[855],{"type":25,"value":856},"                                      ??",{"type":20,"tag":59,"props":858,"children":859},{"style":66},[860],{"type":25,"value":861}," (p.",{"type":20,"tag":59,"props":863,"children":864},{"style":165},[865],{"type":25,"value":866},"HasDefaultValue",{"type":20,"tag":59,"props":868,"children":869},{"style":108},[870],{"type":25,"value":871}," ?",{"type":20,"tag":59,"props":873,"children":874},{"style":66},[875],{"type":25,"value":793},{"type":20,"tag":59,"props":877,"children":878},{"style":165},[879],{"type":25,"value":880},"DefaultValue",{"type":20,"tag":59,"props":882,"children":883},{"style":108},[884],{"type":25,"value":387},{"type":20,"tag":59,"props":886,"children":887},{"style":230},[888],{"type":25,"value":889}," new",{"type":20,"tag":59,"props":891,"children":892},{"style":72},[893],{"type":25,"value":894}," MissingRequiredValue",{"type":20,"tag":59,"props":896,"children":897},{"style":66},[898],{"type":25,"value":899},"()));\n",{"type":20,"tag":59,"props":901,"children":903},{"class":61,"line":902},11,[904,909,913,918,923,927,931,935,939,944,949,953],{"type":20,"tag":59,"props":905,"children":906},{"style":66},[907],{"type":25,"value":908},"    errors ",{"type":20,"tag":59,"props":910,"children":911},{"style":108},[912],{"type":25,"value":227},{"type":20,"tag":59,"props":914,"children":915},{"style":66},[916],{"type":25,"value":917}," values.",{"type":20,"tag":59,"props":919,"children":920},{"style":144},[921],{"type":25,"value":922},"Where",{"type":20,"tag":59,"props":924,"children":925},{"style":66},[926],{"type":25,"value":80},{"type":20,"tag":59,"props":928,"children":929},{"style":199},[930],{"type":25,"value":21},{"type":20,"tag":59,"props":932,"children":933},{"style":108},[934],{"type":25,"value":788},{"type":20,"tag":59,"props":936,"children":937},{"style":66},[938],{"type":25,"value":793},{"type":20,"tag":59,"props":940,"children":941},{"style":165},[942],{"type":25,"value":943},"Value",{"type":20,"tag":59,"props":945,"children":946},{"style":230},[947],{"type":25,"value":948}," is",{"type":20,"tag":59,"props":950,"children":951},{"style":72},[952],{"type":25,"value":894},{"type":20,"tag":59,"props":954,"children":955},{"style":66},[956],{"type":25,"value":847},{"type":20,"tag":59,"props":958,"children":960},{"class":61,"line":959},12,[961,966,971,975,979,983,988,993,998,1002,1007,1012,1017,1022,1026,1030,1035],{"type":20,"tag":59,"props":962,"children":963},{"style":66},[964],{"type":25,"value":965},"                   .",{"type":20,"tag":59,"props":967,"children":968},{"style":144},[969],{"type":25,"value":970},"Select",{"type":20,"tag":59,"props":972,"children":973},{"style":66},[974],{"type":25,"value":80},{"type":20,"tag":59,"props":976,"children":977},{"style":199},[978],{"type":25,"value":21},{"type":20,"tag":59,"props":980,"children":981},{"style":108},[982],{"type":25,"value":788},{"type":20,"tag":59,"props":984,"children":985},{"style":83},[986],{"type":25,"value":987}," $\"",{"type":20,"tag":59,"props":989,"children":990},{"style":89},[991],{"type":25,"value":992},"Form value missing for '",{"type":20,"tag":59,"props":994,"children":995},{"style":417},[996],{"type":25,"value":997},"{",{"type":20,"tag":59,"props":999,"children":1000},{"style":66},[1001],{"type":25,"value":21},{"type":20,"tag":59,"props":1003,"children":1005},{"style":1004},"--shiki-default:#5C6A72;--shiki-dark:#F1FA8C",[1006],{"type":25,"value":248},{"type":20,"tag":59,"props":1008,"children":1009},{"style":165},[1010],{"type":25,"value":1011},"Key",{"type":20,"tag":59,"props":1013,"children":1014},{"style":417},[1015],{"type":25,"value":1016},"}",{"type":20,"tag":59,"props":1018,"children":1019},{"style":89},[1020],{"type":25,"value":1021},"'",{"type":20,"tag":59,"props":1023,"children":1024},{"style":83},[1025],{"type":25,"value":86},{"type":20,"tag":59,"props":1027,"children":1028},{"style":66},[1029],{"type":25,"value":711},{"type":20,"tag":59,"props":1031,"children":1032},{"style":144},[1033],{"type":25,"value":1034},"ToList",{"type":20,"tag":59,"props":1036,"children":1037},{"style":66},[1038],{"type":25,"value":258},{"type":20,"tag":59,"props":1040,"children":1042},{"class":61,"line":1041},13,[1043,1048,1052,1057,1061,1066,1071,1075,1079,1083,1087,1092,1097,1102,1107,1111,1116],{"type":20,"tag":59,"props":1044,"children":1045},{"style":66},[1046],{"type":25,"value":1047},"    comment ",{"type":20,"tag":59,"props":1049,"children":1050},{"style":108},[1051],{"type":25,"value":227},{"type":20,"tag":59,"props":1053,"children":1054},{"style":66},[1055],{"type":25,"value":1056}," errors.",{"type":20,"tag":59,"props":1058,"children":1059},{"style":144},[1060],{"type":25,"value":358},{"type":20,"tag":59,"props":1062,"children":1063},{"style":66},[1064],{"type":25,"value":1065},"() ",{"type":20,"tag":59,"props":1067,"children":1068},{"style":108},[1069],{"type":25,"value":1070},"?",{"type":20,"tag":59,"props":1072,"children":1073},{"style":542},[1074],{"type":25,"value":545},{"type":20,"tag":59,"props":1076,"children":1077},{"style":108},[1078],{"type":25,"value":387},{"type":20,"tag":59,"props":1080,"children":1081},{"style":66},[1082],{"type":25,"value":272},{"type":20,"tag":59,"props":1084,"children":1085},{"style":72},[1086],{"type":25,"value":706},{"type":20,"tag":59,"props":1088,"children":1089},{"style":66},[1090],{"type":25,"value":1091},")constructor.",{"type":20,"tag":59,"props":1093,"children":1094},{"style":144},[1095],{"type":25,"value":1096},"Invoke",{"type":20,"tag":59,"props":1098,"children":1099},{"style":66},[1100],{"type":25,"value":1101},"(values.",{"type":20,"tag":59,"props":1103,"children":1104},{"style":165},[1105],{"type":25,"value":1106},"Values",{"type":20,"tag":59,"props":1108,"children":1109},{"style":66},[1110],{"type":25,"value":248},{"type":20,"tag":59,"props":1112,"children":1113},{"style":144},[1114],{"type":25,"value":1115},"ToArray",{"type":20,"tag":59,"props":1117,"children":1118},{"style":66},[1119],{"type":25,"value":1120},"());\n",{"type":20,"tag":59,"props":1122,"children":1124},{"class":61,"line":1123},14,[1125,1129,1134,1139,1143],{"type":20,"tag":59,"props":1126,"children":1127},{"style":230},[1128],{"type":25,"value":339},{"type":20,"tag":59,"props":1130,"children":1131},{"style":108},[1132],{"type":25,"value":1133}," !",{"type":20,"tag":59,"props":1135,"children":1136},{"style":66},[1137],{"type":25,"value":1138},"errors.",{"type":20,"tag":59,"props":1140,"children":1141},{"style":144},[1142],{"type":25,"value":358},{"type":20,"tag":59,"props":1144,"children":1145},{"style":66},[1146],{"type":25,"value":258},{"type":20,"tag":59,"props":1148,"children":1150},{"class":61,"line":1149},15,[1151],{"type":20,"tag":59,"props":1152,"children":1153},{"style":66},[1154],{"type":25,"value":438},{"type":20,"tag":21,"props":1156,"children":1157},{},[1158,1160,1165,1167,1173,1175,1181],{"type":25,"value":1159},"This method grabs the constructor for the ",{"type":20,"tag":55,"props":1161,"children":1163},{"className":1162},[],[1164],{"type":25,"value":706},{"type":25,"value":1166}," and tries to find keys in the form that match the parameter name. Any missing are reported as errors unless they have a default value, in which case that default is used. ",{"type":20,"tag":55,"props":1168,"children":1170},{"className":1169},[],[1171],{"type":25,"value":1172},"MissingRequiredValue",{"type":25,"value":1174}," is just an empty object to act as a sentinel. The use of ",{"type":20,"tag":55,"props":1176,"children":1178},{"className":1177},[],[1179],{"type":25,"value":1180},"TypeDescriptor.GetConverter",{"type":25,"value":1182}," means it should be quite happy handling integers, decimals, and URLs.",{"type":20,"tag":21,"props":1184,"children":1185},{},[1186,1188,1193],{"type":25,"value":1187},"The ",{"type":20,"tag":55,"props":1189,"children":1191},{"className":1190},[],[1192],{"type":25,"value":706},{"type":25,"value":1194}," constructor specifies which fields are required, and the parameter names must match the form field names by convention. Any optional value has a default value that the constructor provides a sensible default for.",{"type":20,"tag":47,"props":1196,"children":1198},{"className":49,"code":1197,"language":51,"meta":52,"style":52},"public Comment(string post_id, string message, string author, string email,\n    DateTime? date = null, Uri url = null, int? id = null, string gravatar = null) {\n    this.post_id = pathValidChars.Replace(post_id, \"-\");\n    this.message = message;\n    this.author = author;\n    this.email = email;\n    this.date = date ?? DateTime.UtcNow;\n    this.url = url;\n    this.id = id ?? new { this.post_id, this.author, this.message, this.date }.GetHashCode();\n    this.gravatar = gravatar ?? EncodeGravatar(email);\n}\n",[1199],{"type":20,"tag":55,"props":1200,"children":1201},{"__ignoreMap":52},[1202,1253,1342,1398,1423,1448,1473,1517,1542,1654,1692],{"type":20,"tag":59,"props":1203,"children":1204},{"class":61,"line":62},[1205,1209,1213,1217,1221,1226,1230,1235,1239,1244,1248],{"type":20,"tag":59,"props":1206,"children":1207},{"style":108},[1208],{"type":25,"value":111},{"type":20,"tag":59,"props":1210,"children":1211},{"style":144},[1212],{"type":25,"value":292},{"type":20,"tag":59,"props":1214,"children":1215},{"style":66},[1216],{"type":25,"value":80},{"type":20,"tag":59,"props":1218,"children":1219},{"style":214},[1220],{"type":25,"value":486},{"type":20,"tag":59,"props":1222,"children":1223},{"style":66},[1224],{"type":25,"value":1225}," post_id, ",{"type":20,"tag":59,"props":1227,"children":1228},{"style":214},[1229],{"type":25,"value":486},{"type":20,"tag":59,"props":1231,"children":1232},{"style":66},[1233],{"type":25,"value":1234}," message, ",{"type":20,"tag":59,"props":1236,"children":1237},{"style":214},[1238],{"type":25,"value":486},{"type":20,"tag":59,"props":1240,"children":1241},{"style":66},[1242],{"type":25,"value":1243}," author, ",{"type":20,"tag":59,"props":1245,"children":1246},{"style":214},[1247],{"type":25,"value":486},{"type":20,"tag":59,"props":1249,"children":1250},{"style":66},[1251],{"type":25,"value":1252}," email,\n",{"type":20,"tag":59,"props":1254,"children":1255},{"class":61,"line":104},[1256,1261,1265,1270,1274,1278,1283,1287,1291,1295,1300,1304,1309,1313,1317,1321,1325,1330,1334,1338],{"type":20,"tag":59,"props":1257,"children":1258},{"style":66},[1259],{"type":25,"value":1260},"    DateTime",{"type":20,"tag":59,"props":1262,"children":1263},{"style":108},[1264],{"type":25,"value":1070},{"type":20,"tag":59,"props":1266,"children":1267},{"style":66},[1268],{"type":25,"value":1269}," date ",{"type":20,"tag":59,"props":1271,"children":1272},{"style":108},[1273],{"type":25,"value":227},{"type":20,"tag":59,"props":1275,"children":1276},{"style":542},[1277],{"type":25,"value":545},{"type":20,"tag":59,"props":1279,"children":1280},{"style":66},[1281],{"type":25,"value":1282},", Uri url ",{"type":20,"tag":59,"props":1284,"children":1285},{"style":108},[1286],{"type":25,"value":227},{"type":20,"tag":59,"props":1288,"children":1289},{"style":542},[1290],{"type":25,"value":545},{"type":20,"tag":59,"props":1292,"children":1293},{"style":66},[1294],{"type":25,"value":173},{"type":20,"tag":59,"props":1296,"children":1297},{"style":214},[1298],{"type":25,"value":1299},"int",{"type":20,"tag":59,"props":1301,"children":1302},{"style":108},[1303],{"type":25,"value":1070},{"type":20,"tag":59,"props":1305,"children":1306},{"style":66},[1307],{"type":25,"value":1308}," id ",{"type":20,"tag":59,"props":1310,"children":1311},{"style":108},[1312],{"type":25,"value":227},{"type":20,"tag":59,"props":1314,"children":1315},{"style":542},[1316],{"type":25,"value":545},{"type":20,"tag":59,"props":1318,"children":1319},{"style":66},[1320],{"type":25,"value":173},{"type":20,"tag":59,"props":1322,"children":1323},{"style":214},[1324],{"type":25,"value":486},{"type":20,"tag":59,"props":1326,"children":1327},{"style":66},[1328],{"type":25,"value":1329}," gravatar ",{"type":20,"tag":59,"props":1331,"children":1332},{"style":108},[1333],{"type":25,"value":227},{"type":20,"tag":59,"props":1335,"children":1336},{"style":542},[1337],{"type":25,"value":545},{"type":20,"tag":59,"props":1339,"children":1340},{"style":66},[1341],{"type":25,"value":207},{"type":20,"tag":59,"props":1343,"children":1344},{"class":61,"line":210},[1345,1351,1355,1360,1365,1370,1375,1380,1384,1389,1393],{"type":20,"tag":59,"props":1346,"children":1348},{"style":1347},"--shiki-default:#DF69BA;--shiki-default-font-style:inherit;--shiki-dark:#BD93F9;--shiki-dark-font-style:italic",[1349],{"type":25,"value":1350},"    this",{"type":20,"tag":59,"props":1352,"children":1353},{"style":66},[1354],{"type":25,"value":248},{"type":20,"tag":59,"props":1356,"children":1357},{"style":165},[1358],{"type":25,"value":1359},"post_id",{"type":20,"tag":59,"props":1361,"children":1362},{"style":108},[1363],{"type":25,"value":1364}," =",{"type":20,"tag":59,"props":1366,"children":1367},{"style":66},[1368],{"type":25,"value":1369}," pathValidChars.",{"type":20,"tag":59,"props":1371,"children":1372},{"style":144},[1373],{"type":25,"value":1374},"Replace",{"type":20,"tag":59,"props":1376,"children":1377},{"style":66},[1378],{"type":25,"value":1379},"(post_id, ",{"type":20,"tag":59,"props":1381,"children":1382},{"style":83},[1383],{"type":25,"value":86},{"type":20,"tag":59,"props":1385,"children":1386},{"style":89},[1387],{"type":25,"value":1388},"-",{"type":20,"tag":59,"props":1390,"children":1391},{"style":83},[1392],{"type":25,"value":86},{"type":20,"tag":59,"props":1394,"children":1395},{"style":66},[1396],{"type":25,"value":1397},");\n",{"type":20,"tag":59,"props":1399,"children":1400},{"class":61,"line":261},[1401,1405,1409,1414,1418],{"type":20,"tag":59,"props":1402,"children":1403},{"style":1347},[1404],{"type":25,"value":1350},{"type":20,"tag":59,"props":1406,"children":1407},{"style":66},[1408],{"type":25,"value":248},{"type":20,"tag":59,"props":1410,"children":1411},{"style":165},[1412],{"type":25,"value":1413},"message",{"type":20,"tag":59,"props":1415,"children":1416},{"style":108},[1417],{"type":25,"value":1364},{"type":20,"tag":59,"props":1419,"children":1420},{"style":66},[1421],{"type":25,"value":1422}," message;\n",{"type":20,"tag":59,"props":1424,"children":1425},{"class":61,"line":314},[1426,1430,1434,1439,1443],{"type":20,"tag":59,"props":1427,"children":1428},{"style":1347},[1429],{"type":25,"value":1350},{"type":20,"tag":59,"props":1431,"children":1432},{"style":66},[1433],{"type":25,"value":248},{"type":20,"tag":59,"props":1435,"children":1436},{"style":165},[1437],{"type":25,"value":1438},"author",{"type":20,"tag":59,"props":1440,"children":1441},{"style":108},[1442],{"type":25,"value":1364},{"type":20,"tag":59,"props":1444,"children":1445},{"style":66},[1446],{"type":25,"value":1447}," author;\n",{"type":20,"tag":59,"props":1449,"children":1450},{"class":61,"line":333},[1451,1455,1459,1464,1468],{"type":20,"tag":59,"props":1452,"children":1453},{"style":1347},[1454],{"type":25,"value":1350},{"type":20,"tag":59,"props":1456,"children":1457},{"style":66},[1458],{"type":25,"value":248},{"type":20,"tag":59,"props":1460,"children":1461},{"style":165},[1462],{"type":25,"value":1463},"email",{"type":20,"tag":59,"props":1465,"children":1466},{"style":108},[1467],{"type":25,"value":1364},{"type":20,"tag":59,"props":1469,"children":1470},{"style":66},[1471],{"type":25,"value":1472}," email;\n",{"type":20,"tag":59,"props":1474,"children":1475},{"class":61,"line":366},[1476,1480,1484,1489,1493,1497,1502,1507,1512],{"type":20,"tag":59,"props":1477,"children":1478},{"style":1347},[1479],{"type":25,"value":1350},{"type":20,"tag":59,"props":1481,"children":1482},{"style":66},[1483],{"type":25,"value":248},{"type":20,"tag":59,"props":1485,"children":1486},{"style":165},[1487],{"type":25,"value":1488},"date",{"type":20,"tag":59,"props":1490,"children":1491},{"style":108},[1492],{"type":25,"value":1364},{"type":20,"tag":59,"props":1494,"children":1495},{"style":66},[1496],{"type":25,"value":1269},{"type":20,"tag":59,"props":1498,"children":1499},{"style":108},[1500],{"type":25,"value":1501},"??",{"type":20,"tag":59,"props":1503,"children":1504},{"style":66},[1505],{"type":25,"value":1506}," DateTime.",{"type":20,"tag":59,"props":1508,"children":1509},{"style":165},[1510],{"type":25,"value":1511},"UtcNow",{"type":20,"tag":59,"props":1513,"children":1514},{"style":66},[1515],{"type":25,"value":1516},";\n",{"type":20,"tag":59,"props":1518,"children":1519},{"class":61,"line":432},[1520,1524,1528,1533,1537],{"type":20,"tag":59,"props":1521,"children":1522},{"style":1347},[1523],{"type":25,"value":1350},{"type":20,"tag":59,"props":1525,"children":1526},{"style":66},[1527],{"type":25,"value":248},{"type":20,"tag":59,"props":1529,"children":1530},{"style":165},[1531],{"type":25,"value":1532},"url",{"type":20,"tag":59,"props":1534,"children":1535},{"style":108},[1536],{"type":25,"value":1364},{"type":20,"tag":59,"props":1538,"children":1539},{"style":66},[1540],{"type":25,"value":1541}," url;\n",{"type":20,"tag":59,"props":1543,"children":1544},{"class":61,"line":764},[1545,1549,1553,1558,1562,1566,1570,1574,1579,1584,1588,1592,1596,1600,1604,1608,1612,1616,1620,1624,1628,1632,1636,1640,1645,1650],{"type":20,"tag":59,"props":1546,"children":1547},{"style":1347},[1548],{"type":25,"value":1350},{"type":20,"tag":59,"props":1550,"children":1551},{"style":66},[1552],{"type":25,"value":248},{"type":20,"tag":59,"props":1554,"children":1555},{"style":165},[1556],{"type":25,"value":1557},"id",{"type":20,"tag":59,"props":1559,"children":1560},{"style":108},[1561],{"type":25,"value":1364},{"type":20,"tag":59,"props":1563,"children":1564},{"style":66},[1565],{"type":25,"value":1308},{"type":20,"tag":59,"props":1567,"children":1568},{"style":108},[1569],{"type":25,"value":1501},{"type":20,"tag":59,"props":1571,"children":1572},{"style":230},[1573],{"type":25,"value":889},{"type":20,"tag":59,"props":1575,"children":1576},{"style":66},[1577],{"type":25,"value":1578}," { ",{"type":20,"tag":59,"props":1580,"children":1581},{"style":1347},[1582],{"type":25,"value":1583},"this",{"type":20,"tag":59,"props":1585,"children":1586},{"style":66},[1587],{"type":25,"value":248},{"type":20,"tag":59,"props":1589,"children":1590},{"style":165},[1591],{"type":25,"value":1359},{"type":20,"tag":59,"props":1593,"children":1594},{"style":66},[1595],{"type":25,"value":173},{"type":20,"tag":59,"props":1597,"children":1598},{"style":1347},[1599],{"type":25,"value":1583},{"type":20,"tag":59,"props":1601,"children":1602},{"style":66},[1603],{"type":25,"value":248},{"type":20,"tag":59,"props":1605,"children":1606},{"style":165},[1607],{"type":25,"value":1438},{"type":20,"tag":59,"props":1609,"children":1610},{"style":66},[1611],{"type":25,"value":173},{"type":20,"tag":59,"props":1613,"children":1614},{"style":1347},[1615],{"type":25,"value":1583},{"type":20,"tag":59,"props":1617,"children":1618},{"style":66},[1619],{"type":25,"value":248},{"type":20,"tag":59,"props":1621,"children":1622},{"style":165},[1623],{"type":25,"value":1413},{"type":20,"tag":59,"props":1625,"children":1626},{"style":66},[1627],{"type":25,"value":173},{"type":20,"tag":59,"props":1629,"children":1630},{"style":1347},[1631],{"type":25,"value":1583},{"type":20,"tag":59,"props":1633,"children":1634},{"style":66},[1635],{"type":25,"value":248},{"type":20,"tag":59,"props":1637,"children":1638},{"style":165},[1639],{"type":25,"value":1488},{"type":20,"tag":59,"props":1641,"children":1642},{"style":66},[1643],{"type":25,"value":1644}," }.",{"type":20,"tag":59,"props":1646,"children":1647},{"style":144},[1648],{"type":25,"value":1649},"GetHashCode",{"type":20,"tag":59,"props":1651,"children":1652},{"style":66},[1653],{"type":25,"value":258},{"type":20,"tag":59,"props":1655,"children":1656},{"class":61,"line":850},[1657,1661,1665,1670,1674,1678,1682,1687],{"type":20,"tag":59,"props":1658,"children":1659},{"style":1347},[1660],{"type":25,"value":1350},{"type":20,"tag":59,"props":1662,"children":1663},{"style":66},[1664],{"type":25,"value":248},{"type":20,"tag":59,"props":1666,"children":1667},{"style":165},[1668],{"type":25,"value":1669},"gravatar",{"type":20,"tag":59,"props":1671,"children":1672},{"style":108},[1673],{"type":25,"value":1364},{"type":20,"tag":59,"props":1675,"children":1676},{"style":66},[1677],{"type":25,"value":1329},{"type":20,"tag":59,"props":1679,"children":1680},{"style":108},[1681],{"type":25,"value":1501},{"type":20,"tag":59,"props":1683,"children":1684},{"style":144},[1685],{"type":25,"value":1686}," EncodeGravatar",{"type":20,"tag":59,"props":1688,"children":1689},{"style":66},[1690],{"type":25,"value":1691},"(email);\n",{"type":20,"tag":59,"props":1693,"children":1694},{"class":61,"line":902},[1695],{"type":20,"tag":59,"props":1696,"children":1697},{"style":66},[1698],{"type":25,"value":438},{"type":20,"tag":21,"props":1700,"children":1701},{},[1702,1704,1711],{"type":25,"value":1703},"I'll post more of the form commenting system source soon once it's a bit better tested and I've looked into anti-spam integration. The ",{"type":20,"tag":1705,"props":1706,"children":1708},"a",{"href":1707},"https://github.com/damieng/jekyll-blog-comments",[1709],{"type":25,"value":1710},"Jekyll rendering templates and WordPress exporter",{"type":25,"value":1712}," are available.",{"type":20,"tag":21,"props":1714,"children":1715},{},[1716],{"type":20,"tag":1717,"props":1718,"children":1719},"em",{},[1720],{"type":25,"value":1721},"[)amien",{"type":20,"tag":1723,"props":1724,"children":1725},"style",{},[1726],{"type":25,"value":1727},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":52,"searchDepth":104,"depth":104,"links":1729},[],"markdown","content:blog:2018:model-binding-form-posts-to-immutable-objects.md","content","blog/2018/model-binding-form-posts-to-immutable-objects.md","blog/2018/model-binding-form-posts-to-immutable-objects","md","/blog/2018/model-binding-form-posts-to-immutable-objects/",679,[1739,1743,1747],{"title":1740,"date":1741,"url":1742},"HTML5 Video Cheatsheet: Optimizing videos for the web","2025-12-05T00:00:00Z","/blog/2025/html5-video-cheatsheet/",{"title":1744,"date":1745,"url":1746},"Transactions in the MongoDB EF Core Provider","2025-10-25","/blog/2025/mongodb-explicit-transactions/",{"title":1748,"date":1749,"url":1750},"Queryable Encryption with the MongoDB EF Core Provider","2025-09-22","/blog/2025/mongodb-queryable-encryption/",[1752,1773],{"_path":1753,"_dir":1754,"_draft":6,"_partial":6,"_locale":7,"title":1755,"description":1756,"id":1757,"name":1758,"email":1759,"avatar":1760,"date":1761,"body":1762,"_type":1730,"_id":1770,"_source":1732,"_file":1771,"_stem":1772,"_extension":1735},"/comments/model-binding-form-posts-to-immutable-objects/177514","model-binding-form-posts-to-immutable-objects","177514","I will!  Each blog post is going to be manually approved via a pull request so I can visually check anything that goes through :)",176815,"Damien Guard","damien@envytech.co.uk","https://www.gravatar.com/avatar/dc72963e7279d34c85ed4c0b731ce5a9?r=pg&d=retro","2018-04-22T23:14:00",{"type":17,"children":1763,"toc":1768},[1764],{"type":20,"tag":21,"props":1765,"children":1766},{},[1767],{"type":25,"value":1756},{"title":52,"searchDepth":104,"depth":104,"links":1769},[],"content:comments:model-binding-form-posts-to-immutable-objects:177514.md","comments/model-binding-form-posts-to-immutable-objects/177514.md","comments/model-binding-form-posts-to-immutable-objects/177514",{"_path":1774,"_dir":1754,"_draft":6,"_partial":6,"_locale":7,"title":1775,"description":1776,"id":1757,"name":1777,"email":1778,"avatar":1779,"date":1780,"body":1781,"_type":1730,"_id":1796,"_source":1732,"_file":1797,"_stem":1798,"_extension":1735},"/comments/model-binding-form-posts-to-immutable-objects/176815","176815","Nice, I need to do something like this for my website.  Are you going to allow the body of the content to include markdown?","John Marsing","aeaij@yahoo.com","https://www.gravatar.com/avatar/8ff61262434162be45a9f18716e87e2c?r=pg&d=retro","2018-04-12T08:24:00",{"type":17,"children":1782,"toc":1794},[1783],{"type":20,"tag":21,"props":1784,"children":1785},{},[1786,1788,1793],{"type":25,"value":1787},"Nice, I need to do something like this for my website.  Are you going to allow the body of the content to include ",{"type":20,"tag":1789,"props":1790,"children":1791},"strong",{},[1792],{"type":25,"value":1730},{"type":25,"value":1070},{"title":52,"searchDepth":104,"depth":104,"links":1795},[],"content:comments:model-binding-form-posts-to-immutable-objects:176815.md","comments/model-binding-form-posts-to-immutable-objects/176815.md","comments/model-binding-form-posts-to-immutable-objects/176815",1779264581591]