Coder Social home page Coder Social logo

lazy-proxy-unity's People

Contributors

commit-n-run avatar hypercodeplace avatar sergeipavlov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

Forkers

lanicon

lazy-proxy-unity's Issues

[Improvement] OpenUPM

Hi! Thanks for sharing, this is very useful but Unity keeps messing with NuGet. I was wondering if there are any plans to create an OpenUPM package out of it. If now, would be ok if I create it?

getting double the number of concrete classes

Hi,
I have an interface that is implemented by 2 classes. I used named instance registration:

using (IUnityContainer container = new UnityContainer())
{
    container.RegisterLazy<IController, Controller>("Controller");
    container.RegisterLazy<IController, MyController>("MyController");
  
    var objs = container.ResolveAll<IController>();

    foreach (IController controller in objs)
    {
        string s = controller.Name;
    }
}

Now, the reason I get 4 implementation in the objs object is because in the Initialise method we are registering the same type with its implementation twice:

protected override void Initialize()
{
    string registrationName = Guid.NewGuid().ToString();

    Context.Container.RegisterType(_typeFrom, _typeTo, _name, _getLifetimeManager(), _injectionMembers);
    Context.Container.RegisterType(_typeFrom, _typeTo, registrationName, _getLifetimeManager(), _injectionMembers); // this is proxy registration... which is causing me trouble --- why we need this?

    Context.Policies.Set(_typeFrom, _name, typeof(ResolveDelegateFactory),
        (ResolveDelegateFactory)((ref BuilderContext _) =>
           (ref BuilderContext c) =>
           {
               IUnityContainer container = c.Container;
               Type type = c.RegistrationType;
               ResolverOverride[] overrides = c.Overrides;

               return LazyProxyBuilder.CreateInstance(type,
                   //() => container.Resolve(type, registrationName, overrides)
                   () => container.Resolve(type, _name)
               );
           })
    );
}

Can someone please help me understand why we have double registration for each type?

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.