コード例 #1
0
ファイル: App.xaml.cs プロジェクト: heinzsack/DEV
		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
ファイル: CsDbCodeBundle.cs プロジェクト: cssack/CsGlobals
		private CsDbCodeBundleForDb(CsDbCodeBundle owner, CsDbArcDatabase architecture)
		{
			Owner = owner;
			Architecture = architecture;
		}
コード例 #3
0
ファイル: CsDbCodeBundle.cs プロジェクト: cssack/CsGlobals
		/// <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
ファイル: CsDbArcView.cs プロジェクト: cssack/CsGlobals
		/// <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
ファイル: CsDbArcView.cs プロジェクト: cssack/CsGlobals
		private CsDbArcView(CsDbArcDatabase owner, string name) : base(owner, name)
		{
		}
コード例 #6
0
ファイル: CsDbCodeDataSet.cs プロジェクト: cssack/CsGlobals
		/// <summary>Creates a new code set.</summary>
		public CsDbCodeDataSet(CsDbArcDatabase architecture, CsDbCodeBundleForDb codeBundle)
		{
			CodeBundle = codeBundle;
			Architecture = architecture;
		}
コード例 #7
0
ファイル: CsDbArcTable.cs プロジェクト: cssack/CsGlobals
		private CsDbArcTable(CsDbArcDatabase owner, string name) : base(owner, name)
		{
			Relations = _relations.AsReadOnly();
		}