Exemplo n.º 1
0
		/// <summary>Associates two tables with each other. Automatically adds this relation to the associated table relation collection.</summary>
		public static CsDbArcRelation Create(string name, CsDbArcColumn primary, CsDbArcColumn foreign)
		{
			var rv = new CsDbArcRelation {Name = name, PrimaryKey = primary, ForeignKey = foreign};
			primary.Owner.AddRelation(rv);
			foreign.Owner.AddRelation(rv);
			return rv;
		}
Exemplo n.º 2
0
		/// <summary>Creates the code base relations and maps it to the associated tables. </summary>
		public static CsDbCodeRelation Create(CsDbArcRelation architecture, CsDbcTableRow_Column pkKey, CsDbcTableRow_Column fkKey)
		{
			var item = new CsDbCodeRelation(architecture, pkKey, fkKey);
			if (pkKey.Row == fkKey.Row)
				pkKey.Row.Table.Relations.Add(item);
			else
			{
				pkKey.Row.Table.Relations.Add(item);
				fkKey.Row.Table.Relations.Add(item);
			}
			return item;
		}
Exemplo n.º 3
0
		/// <summary>ctor</summary>
		private CsDbCodeRelation(CsDbArcRelation architecture, CsDbcTableRow_Column pkKey, CsDbcTableRow_Column fkKey)
		{
			Architecture = architecture;
			PkKey = pkKey;
			FkKey = fkKey;
		}
Exemplo n.º 4
0
		internal void RemoveRelation(CsDbArcRelation relation)
		{
			_relations.Remove(relation);
		}
Exemplo n.º 5
0
		internal void AddRelation(CsDbArcRelation relation)
		{
			_relations.Add(relation);
		}