This file contains 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
_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); |
This file contains 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 interface ICategoryService : IDependency { | |
IEnumerable<IContentItemSummary> GetItemsForCategory(int categoryId); | |
IEnumerable<string> GetCategoryTypes(); | |
Dictionary<int, string> GetCategoriesByTypeName(string typeName); | |
} |
This file contains 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
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 { |
This file contains 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
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) { |
This file contains 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 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(); |
This file contains 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 contentAzDefinitions = this.cacheManager.Get( | |
string.Concat("Patient.Contenttypes.Az.Ids.For.", letter), | |
ctx => { | |
ctx.Monitor(this.clock.When(Timespan.FromDays(1))); | |
var titleDefinitions = this.letterRepository.Fetch(x => x.Title.StartsWith(letter)).toList(); | |
var content = this.contentManager.GetMany(titleDefinitions.Select(x => x.ContentItemId), VersionOptions.Published); | |
var items = new List<AzLinkDefinition>(); | |
foreach(var titleDefinition in titleDefinitions) | |
{ |
This file contains 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 contentItemIdsByLetter = this.cacheManager.Get( | |
string.Concat("Patient.Contenttypes.Az.Ids.For.", letter), | |
ctx => { | |
ctx.Monitor(this.clock.When(Timespan.FromDays(1))); | |
return this.letterRepository.Fetch(x => x.Title.StartsWith(letter)).toList(); | |
} | |
var items = this.cacheManager.Get( | |
string.Concat("Patient.Contenttypes.Az.Items.For.", letter, ".By.", contentType), | |
ctx => { |
This file contains 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
private readonly ISuesService suesService; | |
// current | |
void SuesController(ISuesService ss) | |
{ | |
this.suesService = ss; | |
} | |
// without di | |
void SuesController() |
This file contains 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
<location path="route"> | |
<system.web> | |
<httpHandlers> | |
<add path="*" type="System.Web.Handlers.TransferRequestHandler" verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" /> | |
</httpHandlers> | |
</system.web> | |
<!-- Required for IIS 7.0 --> | |
<system.webServer> | |
<modules runAllManagedModulesForAllRequests="true" /> | |
<validation validateIntegratedModeConfiguration="false" /> |
This file contains 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
using Orchard; | |
using Orchard.Caching; | |
using Orchard.Environment.Configuration; | |
using Orchard.Environment.Extensions; | |
using Orchard.Mvc.Filters; | |
using Orchard.OutputCache.Filters; | |
using Orchard.OutputCache.Services; | |
using Orchard.Services; | |
using Orchard.Themes; | |
using Patient.Core.Extensions; |