Пример #1
0
		private void RemoveSpecialTables(CsDbArcDatabase architecture)
		{
			string[] specialTableNames = {"aspnet_", "vw_aspnet_", "sysdiagrams",
					"webpages", "OLD_", "AutoGenerationForData" };
			architecture.Tables.Where(x => specialTableNames.Any(y => x.Name.StartsWith(y)))
				.ToList()
				.ForEach(architecture.RemoveTable);
		}
Пример #2
0
		private CsDbCodeBundleForDb(CsDbCodeBundle owner, CsDbArcDatabase architecture)
		{
			Owner = owner;
			Architecture = architecture;
		}
Пример #3
0
		/// <summary>Creates the code base from an existing <see cref="CsDbArcDatabase" />.</summary>
		public static CsDbCodeBundleForDb FromArchitecture(CsDbCodeBundle owner, CsDbArcDatabase architecture)
		{
			var bundleForDb = new CsDbCodeBundleForDb(owner, architecture);
			bundleForDb.DataSet = new CsDbCodeDataSet(architecture, bundleForDb);

			var rvTables = new List<CsDbCodeDataTable>();
			var rvViews = new List<CsDbCodeDataView>();

			var columnMapping = new Dictionary<CsDbArcColumn, CsDbcTableRow_Column>();

			foreach (var table in architecture.Tables)
			{
				var rvTable = new CsDbCodeDataTable(table, bundleForDb);

				var columns = rvTable.Row.Columns.ToList();
				foreach (var archiColumn in table.Columns)
				{
					var codeColumn = columns.FirstOrDefault(x => x.Architecture == archiColumn);
					columnMapping.Add(archiColumn, codeColumn);
				}
				rvTables.Add(rvTable);
			}

			foreach (var view in architecture.Views)
			{
				var rvView = new CsDbCodeDataView(view, bundleForDb);
				rvViews.Add(rvView);
			}


			bundleForDb.Tables = rvTables.ToArray();
			bundleForDb.Views = rvViews.ToArray();

			foreach (var relation in architecture.Relations)
			{
				var pkColumn = columnMapping[relation.PrimaryKey];
				var fkColumn = columnMapping[relation.ForeignKey];
				var csDbCodeRelation = CsDbCodeRelation.Create(relation, pkColumn, fkColumn);
				csDbCodeRelation.ReferencingProperty = new CsDbcTableRow_ReferencingProperty(csDbCodeRelation);
				csDbCodeRelation.AssociatedProperty = new CsDbcTableRow_AssociatedProperty(csDbCodeRelation);
			}

			return bundleForDb;
		}
Пример #4
0
		/// <summary>This initialize method should only be called by the <see cref="CsDbArcDatabase" /> class.</summary>
		internal static CsDbArcView Create(CsDbArcDatabase owner, string name)
		{
			return new CsDbArcView(owner, name);
		}
Пример #5
0
		private CsDbArcView(CsDbArcDatabase owner, string name) : base(owner, name)
		{
		}
Пример #6
0
		/// <summary>Creates a new code set.</summary>
		public CsDbCodeDataSet(CsDbArcDatabase architecture, CsDbCodeBundleForDb codeBundle)
		{
			CodeBundle = codeBundle;
			Architecture = architecture;
		}
Пример #7
0
		private CsDbArcTable(CsDbArcDatabase owner, string name) : base(owner, name)
		{
			Relations = _relations.AsReadOnly();
		}