예제 #1
0
        private IList <KeyCollection> BuildReferences(DataTable table, KeysRetriever keyRetriever)
        {
            var references = new List <KeyCollection>();

            foreach (DataRow row in table.Rows)
            {
                var keys = keyRetriever.GetKeys(row);
                if (!references.Contains(keys))
                {
                    references.Add(keys);
                }
            }

            return(references);
        }
예제 #2
0
        private ReferenceViolations ExtractReferenceViolation(DataTable table, KeysRetriever keyRetriever, IEnumerable <KeyCollection> references)
        {
            var violations = new ReferenceViolations();

            foreach (DataRow row in table.Rows)
            {
                var keys = keyRetriever.GetKeys(row);
                if (!references.Contains(keys))
                {
                    if (violations.ContainsKey(keys))
                    {
                        violations[keys].Add(row);
                    }
                    else
                    {
                        violations.Add(keys, new Collection <DataRow>()
                        {
                            row
                        });
                    }
                }
            }
            return(violations);
        }