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
namespace ConsoleApplication | |
{ | |
public class Program | |
{ | |
private static HttpClient client = new HttpClient(); | |
public static async Task Main(string[] args) | |
{ | |
Console.WriteLine("Starting connections"); |
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 (var connection = connectionFactory.GetConnection()) | |
{ | |
using(var reader = | |
connection.QueryMultiple("<stored procedure>", new { }, CommandType.StoredProcedure)) | |
{ | |
var metadata = reader.Read<Metadata>().First(); | |
var items = reader.Read<Foo>(); | |
return | |
new StaticPaginable<Foo>( |
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
namespace WebApp.Models | |
{ | |
using System; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Mvc.Filters; | |
public class DbContextTransactionFilter : IAsyncPageFilter | |
{ | |
async Task IAsyncPageFilter.OnPageHandlerExecutionAsync( | |
PageHandlerExecutingContext context, |
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
Task("Build") | |
.IsDependentOn("Restore") | |
.Does(() => | |
{ | |
var projects = GetFiles("./**/*.csproj").ToPaginable(1, 10); | |
foreach(var project in projects) | |
{ | |
Information($"{project.ItemNumber}, {project.Item.ToString()}"); | |
// DotNetCoreBuild( | |
// project.FullPath, |
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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var command = new CreateCommand | |
{ | |
Items = new List<CreateCommand.Item>() | |
{ | |
new CreateCommand.Item { Email = "test@test.com", NameFirst = "Test", NameLast = "Test"}, | |
new CreateCommand.Item { Email = "testtest.com", NameFirst = "Test", NameLast = "Test"}, |
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 void Main(string[] args) | |
{ | |
var configurationBuilder = | |
ConfigurationBuilder | |
.With<SomeBatchRecord>() | |
.ReadAsConsolidated(t=> | |
{ | |
.Read<ExcelFileReader>(t=> t.Read("c:\\somefile.xls")) | |
.Read<TextFileReadr>(t=> t.Read("somefile.txt")); | |
}) |
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 TripsByDateQuery : IQuery<IEnumerable<Trip>> | |
{ | |
public DateTime? Lowerbound { get;set; } | |
public DateTime? UpperBound { get; set; } | |
} | |
public class TripsByDateQueryHandler : IQueryHandler<TripsByDateQuery, IEnumerable<Trip>>, ICachable | |
{ | |
public IEnumerable<Trip> Handle(TripsByDateQuery query) | |
{ |
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
function getPaginableFilters() { | |
var result = []; | |
$('.paginable-filter').each(function () { | |
var filterType = $(this).data('filter-key'); | |
$(':checkbox:checked', this).each(function () { | |
var item = {}; |
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 ControllerExtensions | |
{ | |
public static string RenderRazorViewToString(this Controller c, string viewName, object model) | |
{ | |
c.ViewData.Model = model; | |
using (var sw = new StringWriter()) | |
{ | |
var viewResult = ViewEngines.Engines.FindPartialView(c.ControllerContext, viewName); | |
var viewContext = new ViewContext(c.ControllerContext, viewResult.View, c.ViewData, c.TempData, sw); |
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; |
NewerOlder