using HTCoreServiceApp.DataHandle;
using HTCoreServiceApp.Models;

namespace HTCoreServiceApp.Common
{
    public class PCAutoHelper
    {
        /// <summary>
        /// 父类的value赋值给子类
        /// </summary>
        /// <param name="parent"></param>
        /// <returns></returns>
        public static MetaTagBool PCAutoCopyBool(MetaTag parent)
        {
            MetaTagBool child = new MetaTagBool();


            var ParentType = typeof(MetaTag);


            var Properties = ParentType.GetProperties();


            foreach (var Propertie in Properties)
            {
                if (Propertie.CanRead && Propertie.CanWrite)
                {
                    Propertie.SetValue(child, Propertie.GetValue(parent, null), null);
                }
            }


            return child;

            
        }
        /// <summary>
        /// 父类的value赋值给子类
        /// </summary>
        /// <param name="parent"></param>
        /// <returns></returns>
        public static MetaTagStandard PCAutoCopyStandard(MetaTag parent)
        {
            MetaTagStandard child = new MetaTagStandard();


            var ParentType = typeof(MetaTag);


            var Properties = ParentType.GetProperties();


            foreach (var Propertie in Properties)
            {
                if (Propertie.CanRead && Propertie.CanWrite)
                {
                    Propertie.SetValue(child, Propertie.GetValue(parent, null), null);
                }
            }


            return child;


        }
    }
}
