/// <summary>Creates a new code set.</summary>
		public CsDbCodeDataTable(CsDbArcTable architecture, CsDbCodeBundleForDb codeBundle)
		{
			Architecture = architecture;
			CodeBundle = codeBundle;
			Row = new CsDbCodeDataRow(this);
			PocoRow = new CsDbCodeDataRowPoco(Row);
		}
Exemple #2
0
		/// <summary>Removes the table. All associated Relation will be removed either.</summary>
		public void RemoveTable(CsDbArcTable table)
		{
			if (table.Owner != this)
				throw new InvalidOperationException("This table belongs to another Architecture");

			foreach (var relation in table.Relations.ToArray())
			{
				relation.Remove();
			}
			_tables.Remove(table);
			table.SetRemoved();
		}
Exemple #3
0
			private static int GetMaxDistanceToOutside(CsDbArcTable table)
			{
				if (table.Relations.Count == 0)
					return 0;

				var maxValue = int.MinValue;
				var outside = true;
				foreach (var relation in table.Relations)
				{
					if (relation.PrimaryKey.Owner == table)
						continue;
					outside = false;
					var distance = GetMaxDistanceToOutside(relation.PrimaryKey.Owner) + 1;
					if (maxValue < distance)
						maxValue = distance;
				}
				return outside ? 0 : maxValue;
			}