ServiceFactory
The default implementation of a service factory.
using AngleSharp.Extensions;
using System;
namespace AngleSharp.Services.Default
{
public class ServiceFactory : IServiceFactory
{
public TService Create<TService>(IBrowsingContext context)
{
Func<IBrowsingContext, TService> service = context.Configuration.GetService<Func<IBrowsingContext, TService>>();
if (service == null)
return default(TService);
return service(context);
}
}
}