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 BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Jobs; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.EntityFrameworkCore; | |
using BenchmarkDotNet.Running; | |
[SimpleJob(RuntimeMoniker.Net60)] | |
[MemoryDiagnoser] | |
[ThreadingDiagnoser] | |
public class AsyncVsNonAsyncEF |
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 BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Jobs; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.EntityFrameworkCore; | |
using BenchmarkDotNet.Running; | |
[SimpleJob(RuntimeMoniker.Net60)] | |
[MemoryDiagnoser] | |
[ThreadingDiagnoser] | |
public class AsyncVsNonAsyncEF |
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
// Service Registration | |
services.AddSingleton(provider => new MapperConfiguration(cfg => | |
{ | |
var profiles = typeof(Startup).Assembly.GetTypes() | |
.Where(t => t.BaseType == typeof(Profile) && !t.IsAbstract && t.IsPublic); | |
var serviceFactory = provider.GetService<IServiceScopeFactory>(); | |
foreach (var profile in profiles) | |
{ | |
var profileInstance = Activator.CreateInstance(profile, serviceFactory) as AutoMapper.Profile; |
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
services.AddDbContext<ApplicationDbContext>((scope, options) => | |
{ | |
var context = scope.GetRequiredService<IActionContextAccessor>(); | |
string connectionString = "DefaultConnection"; | |
var actionContext = context.ActionContext; | |
if (actionContext != null) | |
{ | |
var routeValues = actionContext.RouteData.Values; | |
if (routeValues.ContainsKey("community")) | |
{ |
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
import { Injectable, Inject, NgZone } from '@angular/core'; | |
import { EVENT_MANAGER_PLUGINS, EventManager } from '@angular/platform-browser'; | |
@Injectable() | |
export class CustomEventManager extends EventManager { | |
constructor( @Inject(EVENT_MANAGER_PLUGINS) plugins: any[], private zone: NgZone) { | |
super(plugins, zone); | |
} | |
addGlobalEventListener(target: string, eventName: string, handler: Function): Function { | |
if (eventName.endsWith('out-zone')) { |
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
const fs = require('fs'); | |
const path = require('path'); | |
const ProgressPlugin = require('webpack/lib/ProgressPlugin'); | |
const CircularDependencyPlugin = require('circular-dependency-plugin'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
const autoprefixer = require('autoprefixer'); | |
const postcssUrl = require('postcss-url'); | |
const cssnano = require('cssnano'); | |
const { NoEmitOnErrorsPlugin, SourceMapDevToolPlugin, NamedModulesPlugin } = require('webpack'); |
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
import { Injectable } from '@angular/core'; | |
import pdfMake from 'pdfmake/build/pdfmake'; | |
import './CustomPDFFont'; | |
@Injectable() | |
export | |
class PDFHandler { | |
constructor() { | |
pdfMake.fonts = { |
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
@Injectable() | |
export class QueryBuilder<T> { | |
private queryString: string; | |
private postObject: Object; | |
private method: string; | |
private controller: string; | |
constructor(public http: HttpHandler) { | |
} | |
public Query(controller: string): this { | |
this.controller = controller; |
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
import { Http, RequestOptionsArgs, Headers, RequestOptions, Response } from '@angular/http'; | |
import 'rxjs/add/operator/toPromise'; | |
import { Injectable } from '@angular/core'; | |
@Injectable() | |
export class HttpHandler { | |
constructor(public http: Http) { | |
} | |
public Get(url: string): Promise<Response> { |