示例#1
0
        protected object ResolveComponent(IHandler handler)
        {
            object instance = handler.Resolve();

            ReleasePolicy.Track(instance, handler);

            return(instance);
        }
示例#2
0
 /// <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);
     }
 }
示例#3
0
        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();
            }
        }
示例#4
0
 private void DisposeComponentsInstancesWithinTracker()
 {
     ReleasePolicy.Dispose();
 }