Skip to content

Instantly share code, notes, and snippets.

View devdays's full-sized avatar

Bruce D Kyle devdays

View GitHub Profile
@devdays
devdays / SimpleInjectorWebApiInitializer.cs
Last active August 29, 2015 14:13
Simple Injector container initialization
using System.Web.Http;
using SimpleInjector;
using SimpleInjector.Integration.WebApi;
using Interfaces;
using Common;
public static class SimpleInjectorWebApiInitializer
{
// Make container available to the rest of the application
// Use Container to instantiate the objects you want
@devdays
devdays / pattern-MethodInjection.cs
Created January 17, 2015 21:36
Example of method injection
using System;
public interface IService
{
void Serve();
}
public class Service : IService
{
public void Serve()
@devdays
devdays / pattern-PropertyInjection.cs
Created January 17, 2015 21:30
Example of property injection
using System;
public interface IService
{
void Serve();
}
public class Service : IService
{
public void Serve()
@devdays
devdays / pattern-ConstructorInjectionAlternative.cs
Created January 17, 2015 21:20
Alternative implementation of the Service
class AlternateService :IService
{
public void Serve()
{
Console.WriteLine("Service Called");
//To Do: Some Stuff
}
}
@devdays
devdays / pattern-alternativeTightlyBound.cs
Last active August 29, 2015 14:13
Alternative way to implement Service, but will not compile
class AlternateService
{
public void Serve()
{
Console.WriteLine("Service Called");
//To Do: Some Stuff
}
}
class TestClient
@devdays
devdays / pattern-tightlyBound.cs
Created January 17, 2015 19:39
Example of tightly bound classes
using System;
public class Service
{
public void Serve()
{
Console.WriteLine("Service Called");
//To Do: Some Stuff
}
}
@devdays
devdays / 1-cloud-contentNegotiation
Created January 12, 2015 21:31
Sample content negotiation in HTTP
GET /resource
Accept: text/html, application/xml, application/json
@devdays
devdays / 1-cloud-endpointRedirection
Created January 12, 2015 21:14
Endpoint redirection
GET /old
@devdays
devdays / 1-PostNewResource
Created January 12, 2015 20:53
Cloud Sample Post to create a resource
POST /resource
@devdays
devdays / 1-cloud-put
Created January 12, 2015 20:47
Cloud-put to create a resource
PUT /resource/E809EF63-86D7-4B8B-973E-69C1B509F692