Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why don't document types created through umbraco admin get created as .cs files

New to umbraco. Have umbraco project in VS2010 through which I run the umbraco admin locally. When creating templates through the admin, the new template appears as a master page in my Masterpages directory. Why is it that when I create a new document type through the admin, those do not appear as .cs pages in the DocumentTypes directory like I see them existing in projects that have already been created? Hate feeling like such a noob...

like image 561
neil1967 Avatar asked Nov 13 '12 21:11

neil1967


1 Answers

Document types are stored as database structures, and are not classes - even though they behave as such with property inheritance. To get a strongly-typed document type as a CS file for use in your code, though, you can right-click any document type and select "Export to .NET", which lets you save a CS file to your hard disk which you can then use in Visual Studio.

Edit: Another resource that you may find useful is http://our.umbraco.org/wiki/reference/api-cheatsheet/linq-to-umbraco/generating-classes-from-document-types - which explains how you can source-control some aspects of your document types using the LINQ2Umbraco library. However, as with all CMS systems, the safest methods fro preserving both structure and content are a) saving your genscripts for your DB to your source control system, b) backing up the DB and saving the BAK file into source control, or c) look at RedGate SQL Source Contol for a professional tool for source-controlling your database.

like image 115
Jamie Howarth Avatar answered Oct 01 '22 21:10

Jamie Howarth