[{"data":1,"prerenderedAt":1475},["ShallowReactive",2],{"blog:2015:table-per-hierarchy-in-azure-table-storage":3,"blogMore-Development":1461,"comments-table-per-hierarchy-in-azure-table-storage":1474},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"excerpt":11,"category":26,"tags":27,"body":30,"_type":1452,"_id":1453,"_source":1454,"_file":1455,"_stem":1456,"_extension":1457,"url":1458,"wordCount":1459,"minutes":129,"commentCount":1460},"/blog/2015/table-per-hierarchy-in-azure-table-storage","2015",false,"en","Table per hierarchy in Azure Table Storage","If you’re coming from an ORM background to Azure Table Storage, you might be wondering how to map class hierarchies to tables.","2015-06-27T09:24:17+00:00",{"type":12,"children":13},"root",[14,21],{"type":15,"tag":16,"props":17,"children":18},"element","p",{},[19],{"type":20,"value":9},"text",{"type":15,"tag":16,"props":22,"children":23},{},[24],{"type":20,"value":25},"Documentation on the topic is hard to find unless you know the magic class name EntityResolver which you can discover by digging into the Azure Client for .NET source code.","Development",[28,29],".NET","Azure",{"type":12,"children":31,"toc":1450},[32,36,40,45,335,340,345,583,588,1023,1028,1033,1297,1302,1430,1435,1444],{"type":15,"tag":16,"props":33,"children":34},{},[35],{"type":20,"value":9},{"type":15,"tag":16,"props":37,"children":38},{},[39],{"type":20,"value":25},{"type":15,"tag":16,"props":41,"children":42},{},[43],{"type":20,"value":44},"Let’s say we have a basic blog-style system (minimal fields shown):",{"type":15,"tag":46,"props":47,"children":52},"pre",{"className":48,"code":49,"language":50,"meta":51,"style":51},"language-csharp shiki shiki-themes everforest-light dracula","public class Content {\n  public string Id { get; set; }\n  public string Title { get; set }\n}\n\npublic class BlogPost : Content {\n  public List\u003Cstring> Topics { get; set; }\n}\n\npublic class Page : Content {\n  public String Slug { get; set; }\n}\n","csharp","",[53],{"type":15,"tag":54,"props":55,"children":56},"code",{"__ignoreMap":51},[57,87,127,153,162,172,204,248,256,264,293,327],{"type":15,"tag":58,"props":59,"children":62},"span",{"class":60,"line":61},"line",1,[63,69,75,81],{"type":15,"tag":58,"props":64,"children":66},{"style":65},"--shiki-default:#F57D26;--shiki-dark:#FF79C6",[67],{"type":20,"value":68},"public",{"type":15,"tag":58,"props":70,"children":72},{"style":71},"--shiki-default:#F85552;--shiki-dark:#FF79C6",[73],{"type":20,"value":74}," class",{"type":15,"tag":58,"props":76,"children":78},{"style":77},"--shiki-default:#3A94C5;--shiki-dark:#8BE9FD",[79],{"type":20,"value":80}," Content",{"type":15,"tag":58,"props":82,"children":84},{"style":83},"--shiki-default:#5C6A72;--shiki-dark:#F8F8F2",[85],{"type":20,"value":86}," {\n",{"type":15,"tag":58,"props":88,"children":90},{"class":60,"line":89},2,[91,96,102,107,112,117,122],{"type":15,"tag":58,"props":92,"children":93},{"style":65},[94],{"type":20,"value":95},"  public",{"type":15,"tag":58,"props":97,"children":99},{"style":98},"--shiki-default:#3A94C5;--shiki-dark:#FF79C6",[100],{"type":20,"value":101}," string",{"type":15,"tag":58,"props":103,"children":104},{"style":83},[105],{"type":20,"value":106}," Id { ",{"type":15,"tag":58,"props":108,"children":109},{"style":98},[110],{"type":20,"value":111},"get",{"type":15,"tag":58,"props":113,"children":114},{"style":83},[115],{"type":20,"value":116},"; ",{"type":15,"tag":58,"props":118,"children":119},{"style":98},[120],{"type":20,"value":121},"set",{"type":15,"tag":58,"props":123,"children":124},{"style":83},[125],{"type":20,"value":126},"; }\n",{"type":15,"tag":58,"props":128,"children":130},{"class":60,"line":129},3,[131,135,139,144,148],{"type":15,"tag":58,"props":132,"children":133},{"style":65},[134],{"type":20,"value":95},{"type":15,"tag":58,"props":136,"children":137},{"style":98},[138],{"type":20,"value":101},{"type":15,"tag":58,"props":140,"children":141},{"style":83},[142],{"type":20,"value":143}," Title { ",{"type":15,"tag":58,"props":145,"children":146},{"style":98},[147],{"type":20,"value":111},{"type":15,"tag":58,"props":149,"children":150},{"style":83},[151],{"type":20,"value":152},"; set }\n",{"type":15,"tag":58,"props":154,"children":156},{"class":60,"line":155},4,[157],{"type":15,"tag":58,"props":158,"children":159},{"style":83},[160],{"type":20,"value":161},"}\n",{"type":15,"tag":58,"props":163,"children":165},{"class":60,"line":164},5,[166],{"type":15,"tag":58,"props":167,"children":169},{"emptyLinePlaceholder":168},true,[170],{"type":20,"value":171},"\n",{"type":15,"tag":58,"props":173,"children":175},{"class":60,"line":174},6,[176,180,184,189,194,200],{"type":15,"tag":58,"props":177,"children":178},{"style":65},[179],{"type":20,"value":68},{"type":15,"tag":58,"props":181,"children":182},{"style":71},[183],{"type":20,"value":74},{"type":15,"tag":58,"props":185,"children":186},{"style":77},[187],{"type":20,"value":188}," BlogPost",{"type":15,"tag":58,"props":190,"children":191},{"style":83},[192],{"type":20,"value":193}," : ",{"type":15,"tag":58,"props":195,"children":197},{"style":196},"--shiki-default:#3A94C5;--shiki-default-font-style:inherit;--shiki-dark:#8BE9FD;--shiki-dark-font-style:italic",[198],{"type":20,"value":199},"Content",{"type":15,"tag":58,"props":201,"children":202},{"style":83},[203],{"type":20,"value":86},{"type":15,"tag":58,"props":205,"children":207},{"class":60,"line":206},7,[208,212,217,222,227,232,236,240,244],{"type":15,"tag":58,"props":209,"children":210},{"style":65},[211],{"type":20,"value":95},{"type":15,"tag":58,"props":213,"children":214},{"style":196},[215],{"type":20,"value":216}," List",{"type":15,"tag":58,"props":218,"children":219},{"style":83},[220],{"type":20,"value":221},"\u003C",{"type":15,"tag":58,"props":223,"children":224},{"style":98},[225],{"type":20,"value":226},"string",{"type":15,"tag":58,"props":228,"children":229},{"style":83},[230],{"type":20,"value":231},"> Topics { ",{"type":15,"tag":58,"props":233,"children":234},{"style":98},[235],{"type":20,"value":111},{"type":15,"tag":58,"props":237,"children":238},{"style":83},[239],{"type":20,"value":116},{"type":15,"tag":58,"props":241,"children":242},{"style":98},[243],{"type":20,"value":121},{"type":15,"tag":58,"props":245,"children":246},{"style":83},[247],{"type":20,"value":126},{"type":15,"tag":58,"props":249,"children":251},{"class":60,"line":250},8,[252],{"type":15,"tag":58,"props":253,"children":254},{"style":83},[255],{"type":20,"value":161},{"type":15,"tag":58,"props":257,"children":259},{"class":60,"line":258},9,[260],{"type":15,"tag":58,"props":261,"children":262},{"emptyLinePlaceholder":168},[263],{"type":20,"value":171},{"type":15,"tag":58,"props":265,"children":267},{"class":60,"line":266},10,[268,272,276,281,285,289],{"type":15,"tag":58,"props":269,"children":270},{"style":65},[271],{"type":20,"value":68},{"type":15,"tag":58,"props":273,"children":274},{"style":71},[275],{"type":20,"value":74},{"type":15,"tag":58,"props":277,"children":278},{"style":77},[279],{"type":20,"value":280}," Page",{"type":15,"tag":58,"props":282,"children":283},{"style":83},[284],{"type":20,"value":193},{"type":15,"tag":58,"props":286,"children":287},{"style":196},[288],{"type":20,"value":199},{"type":15,"tag":58,"props":290,"children":291},{"style":83},[292],{"type":20,"value":86},{"type":15,"tag":58,"props":294,"children":296},{"class":60,"line":295},11,[297,301,306,311,315,319,323],{"type":15,"tag":58,"props":298,"children":299},{"style":65},[300],{"type":20,"value":95},{"type":15,"tag":58,"props":302,"children":303},{"style":196},[304],{"type":20,"value":305}," String",{"type":15,"tag":58,"props":307,"children":308},{"style":83},[309],{"type":20,"value":310}," Slug { ",{"type":15,"tag":58,"props":312,"children":313},{"style":98},[314],{"type":20,"value":111},{"type":15,"tag":58,"props":316,"children":317},{"style":83},[318],{"type":20,"value":116},{"type":15,"tag":58,"props":320,"children":321},{"style":98},[322],{"type":20,"value":121},{"type":15,"tag":58,"props":324,"children":325},{"style":83},[326],{"type":20,"value":126},{"type":15,"tag":58,"props":328,"children":330},{"class":60,"line":329},12,[331],{"type":15,"tag":58,"props":332,"children":333},{"style":83},[334],{"type":20,"value":161},{"type":15,"tag":16,"props":336,"children":337},{},[338],{"type":20,"value":339},"The trick is to create an instance of EntityResolver where T is your base class, e.g. Content. Strangely EntityResolver’s signature requires T implement new() so you can’t make your base class abstract.",{"type":15,"tag":16,"props":341,"children":342},{},[343],{"type":20,"value":344},"Firstly we need to add to our base class an identifier for the type (in ORM terminology a type discriminator). Then we override that in the sub-types to ensure new instances get the correct type set on insertion.",{"type":15,"tag":46,"props":346,"children":347},{"className":48,"code":49,"language":50,"meta":51,"style":51},[348],{"type":15,"tag":54,"props":349,"children":350},{"__ignoreMap":51},[351,370,401,424,431,438,465,504,511,518,545,576],{"type":15,"tag":58,"props":352,"children":353},{"class":60,"line":61},[354,358,362,366],{"type":15,"tag":58,"props":355,"children":356},{"style":65},[357],{"type":20,"value":68},{"type":15,"tag":58,"props":359,"children":360},{"style":71},[361],{"type":20,"value":74},{"type":15,"tag":58,"props":363,"children":364},{"style":77},[365],{"type":20,"value":80},{"type":15,"tag":58,"props":367,"children":368},{"style":83},[369],{"type":20,"value":86},{"type":15,"tag":58,"props":371,"children":372},{"class":60,"line":89},[373,377,381,385,389,393,397],{"type":15,"tag":58,"props":374,"children":375},{"style":65},[376],{"type":20,"value":95},{"type":15,"tag":58,"props":378,"children":379},{"style":98},[380],{"type":20,"value":101},{"type":15,"tag":58,"props":382,"children":383},{"style":83},[384],{"type":20,"value":106},{"type":15,"tag":58,"props":386,"children":387},{"style":98},[388],{"type":20,"value":111},{"type":15,"tag":58,"props":390,"children":391},{"style":83},[392],{"type":20,"value":116},{"type":15,"tag":58,"props":394,"children":395},{"style":98},[396],{"type":20,"value":121},{"type":15,"tag":58,"props":398,"children":399},{"style":83},[400],{"type":20,"value":126},{"type":15,"tag":58,"props":402,"children":403},{"class":60,"line":129},[404,408,412,416,420],{"type":15,"tag":58,"props":405,"children":406},{"style":65},[407],{"type":20,"value":95},{"type":15,"tag":58,"props":409,"children":410},{"style":98},[411],{"type":20,"value":101},{"type":15,"tag":58,"props":413,"children":414},{"style":83},[415],{"type":20,"value":143},{"type":15,"tag":58,"props":417,"children":418},{"style":98},[419],{"type":20,"value":111},{"type":15,"tag":58,"props":421,"children":422},{"style":83},[423],{"type":20,"value":152},{"type":15,"tag":58,"props":425,"children":426},{"class":60,"line":155},[427],{"type":15,"tag":58,"props":428,"children":429},{"style":83},[430],{"type":20,"value":161},{"type":15,"tag":58,"props":432,"children":433},{"class":60,"line":164},[434],{"type":15,"tag":58,"props":435,"children":436},{"emptyLinePlaceholder":168},[437],{"type":20,"value":171},{"type":15,"tag":58,"props":439,"children":440},{"class":60,"line":174},[441,445,449,453,457,461],{"type":15,"tag":58,"props":442,"children":443},{"style":65},[444],{"type":20,"value":68},{"type":15,"tag":58,"props":446,"children":447},{"style":71},[448],{"type":20,"value":74},{"type":15,"tag":58,"props":450,"children":451},{"style":77},[452],{"type":20,"value":188},{"type":15,"tag":58,"props":454,"children":455},{"style":83},[456],{"type":20,"value":193},{"type":15,"tag":58,"props":458,"children":459},{"style":196},[460],{"type":20,"value":199},{"type":15,"tag":58,"props":462,"children":463},{"style":83},[464],{"type":20,"value":86},{"type":15,"tag":58,"props":466,"children":467},{"class":60,"line":206},[468,472,476,480,484,488,492,496,500],{"type":15,"tag":58,"props":469,"children":470},{"style":65},[471],{"type":20,"value":95},{"type":15,"tag":58,"props":473,"children":474},{"style":196},[475],{"type":20,"value":216},{"type":15,"tag":58,"props":477,"children":478},{"style":83},[479],{"type":20,"value":221},{"type":15,"tag":58,"props":481,"children":482},{"style":98},[483],{"type":20,"value":226},{"type":15,"tag":58,"props":485,"children":486},{"style":83},[487],{"type":20,"value":231},{"type":15,"tag":58,"props":489,"children":490},{"style":98},[491],{"type":20,"value":111},{"type":15,"tag":58,"props":493,"children":494},{"style":83},[495],{"type":20,"value":116},{"type":15,"tag":58,"props":497,"children":498},{"style":98},[499],{"type":20,"value":121},{"type":15,"tag":58,"props":501,"children":502},{"style":83},[503],{"type":20,"value":126},{"type":15,"tag":58,"props":505,"children":506},{"class":60,"line":250},[507],{"type":15,"tag":58,"props":508,"children":509},{"style":83},[510],{"type":20,"value":161},{"type":15,"tag":58,"props":512,"children":513},{"class":60,"line":258},[514],{"type":15,"tag":58,"props":515,"children":516},{"emptyLinePlaceholder":168},[517],{"type":20,"value":171},{"type":15,"tag":58,"props":519,"children":520},{"class":60,"line":266},[521,525,529,533,537,541],{"type":15,"tag":58,"props":522,"children":523},{"style":65},[524],{"type":20,"value":68},{"type":15,"tag":58,"props":526,"children":527},{"style":71},[528],{"type":20,"value":74},{"type":15,"tag":58,"props":530,"children":531},{"style":77},[532],{"type":20,"value":280},{"type":15,"tag":58,"props":534,"children":535},{"style":83},[536],{"type":20,"value":193},{"type":15,"tag":58,"props":538,"children":539},{"style":196},[540],{"type":20,"value":199},{"type":15,"tag":58,"props":542,"children":543},{"style":83},[544],{"type":20,"value":86},{"type":15,"tag":58,"props":546,"children":547},{"class":60,"line":295},[548,552,556,560,564,568,572],{"type":15,"tag":58,"props":549,"children":550},{"style":65},[551],{"type":20,"value":95},{"type":15,"tag":58,"props":553,"children":554},{"style":196},[555],{"type":20,"value":305},{"type":15,"tag":58,"props":557,"children":558},{"style":83},[559],{"type":20,"value":310},{"type":15,"tag":58,"props":561,"children":562},{"style":98},[563],{"type":20,"value":111},{"type":15,"tag":58,"props":565,"children":566},{"style":83},[567],{"type":20,"value":116},{"type":15,"tag":58,"props":569,"children":570},{"style":98},[571],{"type":20,"value":121},{"type":15,"tag":58,"props":573,"children":574},{"style":83},[575],{"type":20,"value":126},{"type":15,"tag":58,"props":577,"children":578},{"class":60,"line":329},[579],{"type":15,"tag":58,"props":580,"children":581},{"style":83},[582],{"type":20,"value":161},{"type":15,"tag":16,"props":584,"children":585},{},[586],{"type":20,"value":587},"Let’s say we want to store all of these in a table called ‘content’. We would typically write a small helper class to handle the cloud table and storage, e.g.",{"type":15,"tag":46,"props":589,"children":591},{"className":48,"code":590,"language":50,"meta":51,"style":51},"public class Content {\n  public string Id { get; set; }\n  public string Title { get; set }\n  public virtual string ContentType { get; set; }\n}\n\npublic class BlogPost : Content {\n  public List\u003Cstring> Topics { get; set; }\n  public override string ContentType {\n    get { return \"blog\"; }\n    set { }\n  }\n}\n\npublic class Page : Content {\n  public String Slug { get; set; }\n  public override string ContentType {\n    get { return \"page\"; }\n    set { }\n  }\n}\n",[592],{"type":15,"tag":54,"props":593,"children":594},{"__ignoreMap":51},[595,614,645,668,705,712,719,746,785,806,845,858,866,874,882,910,942,962,995,1007,1015],{"type":15,"tag":58,"props":596,"children":597},{"class":60,"line":61},[598,602,606,610],{"type":15,"tag":58,"props":599,"children":600},{"style":65},[601],{"type":20,"value":68},{"type":15,"tag":58,"props":603,"children":604},{"style":71},[605],{"type":20,"value":74},{"type":15,"tag":58,"props":607,"children":608},{"style":77},[609],{"type":20,"value":80},{"type":15,"tag":58,"props":611,"children":612},{"style":83},[613],{"type":20,"value":86},{"type":15,"tag":58,"props":615,"children":616},{"class":60,"line":89},[617,621,625,629,633,637,641],{"type":15,"tag":58,"props":618,"children":619},{"style":65},[620],{"type":20,"value":95},{"type":15,"tag":58,"props":622,"children":623},{"style":98},[624],{"type":20,"value":101},{"type":15,"tag":58,"props":626,"children":627},{"style":83},[628],{"type":20,"value":106},{"type":15,"tag":58,"props":630,"children":631},{"style":98},[632],{"type":20,"value":111},{"type":15,"tag":58,"props":634,"children":635},{"style":83},[636],{"type":20,"value":116},{"type":15,"tag":58,"props":638,"children":639},{"style":98},[640],{"type":20,"value":121},{"type":15,"tag":58,"props":642,"children":643},{"style":83},[644],{"type":20,"value":126},{"type":15,"tag":58,"props":646,"children":647},{"class":60,"line":129},[648,652,656,660,664],{"type":15,"tag":58,"props":649,"children":650},{"style":65},[651],{"type":20,"value":95},{"type":15,"tag":58,"props":653,"children":654},{"style":98},[655],{"type":20,"value":101},{"type":15,"tag":58,"props":657,"children":658},{"style":83},[659],{"type":20,"value":143},{"type":15,"tag":58,"props":661,"children":662},{"style":98},[663],{"type":20,"value":111},{"type":15,"tag":58,"props":665,"children":666},{"style":83},[667],{"type":20,"value":152},{"type":15,"tag":58,"props":669,"children":670},{"class":60,"line":155},[671,675,680,684,689,693,697,701],{"type":15,"tag":58,"props":672,"children":673},{"style":65},[674],{"type":20,"value":95},{"type":15,"tag":58,"props":676,"children":677},{"style":65},[678],{"type":20,"value":679}," virtual",{"type":15,"tag":58,"props":681,"children":682},{"style":98},[683],{"type":20,"value":101},{"type":15,"tag":58,"props":685,"children":686},{"style":83},[687],{"type":20,"value":688}," ContentType { ",{"type":15,"tag":58,"props":690,"children":691},{"style":98},[692],{"type":20,"value":111},{"type":15,"tag":58,"props":694,"children":695},{"style":83},[696],{"type":20,"value":116},{"type":15,"tag":58,"props":698,"children":699},{"style":98},[700],{"type":20,"value":121},{"type":15,"tag":58,"props":702,"children":703},{"style":83},[704],{"type":20,"value":126},{"type":15,"tag":58,"props":706,"children":707},{"class":60,"line":164},[708],{"type":15,"tag":58,"props":709,"children":710},{"style":83},[711],{"type":20,"value":161},{"type":15,"tag":58,"props":713,"children":714},{"class":60,"line":174},[715],{"type":15,"tag":58,"props":716,"children":717},{"emptyLinePlaceholder":168},[718],{"type":20,"value":171},{"type":15,"tag":58,"props":720,"children":721},{"class":60,"line":206},[722,726,730,734,738,742],{"type":15,"tag":58,"props":723,"children":724},{"style":65},[725],{"type":20,"value":68},{"type":15,"tag":58,"props":727,"children":728},{"style":71},[729],{"type":20,"value":74},{"type":15,"tag":58,"props":731,"children":732},{"style":77},[733],{"type":20,"value":188},{"type":15,"tag":58,"props":735,"children":736},{"style":83},[737],{"type":20,"value":193},{"type":15,"tag":58,"props":739,"children":740},{"style":196},[741],{"type":20,"value":199},{"type":15,"tag":58,"props":743,"children":744},{"style":83},[745],{"type":20,"value":86},{"type":15,"tag":58,"props":747,"children":748},{"class":60,"line":250},[749,753,757,761,765,769,773,777,781],{"type":15,"tag":58,"props":750,"children":751},{"style":65},[752],{"type":20,"value":95},{"type":15,"tag":58,"props":754,"children":755},{"style":196},[756],{"type":20,"value":216},{"type":15,"tag":58,"props":758,"children":759},{"style":83},[760],{"type":20,"value":221},{"type":15,"tag":58,"props":762,"children":763},{"style":98},[764],{"type":20,"value":226},{"type":15,"tag":58,"props":766,"children":767},{"style":83},[768],{"type":20,"value":231},{"type":15,"tag":58,"props":770,"children":771},{"style":98},[772],{"type":20,"value":111},{"type":15,"tag":58,"props":774,"children":775},{"style":83},[776],{"type":20,"value":116},{"type":15,"tag":58,"props":778,"children":779},{"style":98},[780],{"type":20,"value":121},{"type":15,"tag":58,"props":782,"children":783},{"style":83},[784],{"type":20,"value":126},{"type":15,"tag":58,"props":786,"children":787},{"class":60,"line":258},[788,792,797,801],{"type":15,"tag":58,"props":789,"children":790},{"style":65},[791],{"type":20,"value":95},{"type":15,"tag":58,"props":793,"children":794},{"style":65},[795],{"type":20,"value":796}," override",{"type":15,"tag":58,"props":798,"children":799},{"style":98},[800],{"type":20,"value":101},{"type":15,"tag":58,"props":802,"children":803},{"style":83},[804],{"type":20,"value":805}," ContentType {\n",{"type":15,"tag":58,"props":807,"children":808},{"class":60,"line":266},[809,814,819,824,830,836,841],{"type":15,"tag":58,"props":810,"children":811},{"style":98},[812],{"type":20,"value":813},"    get",{"type":15,"tag":58,"props":815,"children":816},{"style":83},[817],{"type":20,"value":818}," { ",{"type":15,"tag":58,"props":820,"children":821},{"style":71},[822],{"type":20,"value":823},"return",{"type":15,"tag":58,"props":825,"children":827},{"style":826},"--shiki-default:#8DA101;--shiki-dark:#E9F284",[828],{"type":20,"value":829}," \"",{"type":15,"tag":58,"props":831,"children":833},{"style":832},"--shiki-default:#8DA101;--shiki-dark:#F1FA8C",[834],{"type":20,"value":835},"blog",{"type":15,"tag":58,"props":837,"children":838},{"style":826},[839],{"type":20,"value":840},"\"",{"type":15,"tag":58,"props":842,"children":843},{"style":83},[844],{"type":20,"value":126},{"type":15,"tag":58,"props":846,"children":847},{"class":60,"line":295},[848,853],{"type":15,"tag":58,"props":849,"children":850},{"style":98},[851],{"type":20,"value":852},"    set",{"type":15,"tag":58,"props":854,"children":855},{"style":83},[856],{"type":20,"value":857}," { }\n",{"type":15,"tag":58,"props":859,"children":860},{"class":60,"line":329},[861],{"type":15,"tag":58,"props":862,"children":863},{"style":83},[864],{"type":20,"value":865},"  }\n",{"type":15,"tag":58,"props":867,"children":869},{"class":60,"line":868},13,[870],{"type":15,"tag":58,"props":871,"children":872},{"style":83},[873],{"type":20,"value":161},{"type":15,"tag":58,"props":875,"children":877},{"class":60,"line":876},14,[878],{"type":15,"tag":58,"props":879,"children":880},{"emptyLinePlaceholder":168},[881],{"type":20,"value":171},{"type":15,"tag":58,"props":883,"children":885},{"class":60,"line":884},15,[886,890,894,898,902,906],{"type":15,"tag":58,"props":887,"children":888},{"style":65},[889],{"type":20,"value":68},{"type":15,"tag":58,"props":891,"children":892},{"style":71},[893],{"type":20,"value":74},{"type":15,"tag":58,"props":895,"children":896},{"style":77},[897],{"type":20,"value":280},{"type":15,"tag":58,"props":899,"children":900},{"style":83},[901],{"type":20,"value":193},{"type":15,"tag":58,"props":903,"children":904},{"style":196},[905],{"type":20,"value":199},{"type":15,"tag":58,"props":907,"children":908},{"style":83},[909],{"type":20,"value":86},{"type":15,"tag":58,"props":911,"children":913},{"class":60,"line":912},16,[914,918,922,926,930,934,938],{"type":15,"tag":58,"props":915,"children":916},{"style":65},[917],{"type":20,"value":95},{"type":15,"tag":58,"props":919,"children":920},{"style":196},[921],{"type":20,"value":305},{"type":15,"tag":58,"props":923,"children":924},{"style":83},[925],{"type":20,"value":310},{"type":15,"tag":58,"props":927,"children":928},{"style":98},[929],{"type":20,"value":111},{"type":15,"tag":58,"props":931,"children":932},{"style":83},[933],{"type":20,"value":116},{"type":15,"tag":58,"props":935,"children":936},{"style":98},[937],{"type":20,"value":121},{"type":15,"tag":58,"props":939,"children":940},{"style":83},[941],{"type":20,"value":126},{"type":15,"tag":58,"props":943,"children":945},{"class":60,"line":944},17,[946,950,954,958],{"type":15,"tag":58,"props":947,"children":948},{"style":65},[949],{"type":20,"value":95},{"type":15,"tag":58,"props":951,"children":952},{"style":65},[953],{"type":20,"value":796},{"type":15,"tag":58,"props":955,"children":956},{"style":98},[957],{"type":20,"value":101},{"type":15,"tag":58,"props":959,"children":960},{"style":83},[961],{"type":20,"value":805},{"type":15,"tag":58,"props":963,"children":965},{"class":60,"line":964},18,[966,970,974,978,982,987,991],{"type":15,"tag":58,"props":967,"children":968},{"style":98},[969],{"type":20,"value":813},{"type":15,"tag":58,"props":971,"children":972},{"style":83},[973],{"type":20,"value":818},{"type":15,"tag":58,"props":975,"children":976},{"style":71},[977],{"type":20,"value":823},{"type":15,"tag":58,"props":979,"children":980},{"style":826},[981],{"type":20,"value":829},{"type":15,"tag":58,"props":983,"children":984},{"style":832},[985],{"type":20,"value":986},"page",{"type":15,"tag":58,"props":988,"children":989},{"style":826},[990],{"type":20,"value":840},{"type":15,"tag":58,"props":992,"children":993},{"style":83},[994],{"type":20,"value":126},{"type":15,"tag":58,"props":996,"children":998},{"class":60,"line":997},19,[999,1003],{"type":15,"tag":58,"props":1000,"children":1001},{"style":98},[1002],{"type":20,"value":852},{"type":15,"tag":58,"props":1004,"children":1005},{"style":83},[1006],{"type":20,"value":857},{"type":15,"tag":58,"props":1008,"children":1010},{"class":60,"line":1009},20,[1011],{"type":15,"tag":58,"props":1012,"children":1013},{"style":83},[1014],{"type":20,"value":865},{"type":15,"tag":58,"props":1016,"children":1018},{"class":60,"line":1017},21,[1019],{"type":15,"tag":58,"props":1020,"children":1021},{"style":83},[1022],{"type":20,"value":161},{"type":15,"tag":16,"props":1024,"children":1025},{},[1026],{"type":20,"value":1027},"With that change, you can start inserting rows into Azure Table Storage. Querying them back results in Content types, and then saving those back again results in data loss!",{"type":15,"tag":16,"props":1029,"children":1030},{},[1031],{"type":20,"value":1032},"We must help the CloudTable client materialize the correct results by creating an EntityResolver:",{"type":15,"tag":46,"props":1034,"children":1036},{"className":48,"code":1035,"language":50,"meta":51,"style":51},"EntityResolver\u003CContent> contentResolver(partitionKey, rowKey, timestamp, properties, etag) {\n  var contentType = properties[\"ContentType\"].StringValue;\n  switch (contentType) {\n    case \"blog\": return new BlogPost();\n    case \"page\": return new Page();\n    default: throw new NotSupportedException(String.Format(\"Unknown ContentType '{0}'\", contentType));\n  }\n}\n",[1037],{"type":15,"tag":54,"props":1038,"children":1039},{"__ignoreMap":51},[1040,1072,1129,1142,1185,1224,1283,1290],{"type":15,"tag":58,"props":1041,"children":1042},{"class":60,"line":61},[1043,1048,1052,1056,1061,1067],{"type":15,"tag":58,"props":1044,"children":1045},{"style":196},[1046],{"type":20,"value":1047},"EntityResolver",{"type":15,"tag":58,"props":1049,"children":1050},{"style":83},[1051],{"type":20,"value":221},{"type":15,"tag":58,"props":1053,"children":1054},{"style":196},[1055],{"type":20,"value":199},{"type":15,"tag":58,"props":1057,"children":1058},{"style":83},[1059],{"type":20,"value":1060},"> ",{"type":15,"tag":58,"props":1062,"children":1064},{"style":1063},"--shiki-default:#8DA101;--shiki-dark:#50FA7B",[1065],{"type":20,"value":1066},"contentResolver",{"type":15,"tag":58,"props":1068,"children":1069},{"style":83},[1070],{"type":20,"value":1071},"(partitionKey, rowKey, timestamp, properties, etag) {\n",{"type":15,"tag":58,"props":1073,"children":1074},{"class":60,"line":89},[1075,1080,1085,1090,1096,1101,1105,1110,1114,1119,1124],{"type":15,"tag":58,"props":1076,"children":1077},{"style":98},[1078],{"type":20,"value":1079},"  var",{"type":15,"tag":58,"props":1081,"children":1082},{"style":83},[1083],{"type":20,"value":1084}," contentType ",{"type":15,"tag":58,"props":1086,"children":1087},{"style":65},[1088],{"type":20,"value":1089},"=",{"type":15,"tag":58,"props":1091,"children":1093},{"style":1092},"--shiki-default:#35A77C;--shiki-dark:#F8F8F2",[1094],{"type":20,"value":1095}," properties",{"type":15,"tag":58,"props":1097,"children":1098},{"style":83},[1099],{"type":20,"value":1100},"[",{"type":15,"tag":58,"props":1102,"children":1103},{"style":826},[1104],{"type":20,"value":840},{"type":15,"tag":58,"props":1106,"children":1107},{"style":832},[1108],{"type":20,"value":1109},"ContentType",{"type":15,"tag":58,"props":1111,"children":1112},{"style":826},[1113],{"type":20,"value":840},{"type":15,"tag":58,"props":1115,"children":1116},{"style":83},[1117],{"type":20,"value":1118},"].",{"type":15,"tag":58,"props":1120,"children":1121},{"style":1092},[1122],{"type":20,"value":1123},"StringValue",{"type":15,"tag":58,"props":1125,"children":1126},{"style":83},[1127],{"type":20,"value":1128},";\n",{"type":15,"tag":58,"props":1130,"children":1131},{"class":60,"line":129},[1132,1137],{"type":15,"tag":58,"props":1133,"children":1134},{"style":71},[1135],{"type":20,"value":1136},"  switch",{"type":15,"tag":58,"props":1138,"children":1139},{"style":83},[1140],{"type":20,"value":1141}," (contentType) {\n",{"type":15,"tag":58,"props":1143,"children":1144},{"class":60,"line":155},[1145,1150,1154,1158,1162,1167,1171,1176,1180],{"type":15,"tag":58,"props":1146,"children":1147},{"style":71},[1148],{"type":20,"value":1149},"    case",{"type":15,"tag":58,"props":1151,"children":1152},{"style":826},[1153],{"type":20,"value":829},{"type":15,"tag":58,"props":1155,"children":1156},{"style":832},[1157],{"type":20,"value":835},{"type":15,"tag":58,"props":1159,"children":1160},{"style":826},[1161],{"type":20,"value":840},{"type":15,"tag":58,"props":1163,"children":1164},{"style":83},[1165],{"type":20,"value":1166},": ",{"type":15,"tag":58,"props":1168,"children":1169},{"style":71},[1170],{"type":20,"value":823},{"type":15,"tag":58,"props":1172,"children":1173},{"style":71},[1174],{"type":20,"value":1175}," new",{"type":15,"tag":58,"props":1177,"children":1178},{"style":196},[1179],{"type":20,"value":188},{"type":15,"tag":58,"props":1181,"children":1182},{"style":83},[1183],{"type":20,"value":1184},"();\n",{"type":15,"tag":58,"props":1186,"children":1187},{"class":60,"line":164},[1188,1192,1196,1200,1204,1208,1212,1216,1220],{"type":15,"tag":58,"props":1189,"children":1190},{"style":71},[1191],{"type":20,"value":1149},{"type":15,"tag":58,"props":1193,"children":1194},{"style":826},[1195],{"type":20,"value":829},{"type":15,"tag":58,"props":1197,"children":1198},{"style":832},[1199],{"type":20,"value":986},{"type":15,"tag":58,"props":1201,"children":1202},{"style":826},[1203],{"type":20,"value":840},{"type":15,"tag":58,"props":1205,"children":1206},{"style":83},[1207],{"type":20,"value":1166},{"type":15,"tag":58,"props":1209,"children":1210},{"style":71},[1211],{"type":20,"value":823},{"type":15,"tag":58,"props":1213,"children":1214},{"style":71},[1215],{"type":20,"value":1175},{"type":15,"tag":58,"props":1217,"children":1218},{"style":196},[1219],{"type":20,"value":280},{"type":15,"tag":58,"props":1221,"children":1222},{"style":83},[1223],{"type":20,"value":1184},{"type":15,"tag":58,"props":1225,"children":1226},{"class":60,"line":174},[1227,1232,1236,1241,1245,1250,1255,1260,1265,1269,1274,1278],{"type":15,"tag":58,"props":1228,"children":1229},{"style":71},[1230],{"type":20,"value":1231},"    default",{"type":15,"tag":58,"props":1233,"children":1234},{"style":83},[1235],{"type":20,"value":1166},{"type":15,"tag":58,"props":1237,"children":1238},{"style":71},[1239],{"type":20,"value":1240},"throw",{"type":15,"tag":58,"props":1242,"children":1243},{"style":71},[1244],{"type":20,"value":1175},{"type":15,"tag":58,"props":1246,"children":1247},{"style":196},[1248],{"type":20,"value":1249}," NotSupportedException",{"type":15,"tag":58,"props":1251,"children":1252},{"style":83},[1253],{"type":20,"value":1254},"(String.",{"type":15,"tag":58,"props":1256,"children":1257},{"style":1063},[1258],{"type":20,"value":1259},"Format",{"type":15,"tag":58,"props":1261,"children":1262},{"style":83},[1263],{"type":20,"value":1264},"(",{"type":15,"tag":58,"props":1266,"children":1267},{"style":826},[1268],{"type":20,"value":840},{"type":15,"tag":58,"props":1270,"children":1271},{"style":832},[1272],{"type":20,"value":1273},"Unknown ContentType '{0}'",{"type":15,"tag":58,"props":1275,"children":1276},{"style":826},[1277],{"type":20,"value":840},{"type":15,"tag":58,"props":1279,"children":1280},{"style":83},[1281],{"type":20,"value":1282},", contentType));\n",{"type":15,"tag":58,"props":1284,"children":1285},{"class":60,"line":206},[1286],{"type":15,"tag":58,"props":1287,"children":1288},{"style":83},[1289],{"type":20,"value":865},{"type":15,"tag":58,"props":1291,"children":1292},{"class":60,"line":250},[1293],{"type":15,"tag":58,"props":1294,"children":1295},{"style":83},[1296],{"type":20,"value":161},{"type":15,"tag":16,"props":1298,"children":1299},{},[1300],{"type":20,"value":1301},"Which passes into operations that materialize results. Note that some signatures don’t accept a resolver, so find one that does even if it means supplying a default OperationContent. For example:",{"type":15,"tag":46,"props":1303,"children":1305},{"className":48,"code":1304,"language":50,"meta":51,"style":51},"var query = table.CreateQuery\u003CContent>().Where(c => c.PartitionKey == yearMonth);\nvar results = query.ExecuteQuery(query.AsTableQuery(), contentResolver, myRequestOptions, myOperationContext);\n",[1306],{"type":15,"tag":54,"props":1307,"children":1308},{"__ignoreMap":51},[1309,1389],{"type":15,"tag":58,"props":1310,"children":1311},{"class":60,"line":61},[1312,1317,1322,1326,1331,1336,1340,1344,1349,1354,1358,1364,1369,1374,1379,1384],{"type":15,"tag":58,"props":1313,"children":1314},{"style":98},[1315],{"type":20,"value":1316},"var",{"type":15,"tag":58,"props":1318,"children":1319},{"style":83},[1320],{"type":20,"value":1321}," query ",{"type":15,"tag":58,"props":1323,"children":1324},{"style":65},[1325],{"type":20,"value":1089},{"type":15,"tag":58,"props":1327,"children":1328},{"style":83},[1329],{"type":20,"value":1330}," table.",{"type":15,"tag":58,"props":1332,"children":1333},{"style":1063},[1334],{"type":20,"value":1335},"CreateQuery",{"type":15,"tag":58,"props":1337,"children":1338},{"style":83},[1339],{"type":20,"value":221},{"type":15,"tag":58,"props":1341,"children":1342},{"style":196},[1343],{"type":20,"value":199},{"type":15,"tag":58,"props":1345,"children":1346},{"style":83},[1347],{"type":20,"value":1348},">().",{"type":15,"tag":58,"props":1350,"children":1351},{"style":1063},[1352],{"type":20,"value":1353},"Where",{"type":15,"tag":58,"props":1355,"children":1356},{"style":83},[1357],{"type":20,"value":1264},{"type":15,"tag":58,"props":1359,"children":1361},{"style":1360},"--shiki-default:#5C6A72;--shiki-default-font-style:inherit;--shiki-dark:#FFB86C;--shiki-dark-font-style:italic",[1362],{"type":20,"value":1363},"c",{"type":15,"tag":58,"props":1365,"children":1366},{"style":65},[1367],{"type":20,"value":1368}," =>",{"type":15,"tag":58,"props":1370,"children":1371},{"style":83},[1372],{"type":20,"value":1373}," c.",{"type":15,"tag":58,"props":1375,"children":1376},{"style":1092},[1377],{"type":20,"value":1378},"PartitionKey",{"type":15,"tag":58,"props":1380,"children":1381},{"style":65},[1382],{"type":20,"value":1383}," ==",{"type":15,"tag":58,"props":1385,"children":1386},{"style":83},[1387],{"type":20,"value":1388}," yearMonth);\n",{"type":15,"tag":58,"props":1390,"children":1391},{"class":60,"line":89},[1392,1396,1401,1405,1410,1415,1420,1425],{"type":15,"tag":58,"props":1393,"children":1394},{"style":98},[1395],{"type":20,"value":1316},{"type":15,"tag":58,"props":1397,"children":1398},{"style":83},[1399],{"type":20,"value":1400}," results ",{"type":15,"tag":58,"props":1402,"children":1403},{"style":65},[1404],{"type":20,"value":1089},{"type":15,"tag":58,"props":1406,"children":1407},{"style":83},[1408],{"type":20,"value":1409}," query.",{"type":15,"tag":58,"props":1411,"children":1412},{"style":1063},[1413],{"type":20,"value":1414},"ExecuteQuery",{"type":15,"tag":58,"props":1416,"children":1417},{"style":83},[1418],{"type":20,"value":1419},"(query.",{"type":15,"tag":58,"props":1421,"children":1422},{"style":1063},[1423],{"type":20,"value":1424},"AsTableQuery",{"type":15,"tag":58,"props":1426,"children":1427},{"style":83},[1428],{"type":20,"value":1429},"(), contentResolver, myRequestOptions, myOperationContext);\n",{"type":15,"tag":16,"props":1431,"children":1432},{},[1433],{"type":20,"value":1434},"Given that these entity resolvers are essential to correctly materializing your results without data loss, it’s worth wrapping the CloudTable client with the necessary setup/table-creation/entity resolver.",{"type":15,"tag":16,"props":1436,"children":1437},{},[1438],{"type":15,"tag":1439,"props":1440,"children":1441},"em",{},[1442],{"type":20,"value":1443},"[)amien",{"type":15,"tag":1445,"props":1446,"children":1447},"style",{},[1448],{"type":20,"value":1449},"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":51,"searchDepth":89,"depth":89,"links":1451},[],"markdown","content:blog:2015:table-per-hierarchy-in-azure-table-storage.md","content","blog/2015/table-per-hierarchy-in-azure-table-storage.md","blog/2015/table-per-hierarchy-in-azure-table-storage","md","/blog/2015/table-per-hierarchy-in-azure-table-storage/",606,0,[1462,1466,1470],{"title":1463,"date":1464,"url":1465},"HTML5 Video Cheatsheet: Optimizing videos for the web","2025-12-05T00:00:00Z","/blog/2025/html5-video-cheatsheet/",{"title":1467,"date":1468,"url":1469},"Transactions in the MongoDB EF Core Provider","2025-10-25","/blog/2025/mongodb-explicit-transactions/",{"title":1471,"date":1472,"url":1473},"Queryable Encryption with the MongoDB EF Core Provider","2025-09-22","/blog/2025/mongodb-queryable-encryption/",[],1779264582421]