5
votes

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...

2

2 Answers

7
votes

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.

1
votes

Templates (masterpages) are different to doc types - a single doc type can be rendered in many different ways by being assigned to many different templates/masterpages.

Umbraco creates some things physically and some things virtually - templates (masterpages), media (images), usercontrols, macroscripts (.cshtml razor scripts), stylesheets and scripts (.js files) are created as physical things in your file structure even when generated using the umbraco admin. Most of the rest of the site is created virtually in the database or cached into \app_data\umbraco.config and can't easily be created outside of the umbraco admin area.