public IDAC GetDAC() { var dac = GetDACInternal(); if (ArtificialKeysFile != null) { dac.ArtificialKeys = ArtificialKeys.LoadFromFile(ArtificialKeysFile); } return(dac); }
private void _testButton_Click(object sender, EventArgs e) { try { var artificialKeys = #region Create test object new ArtificialKeys { Tables = new[] { new ArtificialKeys.Table() { Name = "Table1", PrimaryKey = new ArtificialKeys.PrimaryKey { Name = "PK1", AutoIncrement = true, Columns = new [] { new ArtificialKeys.Column { Name = "ID" } } }, ForeignKeys = new[] { new ArtificialKeys.ForeignKey { Name = "PK1", ReferenceTable = "Table2", Columns = new [] { new ArtificialKeys.Column { Name = "ID" } } } }, UniqueConstraints = new[] { new ArtificialKeys.UniqueConstraint { Name = "UC1", Columns = new [] { new ArtificialKeys.Column { Name = "X" }, new ArtificialKeys.Column { Name = "Y" }, } } }, }, new ArtificialKeys.Table() { Name = "Table2", PrimaryKey = new ArtificialKeys.PrimaryKey { Name = "PK1", Sequence = "Sequence1", Columns = new [] { new ArtificialKeys.Column { Name = "A" }, new ArtificialKeys.Column { Name = "B" }, new ArtificialKeys.Column { Name = "C" } } } } } }; #endregion var serialized = XmlProvider.WriteToString(artificialKeys); var deserialized = XmlProvider.ReadFromString <ArtificialKeys>(serialized); textBox1.Clear(); textBox1.AppendText(serialized); var reserialized = XmlProvider.WriteToString(deserialized); if (reserialized != serialized) { textBox1.AppendText("Deserialization did not match - " + Environment.NewLine); textBox1.AppendText(reserialized); } } catch (Exception error) { textBox1.Clear(); textBox1.AppendText(error.ToDiagnosticString()); } }