Пример #1
0
        /// <summary>
        /// Add annotations the the object being created.
        /// </summary>
        /// <param name="installer">Context which is performing the installation.</param>
        /// <returns>Returns true if successful, otherwise false.</returns>
        protected internal override bool AnnotateObject(IDefinitionInstallerContext installer)
        {
            if (installer == null)
            {
                throw new ArgumentNullException();
            }

            if (!this.Annotations.Any())
            {
                return(true);
            }

            Runtime.Bindings.PoolBinding poolBinding = installer.GetPoolBinding(this.PoolName.Value);
            if ((poolBinding == null) || (poolBinding.Value == null))
            {
                return(true); // An error, but we don't see the annotations as critical.
            }
            Runtime.Bindings.PoolVariableOrConstantBinding binding;
            poolBinding.Value.TryGetValue(this.VariableName.Value, out binding);
            if (binding == null)
            {
                return(true); // An error, but we don't see the annotations as critical.
            }
            installer.AnnotateObject(binding, this.Annotations);

            return(true);
        }
Пример #2
0
        /// <summary>
        /// Add annotations the the object being created.
        /// </summary>
        /// <param name="installer">Context which is performing the installation.</param>
        /// <returns>Returns true if successful, otherwise false.</returns>
        protected internal override bool AnnotateObject(IDefinitionInstallerContext installer)
        {
            if (installer == null)
            {
                throw new ArgumentNullException();
            }

            if (!this.Annotations.Any())
            {
                return(true);
            }

            if (this.CompiledCode == null)
            {
                return(false);
            }

            installer.AnnotateObject(this.CompiledCode, this.Annotations);

            return(true);
        }
Пример #3
0
        /// <summary>
        /// Add annotations the the object being created.
        /// </summary>
        /// <param name="installer">Context which is performing the installation.</param>
        /// <returns>Returns true if successful, otherwise false.</returns>
        protected internal override bool AnnotateObject(IDefinitionInstallerContext installer)
        {
            if (installer == null)
            {
                throw new ArgumentNullException();
            }

            if (!this.Annotations.Any())
            {
                return(true);
            }

            Symbol name = installer.Runtime.GetSymbol(this.Name.Value);

            Runtime.Bindings.IDiscreteGlobalBinding binding = installer.GetLocalGlobalBinding(name);
            if (binding == null)
            {
                return(true); // An error, but we don't see the annotations as critical.
            }
            installer.AnnotateObject(binding, this.Annotations);

            return(true);
        }