Git Product home page Git Product logo

hangfire.ninject's People

Contributors

odinserj avatar simongh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hangfire.ninject's Issues

System.MissingMethodException when task with Dependency is called

I configured thisn in Startup.Configuration method of my Web Application .NET 4.8 but keep receiving a System.MissingMethodException complaining about a not existing "parameterless constructor defined".

var kernel = new StandardKernel();
kernel.Bind<MessageTasks>().ToSelf();
kernel.Bind<IMessageRepository>().ToMethod(ctx => new MessageRepository(OracleConnectionFactory.CreateContext()));

GlobalConfiguration.Configuration.UseNinjectActivator(kernel);

What did I missed?

Packages:

Hangfire.AspNet (0.2.0)
Hangfire.Core (1.7.9)
Hangfire.Ninject (1.2.0)
Ninject (3.2.2)
Ninjec.Web.Common (3.2.0)

Better handling of deterministic disposal feature

Currently the following method is used to dispose all the requested services, when background job is completed. This method gracefully handles transient dependencies, but it also disposes singleton services that implement the IDisposable interface.

public override void DisposeScope()
{
    _kernel.Components.Get<ICache>().Clear(JobActivatorScope.Current);
}

It's worth to read this article to know how to correctly implement deterministic disposal with Ninject: http://mono.software/2016/04/21/Ninject-ambient-scope-and-deterministic-dispose/

Async background scope

Hi,

We found an issue when using the "InBackgroundScope" option. If you include async methods in the process, as the scope is stored in the thread, it gets lost in inner methods. We solved it by using AsyncLocal feature from .NET 4.6 to store the current scope (by modifying the source code of this library). That way, any resolution that happens inside the job scope gets the same instances.

I think it would be an interesting addition to this library or a change in the Hangfire core itself, but the problem is backward compatibility to previous framework versions.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.