Small help with immutable types...
// private readonly int _age;
// public int Age { get { return _age; } }
public int Age { get; }
using System.Collections.Generic; | |
namespace Sitecore.StaticAssets.Infrastructure | |
{ | |
public class AssetCollection : Dictionary<string, string> | |
{ | |
} | |
} |
using System.Diagnostics; | |
using System.IO; | |
using System.Web.Caching; | |
using Newtonsoft.Json;; | |
namespace Sitecore.StaticAssets.Infrastructure | |
{ | |
public class StaticAssetResolver | |
{ | |
private readonly string _assetsJsonPath; |
using System.Web; | |
using Sitecore.StaticAssets.Infrastructure; | |
namespace Sitecore.StaticAssets.Html.Helpers | |
{ | |
public static class StaticAssets | |
{ | |
private static StaticAssetResolver _assetResolver; | |
public static void Initialize(StaticAssetResolver staticAssetResolver) |
using Sitecore.Pipelines; | |
using Sitecore.StaticAssets.Infrastructure; | |
namespace Sitecore.StaticAssets.Pipelines | |
{ | |
public class InitializeStaticAssetsResolver | |
{ | |
private readonly string _assetPath; | |
public InitializeStaticAssetsResolver(string assetPath) |
Rx.NET name | Reactive Extensions name | |
---|---|---|
Observable.Return | Observable.just | |
Select | map | |
SelectMany | flatMap | |
Where | filter | |
Aggregate | reduce | |
Debounce | throttle | |
Synchronize | serialize |
using System; | |
using System.Reactive.Linq; | |
using System.Reactive.Subjects; | |
// inspired by https://github.com/shiftkey/Reactive.EventAggregator/blob/master/src/Reactive.EventAggregator/EventAggregator.cs | |
namespace Messaging | |
{ | |
public interface IEventAggregator : IDisposable | |
{ |
public interface IAsyncRunner | |
{ | |
void Run<T>(Action<T> action); | |
} | |
public class AsyncRunner : IAsyncRunner | |
{ | |
public ILifetimeScope LifetimeScope { get; set; } | |
public AsyncRunner(ILifetimeScope lifetimeScope) |
public class Car { | |
public int Id { get; set; } | |
[Required] | |
[StringLength(20)] | |
public string Make { get; set; } | |
[Required] | |
[StringLength(20)] |
/* | |
While generally using HttpContext, and all of the related properties such as | |
Cookies and Session, in WebAPI is not the right way sometimes it needs to be | |
done, especially when migrating existing code before doing a full rewrite but | |
could happen in any legacy MVC project you want to bring WebAPI into. | |
When using Autofac there is the AutofacWebTypesModule which allows you to resolve | |
these dependencies, all of which come from resolving HttpContextBase. | |
WebAPI doesn't provide HttpContext directly but if hosted in IIS rather than |