orchardcms - Orchard CMS: ContentPart not added to ContentItem in migration -


i trying build module following in migration:

    public class xyzzypartrecord : contentpartrecord     {         public virtual string plugh { get; set; }     }      public class xyzzypart : contentpart<xyzzypartrecord>     {         public string plugh {             { return retrieve( r => r.plugh ); }             set { store( r => r.plugh, value ); }         }     }      public int create() {          schemabuilder.createtable( "xyzzypartrecord", table => table             .contentpartrecord()             .column<string>( "plugh" )         );          contentdefinitionmanager.alterpartdefinition( "xyzzypart", cfg => cfg             .withdescription( "xyzzypart" ) );          contentdefinitionmanager.altertypedefinition( "xyzzyitem", cfg => cfg             .withpart( "xyzzypart" )         );          return 1;     } 

when accessing xyzzyitem, there no xyzzypart in parts collection. instead there contentpart.

how content part allow added content item's parts collection?

i had neglected create either driver or handler part. once in place code worked expected.

namespace myproject.drivers {      public class xyzzypartdriver : contentpartdriver<xyzzypart> {          protected override driverresult display( xyzzypart part, string displaytype, dynamic shapehelper ) {             return contentshape( "parts_xyzzy",                 () => shapehelper.parts_xyzzy(                     xyzzy: part ) );         }     } }  namespace myproject.handlers {      public class xyzzyparthandler : contenthandler {          public xyzzyparthandler( irepository<xyzzypartrecord> repository ) {             filters.add( storagefilter.for( repository ) );         }     } } 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -