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 static void Method<T>(string something) { | |
} |
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 static void RegisterRoutes(RouteCollection routes) | |
{ | |
var umbraco = new Route("{*url}", new RouteValueDictionary() { }, new RouteValueDictionary() { { "url", new YomegoCMSRouteConstraint() } }, new YomegoCMSRouteHandler()); | |
routes.Add(umbraco); | |
} |
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 YomegoCMSRouteConstraint : IRouteConstraint | |
{ | |
public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) | |
{ | |
return IsRoutable(httpContext); | |
} | |
private bool PopulateContext(CoreApp<CoreServiceContainer> app, HttpContextBase context, string url, UmbracoRouteAttribute contentType = null) | |
{ | |
// [ML ] -If this request has previously been routed, do nothing and route as context is populated |
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 YomegoCMSHandler : IHttpHandler | |
{ | |
public bool IsReusable { get; private set; } | |
private RequestContext _requestContext { get; set; } | |
public YomegoCMSHandler(RequestContext requestContext) | |
{ | |
_requestContext = requestContext; |
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
[UmbracoRoute("Home", Action = "Index")] // [ML] - index not required really, just added for demo purposes | |
public class Homepage : Page | |
{ | |
public Homepage(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
public void InjectToExamineNode(int id, Dictionary<string, string> newFields = null) | |
{ | |
if (newFields.HasContent()) | |
{ | |
var content = new Content(id); | |
if (content.Id > 0) | |
{ | |
var doc = content.ToXDocument(false).Root; |
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")) | |
}); |
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
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
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; } |
OlderNewer