ipjohnson / Grace

Grace is a feature rich dependency injection container library
MIT License
336 stars 33 forks source link

Disable evaluation of delegates? #284

Open teinarss opened 3 years ago

teinarss commented 3 years ago

Is it possible to disable evaluation of delegates?

Test case:

public class DiTest
{
  public DiTest(Func<string> test)
  {
  }
}

...
var a1 = new { test = new Func<string>(() => "hello world") };

container.Locate<DiTest>(a1);
ipjohnson commented 2 years ago

Sorry for the very late response. There's not a great way for you to do what you're looking for.

I could offer some suggestions but they all require some configuration and probably are not what you're looking for (plus I'm a month late responding).