protected object ResolveComponent(IHandler handler) { object instance = handler.Resolve(); ReleasePolicy.Track(instance, handler); return(instance); }
/// <summary> /// Releases a component instance. This allows the kernel to execute the proper decommission lifecycles on the component instance. /// </summary> /// <param name = "instance"> </param> public virtual void ReleaseComponent(object instance) { if (ReleasePolicy.HasTrack(instance)) { ReleasePolicy.Release(instance); } else { Parent?.ReleaseComponent(instance); } }
void IJsonSerializable.WriteProperties(Utf8JsonWriter json) { if (Key != null) { json.WriteStartObject(s_keyPropertyNameBytes); Key.WriteProperties(json); json.WriteEndObject(); } Properties.WriteAttributes(json); if (Properties._tags != null && Properties._tags.Count > 0) { json.WriteStartObject(s_tagsPropertyNameBytes); foreach (KeyValuePair <string, string> kvp in Properties._tags) { json.WriteString(kvp.Key, kvp.Value); } json.WriteEndObject(); } if (HardwareProtected.HasValue) { json.WriteBoolean(s_hsmPropertyNameBytes, HardwareProtected.Value); } if (ReleasePolicy != null) { json.WriteStartObject(s_releasePolicyPropertyNameBytes); ReleasePolicy.WriteProperties(json); json.WriteEndObject(); } }
private void DisposeComponentsInstancesWithinTracker() { ReleasePolicy.Dispose(); }