private static DeletionDataDefinition GetData(object dataAsAnonymousType)
        {
            var data = new DeletionDataDefinition();
            #if NETSTANDARD
            var properties = dataAsAnonymousType.GetType().GetTypeInfo().DeclaredProperties;

            foreach (var property in properties)
                data.Add(new KeyValuePair<string, object>(property.Name, property.GetValue(dataAsAnonymousType)));
            #else
            var properties = TypeDescriptor.GetProperties(dataAsAnonymousType);

            foreach (PropertyDescriptor property in properties)
                data.Add(new KeyValuePair<string, object>(property.Name, property.GetValue(dataAsAnonymousType)));
            #endif
            return data;
        }
        private static DeletionDataDefinition GetData(object dataAsAnonymousType)
        {
            var data = new DeletionDataDefinition();
            var properties = TypeDescriptor.GetProperties(dataAsAnonymousType);

            foreach (PropertyDescriptor property in properties)
                data.Add(new KeyValuePair<string, object>(property.Name, property.GetValue(dataAsAnonymousType)));
            return data;
        }
Пример #3
0
        private static DeletionDataDefinition GetData(object dataAsAnonymousType)
        {
            var data       = new DeletionDataDefinition();
            var properties = TypeDescriptor.GetProperties(dataAsAnonymousType);

            foreach (PropertyDescriptor property in properties)
            {
                data.Add(new KeyValuePair <string, object>(property.Name, property.GetValue(dataAsAnonymousType)));
            }
            return(data);
        }
Пример #4
0
        private static DeletionDataDefinition GetData(object dataAsAnonymousType)
        {
            var data = new DeletionDataDefinition();

#if COREFX
            var properties = dataAsAnonymousType.GetType().GetTypeInfo().DeclaredProperties;

            foreach (var property in properties)
            {
                data.Add(new KeyValuePair <string, object>(property.Name, property.GetValue(dataAsAnonymousType)));
            }
#else
            var properties = TypeDescriptor.GetProperties(dataAsAnonymousType);

            foreach (PropertyDescriptor property in properties)
            {
                data.Add(new KeyValuePair <string, object>(property.Name, property.GetValue(dataAsAnonymousType)));
            }
#endif
            return(data);
        }
Пример #5
0
        public void Truncate(DeleteDataExpression expression)
        {
            expression.TableName = Truncate(expression.TableName);
            List <DeletionDataDefinition> deletions = new List <DeletionDataDefinition>();

            foreach (DeletionDataDefinition deletion in expression.Rows)
            {
                DeletionDataDefinition newDeletion = new DeletionDataDefinition();
                foreach (var data in deletion)
                {
                    newDeletion.Add(new KeyValuePair <string, object>(Truncate(data.Key), data.Value));
                }
                deletions.Add(newDeletion);
            }
            expression.Rows.Clear();
            expression.Rows.AddRange(deletions);
        }
 public void Truncate(DeleteDataExpression expression)
 {
     expression.TableName = Truncate(expression.TableName);
     List<DeletionDataDefinition> deletions = new List<DeletionDataDefinition>();
     foreach (DeletionDataDefinition deletion in expression.Rows)
     {
         DeletionDataDefinition newDeletion = new DeletionDataDefinition();
         foreach (var data in deletion)
         {
             newDeletion.Add(new KeyValuePair<string, object>(Truncate(data.Key), data.Value));
         }
         deletions.Add(newDeletion);
     }
     expression.Rows.Clear();
     expression.Rows.AddRange(deletions);
 }