[coldbox:18189] [coldbox 3.6.0] Injected object via wirebox into property not staying in memory.

Generally I don’t think it is a good idea to inject anything transient into a singleton, instead either pass the transient object instance to a method in the singleton or let a method in the singleton use an injected wirebox to create the instance of said transient object.

That’s does not answer anything based on the example, however.

Mike Craig

Sorry this posted before I was done writing it, After which I just deleted it. But I guess it was sent out into the internets anyway.

I did figure out what I was doing wrong. Turns out I had a weird loop where OBJ_B was trying to use something from OBJ_A which injected OBJ_B, so at some point the system created a copy of OBJ_A to cope.

As far as why. In my example I’ve created a object that I call the library. It is a utility model that I use to collect , delete and iterate other objects. I wanted something that I could include in ANY of my other models to act similar to the Visual basic collection obj. The Library needs to be created for each object that uses it since I do not want collections inter-mixing.

I do the same thing all the time…extends=“base.collectors” is a model that handles the data and add, delete, purge, find, etc. functions on the collection of data, in a struct or array. Handy stuff…and a throwback from my VB days too.

Mike