Ejemplo n.º 1
0
 private static void LoadDictionaryProperties(this PropertyDescriptorsInfo info)
 {
     if (TryGetDictionaryValueType(info.Type, out Type valueType))
     {
         info.DictionaryValueType = valueType;
     }
     info.Properties = new PropertyDescriptor[0];
 }
Ejemplo n.º 2
0
 public static TSource Trim <TSource>(this TSource source, params char[] trimChars) where TSource : class
 {
     if (source != null)
     {
         Type type = source.GetType();
         if (type.IsArray)
         {
             ((IEnumerable)source).TrimEnumerable(trimChars);
         }
         else
         {
             PropertyDescriptorsInfo info = new PropertyDescriptorsInfo(type);
             info.LoadProperties(new TSource[] { source });
             PropertyDescriptor[] properties = GetTrimPropertyDescriptors(info.Properties).ToArray();
             source.Trim(info.Kind, properties, trimChars);
         }
     }
     return(source);
 }
Ejemplo n.º 3
0
 private static MatchProperty[] JoinMatches <T>(PropertyDescriptorsInfo left, PropertyDescriptorsInfo right, Action <IEnumerable <T> > load, IEnumerable <T> items)
 {
     if (left.Kind == PropertyDescriptorKind.Class && right.Kind == PropertyDescriptorKind.Class)
     {
         int key = GetFullNameHashCode(left.Type, right.Type);
         if (!_matchesDictionary.TryGetValue(key, out MatchProperty[] matches))
Ejemplo n.º 4
0
 public DictionaryNecessary()
 {
     _left  = new PropertyDescriptorsInfo(typeof(TDictionary), PropertyDescriptorKind.Dictionary);
     _right = new PropertyDescriptorsInfo(typeof(T), this);
 }
Ejemplo n.º 5
0
 protected override void First(ItemValuePair <TSource> first)
 {
     _right = new PropertyDescriptorsInfo(first.Value.GetType(), this);
 }
Ejemplo n.º 6
0
 public ApplyNecessary()
 {
     _left = new PropertyDescriptorsInfo(typeof(TSource), this);
 }
Ejemplo n.º 7
0
 private static void LoadDataRowProperties(this PropertyDescriptorsInfo info, DataTable table, PropertyDescriptor[] properties)
 {
     info.Properties = GetDataRowPropertyDescriptors(table, properties).ToArray();
 }
Ejemplo n.º 8
0
 public DataRowNecessary(DataTable table)
 {
     _table = table;
     _right = new PropertyDescriptorsInfo(typeof(T), this);
     _left  = new PropertyDescriptorsInfo(typeof(DataRow), PropertyDescriptorKind.DataRow);
 }
Ejemplo n.º 9
0
 private static void LoadEntityProperties(this PropertyDescriptorsInfo info)
 {
     info.Properties = GetPropertyDescriptors(info.Type);
 }
Ejemplo n.º 10
0
 public EntityNecessary()
 {
     _left  = new PropertyDescriptorsInfo(typeof(T), PropertyDescriptorKind.Class);
     _right = new PropertyDescriptorsInfo(typeof(TSource), this);
 }
Ejemplo n.º 11
0
 protected override void First(object first)
 {
     _info = new PropertyDescriptorsInfo(first.GetType(), this);
 }