Beispiel #1
0
        /// <summary>
        /// Generates a map of unqiue rows and grouped count
        /// </summary>
        /// <returns></returns>
        public IEnumerable <KeyValuePair <T, int[]> > GetCopyRows()
        {
            DBRowComparer <T> comparer = new DBRowComparer <T>(PrimaryKey);

            return(Rows.AsEnumerable().GroupBy(r => r, comparer)
                   .Where(g => g.Count() > 1)
                   .Select(g => new KeyValuePair <T, int[]>(
                               g.Key,
                               g.Where(r => r != g.Key).Select(r => (int)comparer.PrimaryKey.GetValue(r)).ToArray()
                               )));
        }
Beispiel #2
0
        /// <summary>
        /// Generates a map of unqiue rows and grouped count
        /// </summary>
        /// <returns></returns>
        public IEnumerable <dynamic> GetCopyRows()
        {
            DBRowComparer comparer = new DBRowComparer(Data.Columns.IndexOf(Key));

            return(Data.AsEnumerable().GroupBy(r => r, comparer)
                   .Where(g => g.Count() > 1)
                   .Select(g => new
            {
                Key = g.Key,
                Copies = g.Where(r => r != g.Key).Select(r => r.Field <int>(comparer.IdColumnIndex)).ToArray()
            }));
        }
Beispiel #3
0
        /// <summary>
        /// Produces a list of unique rows (excludes key values)
        /// </summary>
        /// <returns></returns>
        public IEnumerable <DataRow> GetUniqueRows()
        {
            DBRowComparer comparer = new DBRowComparer(Data.Columns.IndexOf(Key));

            return(Data.AsEnumerable().Distinct(comparer));
        }
Beispiel #4
0
        /// <summary>
        /// Produces a list of unique rows (excludes key values)
        /// </summary>
        /// <returns></returns>
        public IEnumerable <T> GetUniqueRows()
        {
            DBRowComparer <T> comparer = new DBRowComparer <T>(PrimaryKey);

            return(Rows.AsEnumerable().Distinct(comparer));
        }