public void Bind(object target, PropertyInfo propertyInfo, object value)
 {
     var type = propertyInfo.PropertyType;
     var obj = Activator.CreateInstance(type);
     var propertyBinder = new PropertyBinder();
     propertyBinder.Bind(obj, x => x.Cells["Id"].Value.Equals(value.ToString()));
     propertyInfo.SetValue(target, obj, null);
 }
Beispiel #2
0
        public void Bind(object target, PropertyInfo propertyInfo, object value)
        {
            var type           = propertyInfo.PropertyType;
            var obj            = Activator.CreateInstance(type);
            var propertyBinder = new PropertyBinder();

            propertyBinder.Bind(obj, x => x.Cells["Id"].Value.Equals(value.ToString()));
            propertyInfo.SetValue(target, obj, null);
        }
Beispiel #3
0
 public void Bind(object target, PropertyInfo propertyInfo, object value)
 {
     var type = propertyInfo.PropertyType;
     var genericType = type.GetGenericArguments()[0];
     var valueString = value.ToString();
     var data = new List<string>();
     if (valueString.Contains(","))
     {
         Array.ForEach(valueString.Split(','), data.Add);
     }
     var listObj = (IList)Activator.CreateInstance(type);
     foreach (var item in data)
     {
         var obj = Activator.CreateInstance(genericType);
         var propertyBinder = new PropertyBinder();
         var tempValue = item;
         propertyBinder.Bind(obj, x => x.Cells["Id"].Value.Equals(tempValue));
         listObj.Add(obj);
     }
     propertyInfo.SetValue(target, listObj, null);
 }
Beispiel #4
0
        public void Bind(object target, PropertyInfo propertyInfo, object value)
        {
            var type        = propertyInfo.PropertyType;
            var genericType = type.GetGenericArguments()[0];
            var valueString = value.ToString();
            var data        = new List <string>();

            if (valueString.Contains(","))
            {
                Array.ForEach(valueString.Split(','), data.Add);
            }
            var listObj = (IList)Activator.CreateInstance(type);

            foreach (var item in data)
            {
                var obj            = Activator.CreateInstance(genericType);
                var propertyBinder = new PropertyBinder();
                var tempValue      = item;
                propertyBinder.Bind(obj, x => x.Cells["Id"].Value.Equals(tempValue));
                listObj.Add(obj);
            }
            propertyInfo.SetValue(target, listObj, null);
        }