Is there currently a way to use custom strong typed models with this? I am currently using CodeGen which is generating my document type models for me and it would be nice if I could use these.
I can see that the class thats returned is of type Our.Umbraco.NestedContent.Models.DetachedPublishedContent however I would like to be able to use my strongly typed model instead. Are there any plans to implement this, or do you have any suggestions of how to do this?
I'm not familiar with CodeGen so am not sure how this actually works. The only methods I know would work would be to use Ditto (https://our.umbraco.org/projects/developer-tools/ditto) to convert the DetachedPublishedContent (which implements IPublishedContent) into you other strongly typed model. This happens at run time so I know it will work.
Without knowing more on how CodeGen works, I couldn't really say what we would need to change (if anything) to get it to work.
It appears that Dittos model factory resolver conflicts with CodeGen which breaks all my exisiting CodeGen models. I think I'll need to pick one and stick with it.
Which version of Ditto are you using? We removed the ModelFactory to a separate assembly/project in v0.6 - so you shouldn't need it (unless you really want to use it?)
I'm using 0.6.5542.28635, I have removed the ModelFactory and tweaked my code and its working great, Its even fine with using the models CodeGen has created for my document types. I am definatly going to be replacing ArcheType with this now for all my projects.
Strongly Typed Models
Is there currently a way to use custom strong typed models with this? I am currently using CodeGen which is generating my document type models for me and it would be nice if I could use these.
I can see that the class thats returned is of type Our.Umbraco.NestedContent.Models.DetachedPublishedContent however I would like to be able to use my strongly typed model instead. Are there any plans to implement this, or do you have any suggestions of how to do this?
Thanks,
Gareth
Hey Gareth,
I'm not familiar with CodeGen so am not sure how this actually works. The only methods I know would work would be to use Ditto (https://our.umbraco.org/projects/developer-tools/ditto) to convert the DetachedPublishedContent (which implements IPublishedContent) into you other strongly typed model. This happens at run time so I know it will work.
Without knowing more on how CodeGen works, I couldn't really say what we would need to change (if anything) to get it to work.
@Gareth - is CodeGen the one that is powered by uSync data files?
@Lee Yes it is.
@Matt I'm looking into Ditto now, this looks like it doesnt exactly what I need. Thanks.
Cool! Yeah, Ditto is well suited for it. Let us know if you have any more questions about it.
Cheers,
- Lee
It appears that Dittos model factory resolver conflicts with CodeGen which breaks all my exisiting CodeGen models. I think I'll need to pick one and stick with it.
Thanks for your help guys.
Which version of Ditto are you using? We removed the ModelFactory to a separate assembly/project in v0.6 - so you shouldn't need it (unless you really want to use it?)
I'm using 0.6.5542.28635, I have removed the ModelFactory and tweaked my code and its working great, Its even fine with using the models CodeGen has created for my document types. I am definatly going to be replacing ArcheType with this now for all my projects.
is working on a reply...