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
public class Control | |
{ | |
public object value { get; set; } | |
public virtual object ConvertedValue { get; set; } | |
public Editor editor { get; set; } | |
} | |
public class Editor |
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
[GridResolver("someOtherAlias")] | |
public GridModel Grid { get; set; } |
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
public class TextPage : Page | |
{ | |
public TextPage(IPublishedContent content) : base(content) | |
{ | |
} | |
public string Title { get; set; } | |
public HtmlString Body { get; set; } |
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
/* Overriding makes sense when you look at the generated IL for overriden fields =) */ | |
public override T OverrideProperty<T>(string propertyName, Type attribute = null, Type [] constructorParams = null, object [] constructorValues = null) | |
{ | |
// [ML] - Default to an empty instance | |
constructorParams = constructorParams ?? Type.EmptyTypes; | |
constructorValues = constructorValues ?? new object[] { null }; | |
var type = typeof(T); |
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
/* Generating a proxy of a Type and overriding a virtual property with this method blows up in IIs Express, but works fine in unit tests (nunit, resharper) and | |
local IIS. This is using VS Community 2013 on Windows 8 */ | |
public override T OverrideProperty<T>(string propertyName, Type attribute = null, Type [] constructorParams = null, object [] constructorValues = null) | |
{ | |
// [ML] - Default to an empty instance | |
constructorParams = constructorParams ?? Type.EmptyTypes; | |
constructorValues = constructorValues ?? new object[] { null }; |
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
namespace Ditto.Resolvers.Sample.Models.DocTypes | |
{ | |
public class Home : Page | |
{ | |
public Home(IPublishedContent content) : base(content) | |
{ | |
} | |
public string Title { get; set; } |
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
namespace Ditto.Resolvers.Sample.Models.Archetypes | |
{ | |
public class PriceList : ArchetypeFieldsetModel | |
{ | |
public string Title { get; set; } | |
public int Quantity { get; set; } | |
public string Price { get; set; } |
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
namespace Our.Umbraco.Ditto.Resolvers.Archetype.Resolvers | |
{ | |
public class ArchetypeValueResolver : DittoValueResolver<ArchetypeResolverAttribute> | |
{ | |
public override object ResolveValue(ITypeDescriptorContext context, ArchetypeResolverAttribute attribute, CultureInfo culture) | |
{ | |
var content = context.Instance as IPublishedContent; | |
var descriptor = context.PropertyDescriptor; | |
if (content != null && descriptor != null) |
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
void ExamineEvents_GatheringNodeData(object sender, IndexingNodeDataEventArgs e) | |
{ | |
// [ML] - Grab any properties that have been injected via IndexingNodeDataEventArgs 'node' and input them | |
if (e.IndexType == IndexTypes.Content) | |
{ | |
foreach (var node in e.Node.Elements()) | |
{ | |
if (!e.Fields.ContainsKey(node.Name.LocalName)) | |
{ |
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
public class CustomIndexer : UmbracoContentIndexer | |
{ | |
public override void ReIndexNode(XElement node, string type) | |
{ | |
this.EnqueueIndexOperation(new IndexOperation | |
{ | |
Operation = IndexOperationType.Add, | |
Item = new IndexItem(node, type, (string)node.Attribute("id")) | |
}); |