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.ComponentModel.Composition; | |
using System.ComponentModel.Composition.Hosting; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace TripIt | |
{ |
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.Data.Entity; | |
using System.Data.Entity.ModelConfiguration; | |
using System.Linq; | |
namespace TripIt | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |
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 class Period | |
{ | |
public int PeriodID { get; set; } | |
public DateTime DateFrom { get; set; } | |
public DateTime DateTo { get; set; } | |
public int YearValue { get; set; } | |
public int MonthValue { get; set; } | |
public string MonthName { get; set; } |
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 class CachableRequestHandler<TRequest, TResponse> | |
: IAsyncRequestHandler<TRequest, TResponse> | |
where TRequest : IAsyncRequest<TResponse>, ICacheable<TRequest> | |
where TResponse : class | |
{ | |
private readonly IAsyncRequestHandler<TRequest, TResponse> innerHandler; | |
private readonly ObjectCache objectCache; | |
private readonly ReaderWriterLockSlim cacheLock = new ReaderWriterLockSlim(); |
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
//# setup: config.MessageHandlers.Add(new DummyAuthenticationHandler()); | |
public class DummyAuthenticationHandler : DelegatingHandler | |
{ | |
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) | |
{ | |
if (string.IsNullOrWhiteSpace(Thread.CurrentPrincipal.Identity.AuthenticationType)) | |
{ | |
var claims = | |
new List<Claim> | |
{ |
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.Data.Entity.Core.Metadata.Edm; | |
using System.Data.Entity.Infrastructure; | |
using System.Data.Entity.ModelConfiguration.Conventions; | |
//# Rename code first foreign keys from [{Table}_{ColumnId}] to [{ColumnId}]. | |
public class ForeignKeyNamingConvention : IStoreModelConvention<AssociationType> | |
{ | |
public void Apply(AssociationType association, DbModel model) | |
{ |
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 StructureMap; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var container = new Container(t => |
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 System.Net.Http; | |
using System.Web.Http.Filters; | |
using Newtonsoft.Json; | |
using PaginableCollections; | |
public class PaginableResultActionFilter : ActionFilterAttribute | |
{ | |
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) |
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 static class SortQueryableExtensions | |
{ | |
public static IQueryable<T> ApplySort<T>(this IQueryable<T> queryable, string sort) | |
{ | |
if (queryable == null) | |
throw new ArgumentNullException(); | |
if (string.IsNullOrWhiteSpace(sort)) | |
return queryable; |
OlderNewer