Esempio n. 1
0
        /// <summary>
        /// Gets a string representing a value.
        /// </summary>
        /// <param name="Value">Value</param>
        /// <returns>Expression string.</returns>
        public string GetString(object Value)
        {
            GenericObject Obj = (GenericObject)Value;

            StringBuilder sb    = new StringBuilder();
            bool          First = true;

            sb.Append('{');

            if (!string.IsNullOrEmpty(Obj.CollectionName) && !Obj.TryGetFieldValue("CollectionName", out object _))
            {
                this.Output("CollectionName", Obj.CollectionName, ref First, sb);
            }

            if (!string.IsNullOrEmpty(Obj.TypeName) && !Obj.TryGetFieldValue("TypeName", out object _))
            {
                this.Output("TypeName", Obj.TypeName, ref First, sb);
            }

            if (Obj.ObjectId != Guid.Empty && !Obj.TryGetFieldValue("ObjectId", out object _))
            {
                this.Output("ObjectId", Obj.ObjectId.ToString(), ref First, sb);
            }

            foreach (KeyValuePair <string, object> P in Obj.Properties)
            {
                this.Output(P.Key, P.Value, ref First, sb);
            }

            sb.Append('}');

            return(sb.ToString());
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the value of a field or property of an object, given its name.
        /// </summary>
        /// <param name="FieldName">Name of field or property.</param>
        /// <param name="Object">Object.</param>
        /// <param name="Value">Corresponding field or property value, if found, or null otherwise.</param>
        /// <returns>If the corresponding field or property was found.</returns>
        public override bool TryGetFieldValue(string FieldName, object Object, out object Value)
        {
            GenericObject Obj = (GenericObject)Object;

            return(Obj.TryGetFieldValue(FieldName, out Value));
        }