Skip to content

Instantly share code, notes, and snippets.

View carlwoodhouse's full-sized avatar

Carl Woodhouse carlwoodhouse

View GitHub Profile
var events = _cacheManager.Get("a.magic.key", ctx => {
ctx.Monitor(_signals.When(TimeSpan.FromHours(1));
var myEvents = new List<evento>();
if (menus != null) {
var menuIds = menus.Select(x => x.MenuTypePartRecord.Id).ToList();
var eventRecords = _contentManager.Query<ReservationPart, ReservationPartRecord>().Where(x => x.Name == user && menuIds.Contains(x.Record.MenuTypePartRecord.Id).ToList();
foreach (var menu in menus)
{
var reserva = Record.MenuTypePartRecord.Id.Where(item => item.Date == menu.Record.Date).FirstOrDefault();
using System;
using System.Linq;
using Orchard;
using Orchard.DisplayManagement.Descriptors;
using Orchard.Environment.Extensions;
[OrchardFeature("The.Name.of.a.Feature")]
namespace YourProvider.Providers {
public class YourPrivider : IShapeTableProvider {
public void Discover(ShapeTableBuilder builder) {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
namespace Patient.Framework.Caching {
public class DefaultCacheProvider : ICacheProvider {
string cacheStore = "FrameworkLocalStoreDefault";
public string CacheStoreKey {
public interface ICategoryService : IDependency {
IEnumerable<IContentItemSummary> GetItemsForCategory(int categoryId);
IEnumerable<string> GetCategoryTypes();
Dictionary<int, string> GetCategoriesByTypeName(string typeName);
}
_cacheManager is an injected instance of ICacheManager
_signals is an injected instance of ISignals
_clock is an injected instance of IClock
var someStuff = _cacheManager.Get("somecachekey",
ctx => {
ctx.Monitor(_clock.When(Timespan.FromHours(1));
ctx.Monitor(_signals.When(string.Concat(ctx.Key, "_Evict")));
return _someRepository.Table.OrderBy(r => r.Name).ToList().Select(x => x.Name);
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition="$(Configuration) == ''">Release</Configuration>
<DeploymentLocation>$(MSBuildProjectDirectory)\Packages</DeploymentLocation>
</PropertyGroup>
<Import Project="$(MSBuildProjectDirectory)\SlowCheetah\SlowCheetah.Transforms.targets"/>
<Import Project="$(MSBuildProjectDirectory)\MsBuildTasks\MSBuild.Community.Tasks.Targets"/>
<Target Name ="Build">
<?xml version="1.0" encoding="utf-8" ?>
<!-- For more information on using transformations
see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<HostComponents xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<Components xdt:Transform="Replace">
<Component Type="Orchard.Environment.Extensions.ExtensionMonitoringCoordinator">
<Properties>
<!-- Set Value="true" to disable new extensions monitoring -->
<Property Name="Disabled" Value="true"/>
</Properties>
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Routing;
using Orchard.Mvc.Routes;
using Patient.Framework.Routing;
namespace Patient.Forums {
public class Routes : IRouteProvider {
private const string _area = "Patient.Forums";
private readonly IForumControllerRouteConstraint _constraint;
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="PatientAzure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2015-04.2.6">
<WebRole name="Your.Azure.Web" vmsize="Standard_D3_v2">
<Sites>
<Site name="Orchard" physicalDirectory="..\..\Source\YourPrecompiledDrop">
<Bindings>
<Binding name="Http" endpointName="Http" />
</Bindings>
</Site>
</Sites>
@Patient3.Helpers.ViewHelper.DisplayChildrenOrdered(Model, WorkContext, Display)
using System.Web;
using Orchard;
using Orchard.Mvc.Spooling;
namespace Patient3.Helpers {
public static class ViewHelper {
public static IHtmlString DisplayChildrenOrdered(dynamic model, WorkContext workContext, dynamic display) {
var writer = new HtmlStringWriter();