(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
public class ServiceResolverAdapter : IDependencyResolver | |
{ | |
private readonly System.Web.Mvc.IDependencyResolver dependencyResolver; | |
public ServiceResolverAdapter(System.Web.Mvc.IDependencyResolver dependencyResolver) | |
{ | |
if (dependencyResolver == null) throw new ArgumentNullException("dependencyResolver"); | |
this.dependencyResolver = dependencyResolver; | |
} |
{ | |
"AL": "Alabama", | |
"AK": "Alaska", | |
"AS": "American Samoa", | |
"AZ": "Arizona", | |
"AR": "Arkansas", | |
"CA": "California", | |
"CO": "Colorado", | |
"CT": "Connecticut", | |
"DE": "Delaware", |
using SampleApi.Results; | |
using System; | |
using System.Net.Http; | |
using System.Web.Http; | |
namespace SampleApi | |
{ | |
public static class IHttpActionResultExtensions | |
{ | |
public static IHttpActionResult With(this IHttpActionResult inner, string responsePhrase = null, Action<HttpResponseMessage> responseAction = null) |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
$/
artifacts/
build/
docs/
lib/
packages/
samples/
src/
tests/
public class AsyncMediatorPipeline<TRequest, TResponse> : IAsyncRequestHandler<TRequest, TResponse> where TRequest : IAsyncRequest<TResponse> | |
{ | |
private readonly IAsyncRequestHandler<TRequest, TResponse> inner; | |
private readonly IAsyncPreRequestHandler<TRequest>[] preRequestHandlers; | |
private readonly IAsyncPostRequestHandler<TRequest, TResponse>[] postRequestHandlers; | |
public AsyncMediatorPipeline(IAsyncRequestHandler<TRequest, TResponse> inner, IAsyncPreRequestHandler<TRequest>[] preRequestHandlers, IAsyncPostRequestHandler<TRequest, TResponse>[] postRequestHandlers) | |
{ | |
this.inner = inner; |
using System; | |
using System.Linq; | |
using Autofac; | |
using Autofac.Core; | |
namespace Autofac.Logging | |
{ | |
/// <summary> | |
/// Sets up automatic DI for service dependencies on <typeparamref name="TLogger"/>, | |
/// via an external factory that resolves based on the type of the resolver |
// Interface segregation (Combined Mixin+Non-mixin) | |
// For no-mixins version see https://gist.github.com/benaadams/d35ff5c534a43fd6c89d | |
// For mixins/generic constraints version see https://gist.github.com/benaadams/77c6e7aa34aae92b876a | |
// Do something with sync Reading, Seeking, Disposable stream (Generic Constraints) | |
public static void DoSomething<T>(T stream) where T : IBlockingReader, ISeekable, ISizable, IDisposable | |
{ | |
stream.ReadByte(); | |
stream.SetLength(6); | |
stream.Position = 5; |