Skip to content

Instantly share code, notes, and snippets.

public class AuthorizedForDomain : Attribute, IAsyncAuthorizationFilter
{
private BlogService blogService;
private DomainLookupService domainLookupService;
public AuthorizedForDomain(string failoverAction, string failoverController)
{
this.FailoverAction = failoverAction;
this.FailoverController = failoverController;
}
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace ConsoleApp2
{
public class Startup
using System;
using System.Data;
using System.Data.SqlClient;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
namespace BlogWeb.DataAccess
{
public class DbContext : IDbContext
{
public class ApplicationUser : IEquatable<int>
{
public int ApplicationUserId { get; set; }
public string UserName { get; set; }
public string NormalizedUserName { get; set; }
public string Email { get; set; }
@scionwest
scionwest / Program.cs
Last active July 3, 2016 00:26
Dependency resolution when asbstraction has n-implementations
using System;
using Microsoft.Extensions.DependencyInjection;
namespace ConsoleApp1
{
public interface IFoo
{
string GetName();
}
Microsoft.AspNetCore.Hosting.BeginRequest
Microsoft.AspNetCore.Mvc.BeforeAction
Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuting
Microsoft.AspNetCore.Mvc.AfterOnResourceExecuting
Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuted
Microsoft.AspNetCore.Mvc.BeforeOnActionExecution
Microsoft.AspNetCore.Mvc.BeforeOnActionExecuting
Microsoft.AspNetCore.Mvc.AfterOnActionExecuting
Microsoft.AspNetCore.Mvc.BeforeOnActionExecuted
Microsoft.AspNetCore.Mvc.BeforeActionMethod
{
"locked": false,
"version": 2,
"targets": {
".NETCoreApp,Version=v1.0": {
"Libuv/1.9.0-rc2-20901": {
"type": "package",
"runtimeTargets": {
"runtimes/debian-x64/native/libuv.so": {
"assetType": "native",
eb/obj/Debug/netcoreapp1.0/dotnet-compile.rsp returned Exit Code 1
/Users/johnathonsullinger/Source/VSTS/Blogging.Core/Source/BlogWeb/Services/PostService.cs(17,28): error CS0
246: The type or namespace name 'PostHighlight' could not be found (are you missing a using directive or an
assembly reference?)
Compilation failed.
0 Warning(s)
1 Error(s)
Time elapsed 00:00:02.5263389
Errors in /Users/johnathonsullinger/Source/VSTS/Blogging.Core/Source/BlogWeb/project.json
Package Newtonsoft.Json 8.0.3 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Newtonsoft.Json 8.0.3 supports:
- net20 (.NETFramework,Version=v2.0)
- net35 (.NETFramework,Version=v3.5)
- net40 (.NETFramework,Version=v4.0)
- net45 (.NETFramework,Version=v4.5)
- portable-dnxcore50+net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=net45+wp80+win8+wpa81+dnxcore50)
- portable-net40+sl5+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile328)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.
ERROR: Error: Command failed: dotnet restore "/Users/johnathonsullinger/Source/VSTS/Blogging.Core/Source/BlogWeb/project.json"
internal void Draw(GameTime gameTime, SpriteBatch spriteBatch)
{
for(ushort row = 0; row < this.heightInTiles; row++)
{
for (ushort cell = 0; cell < this.widthInTiles; cell++)
{
ushort cellLocationX = (ushort)(cell * this.tileWidth);
ushort cellLocationY = (ushort)(row * this.tileHeight);
var rectangleToRender = new Rectangle(cellLocationX, cellLocationY, this.tileWidth, this.tileHeight);