Created
July 9, 2013 08:16
-
-
Save rarous/5955605 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ComponentRegistration<TService> RouteFromName<TService>(this ComponentRegistration<TService> registration) | |
where TService : class | |
{ | |
return registration.Route(registration.Name); | |
} | |
public static ComponentRegistration<TService> Route<TService>(this ComponentRegistration<TService> registration, string name) | |
where TService : class | |
{ | |
var factory = new DefaultServiceHostFactory(); | |
var serviceContract = registration.Implementation.GetInterfaces().First(); | |
var route = new ServiceRoute(name + ".svc", factory, serviceContract); | |
RouteTable.Routes.Add(name, route); | |
return registration; | |
} | |
static ComponentRegistration<TService> WcfService<TService, TImpl>(string name, Func<DefaultServiceModel, IWcfServiceModel> configServiceModel) | |
where TService : class | |
where TImpl : TService | |
{ | |
return Component. | |
For<TService>(). | |
ImplementedBy<TImpl>(). | |
Named(name). | |
RouteFromName(). | |
AsWcfService(configServiceModel(new DefaultServiceModel().Hosted())); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment