Skip to content

Commit

Permalink
Added use-case for readme
Browse files Browse the repository at this point in the history
  • Loading branch information
odinserj committed Apr 1, 2014
1 parent 22435cc commit fe173ba
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,33 @@ HangFire.Ninject
================

[HangFire](http://hangfire.io) background job activator based on
[Ninject](http://ninject.org) IoC Container.
[Ninject](http://ninject.org) IoC Container. It allows you to use instance
methods of classes that define parametrized constructors:

```csharp
public class EmailService
{
private DbContext _context;
private IEmailSender _sender;

public EmailService(DbContext context, IEmailSender sender)
{
_context = context;
_sender = sender;
}

public void Send(int userId, string message)
{
var user = _context.Users.Get(userId);
_sender.Send(user.Email, message);
}
}

// Somewhere in the code
BackgroundJob.Enqueue<EmailService>(x => x.Send(1, "Hello, world!"));
```

Improve the testability of your jobs without static factories!

Installation
--------------
Expand Down

0 comments on commit fe173ba

Please sign in to comment.