Ejemplo n.º 1
0
        /// <summary>
        /// Toes the string helper.
        /// </summary>
        /// <param name="data">The ISerializableObject object.</param>
        /// <param name="descriptionLength">Length of the description.</param>
        /// <returns></returns>
        protected string ToStringHelper(SerializableObject data, int descriptionLength)
        {
            System.Text.StringBuilder ret = new System.Text.StringBuilder();

            for (int i = 0; i < descriptionLength; i++)
            {
                ret.Append("-");
            }
            ret.Append("\n");
            ret.Append(AttributeUtilities.GetTableMapping(data)).Append(" Row\n");
            for (int i = 0; i < descriptionLength; i++)
            {
                ret.Append("-");
            }
            ret.Append("\n");

            PropertyInfo[] properties = data.GetType().GetProperties();
            foreach (PropertyInfo property in properties)
            {
                ColumnAttribute attribute = AttributeUtilities.GetColumnAttribute(property);

                if (attribute != null)
                {
                    string columnName = AttributeUtilities.GetColumnMapping(property);
                    ret.Append(columnName);
                    for (int i = columnName.Length; i < descriptionLength; i++)
                    {
                        ret.Append(".");
                    }
                    ret.Append(": ");
                    MethodInfo m   = property.GetGetMethod();
                    Object     obj = m.Invoke(data, null);
                    ret.Append(obj);
                    ret.Append("\n");
                }
            }
            return(ret.ToString());
        }
Ejemplo n.º 2
0
 protected QueryStrategy(ISerializableObject data)
 {
     this.data  = data;
     table      = AttributeUtilities.GetTableMapping(data);
     properties = data.GetType().GetProperties();
 }