If you are simply looking to source-control your doctypes, check out uSync which serializes the document types from Umbraco to disk.
If you are looking to have strongly typed models that represent your doctypes in code, check out the built in Models Builder and Ditto.
In general, its advisable to use the backoffice to create your doctypes. If you let us know the reason you want to create them in code, we might be able help with your specific case a bit more.
UCreate got an option for that, however. I don't recommend it because it isn't up to date on all things, and sometimes it constructors fails to initialize the umbraco page.
What I DO recommend is creating it in back office and then use uSync package to transfer it between installations.
If it's strongly typed models you're after there's a package that creates strongly typed models after you've created the doctypes backend. I can't recall the package's name though.
However. I've search far and long for this and the best solution is uSync + package which name I've forgot.
How to create document types in Visual Studio?
Or it is possible only in the back office?
If you are talking about creating document types programmatically, that is covered here: https://our.umbraco.org/forum/developers/api-questions/11210-Creating-a-document-type-property-programatically
Hi
Please refer this link may be it is use full for you
https://our.umbraco.org/wiki/reference/api-cheatsheet/linq-to-umbraco/generating-classes-from-document-types/
and one option from usite builder http://jondjones.com/how-to-build-an-umbraco-7-document-types-in-visual-studio-usitebuilder-explained/
hope this help
Regards
Samira
If you are simply looking to source-control your doctypes, check out uSync which serializes the document types from Umbraco to disk.
If you are looking to have strongly typed models that represent your doctypes in code, check out the built in Models Builder and Ditto.
In general, its advisable to use the backoffice to create your doctypes. If you let us know the reason you want to create them in code, we might be able help with your specific case a bit more.
UCreate got an option for that, however. I don't recommend it because it isn't up to date on all things, and sometimes it constructors fails to initialize the umbraco page.
What I DO recommend is creating it in back office and then use uSync package to transfer it between installations.
If it's strongly typed models you're after there's a package that creates strongly typed models after you've created the doctypes backend. I can't recall the package's name though.
However. I've search far and long for this and the best solution is uSync + package which name I've forgot.
Thank you all, I'll definitely try this. ;-)
BTW I was trying to accomplish that with no other packages.
Worth a view!
https://www.youtube.com/watch?v=Hr1irQ0h5J8
About 5 mins in to skip the Pete D one-man standup intro (not that you should!).
is working on a reply...