Created
March 18, 2013 23:30
-
-
Save mikeedwards83/5191976 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var currentItem = context.GetCurrentItem<Parent>(); | |
| var newChild = new Child(); | |
| //we use the Name property as the item name when creating an item | |
| newChild.Name = "MyNewChild"; | |
| //you can map other properties here | |
| newChild.PageTitle ="My New Child"; | |
| using(new SecurityDisabler()){ | |
| context.Create(parent, child); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [SitecoreClass] | |
| public class Parent | |
| { | |
| [SitecoreId] | |
| public virtual Guid Id{get;set;} | |
| } | |
| [SitecoreClass] | |
| public class Child | |
| { | |
| [SitecoreId] | |
| public virtual Guid Id{get;set;} | |
| [SitecoreInfo(SitecoreInfoType.Name)] | |
| public virtual string Name{get;set;} | |
| [SitecoreField] | |
| public virtual string PageTitle{get;set;} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment