i have a Model
and class - Factory
which creates, load and save this model.
I want completely release all references to this Model
save and dispose, but i don't know how can i tell all classes who keep references to Model
release it.
I only see 2 solutions:
- Return from
Factory
WeakReference toModel
and keep strong reference only inFactory
but i have no guarantee thatModel
will be destroyed right after releasing last strong reference. - Send some notifications from
Model
or to classes who ownsModel
to release reference.