C#操作PowerDesigner代码
首先,程序的界面如下:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgsAAAKKCAIAAAA80Y/kAAAgAElEQVR4nO3dfZRU5Z3g8fvXzuzszpnZWTaTyfrHHM6MMSuePRE8Z2ZnJ7PHdszRKIlhBzVG8ZVMNKhEwZcoErOjRkReIlFQgooaXxKTTDCmQKFQjKiJWqCoCOGteStRWxqMQgP7R9HF7eqnmou36O56+vM5v9PndvW9dYu+5vlyqyEk+wAgJOnrFwBAP6UQAIQpBABhCgFAmEIAEKYQAIT1VIhhAFE44ogjPv3pT/fawhqNcCGGDRt2/PHHFwqFDRs29PILAmi4jo6Ot7du++8tJw/61Kf6+rU0k0Ahhg0bNmXKlNbW1rvmvWqMMdHMsrY/PLJirUhkFyjE8ccf39raOnNeyRhjIpvF7+084v+e1ftLbZOqLcSwYcMKhcLMJ0rGGBPlPL51h59JZBQoxIYNG2b9apkxxkQ5j27decQRR/TJgtt0AoX4wx/+cPeTy40xJsp5aPOOYcOG9cmC23QChdi3b9/sX79mjDFRzn2bFCKrcCF+VHjNGGOinHs2KkRW4ULMmb/CGGOinDtbdypERuFC3LfgDWNMf55pjy751sSZZ192S2PnWxNnTnt0Sa+d4t6Hnjr7H09tGTS4sXP2P55670NP1fvWTV/vHiKrQy5EMbM+/5+QMRHPReOnFp59dc2W7Y2dwrOvXjR+aq+d4stHHjd/1t07lv+2sTN/1t1fPvK4et86hcguXIj7n3qz3hSLxZpPX3/gM5Up3fdXL93zl7+561MLpw+q2c0Y09gZdfn312zZ/uxrmxs7a7ZsH3X593vtFC2DBreXXtz6yD2NnfbSiy2DBtf71k1epxBZhQvxwMK36k2xWKz59PUHPrN3W2HvtsLerY/v2XjvnnWTf3Hzf6nZ7YGFbz0w99rjL5n/wML5Xz/69HEL35p8yeePv/mtB24+PTnl7prd/vaUux9Y+Na4U5Lujr+59vVMvuTzydHXTu72OsedUt15/tePTj/H6eO6vJ56RxnTr+fcsbf+fvP2xcs3N3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89Rv/Ljt3fpLhHiL8bNnuIdJHH4hT1470dPQnfzOrhnsIoE9kvYeoFOLWmb/88A8fby63rXh70/OvrPr14mXHnXRBuW3X5nc/3vDOx2s3f7Rq0x8+YSHqLLLBZzm0QgSerYelu0taau8c+qgQh0QhgEY5hHuIvXv3HnfSBd1n87u7Wssfr93y0eqNH725/sPaQvT8LlP6HZnAGzXVt3o+aSHCz9bDn2Xaf2DqXa/KH0OqeRl1flG1T9WYd5ncQwB94hDuITr27H1z1bplb6x9cdmaZ19es2Dp6l8+u+qni97+8YIu060QXX9ecGCBnDcmaZk+fUzXt3Fq9g/+iPiQChF8tix/H2LegVc2vds9RN1fVPqdqfRPqmvOeBjvJBQCaJRDuIcI3kDUmwyn7pu/n9ybGvUrdA8B9Ik+/PchoizEgT8BlX6jqjcpBNAoffhvzEVZiOBfv8jLPQTQJ/wbc7FxKYFG8e9UNwH3EECfcA8RG5cSaBT3EE3APQTQJ2rvISqLkY/97WN2CgE0ineZYuNSAo2iELFxKYFGUYjYuJRAoyhEbFxKoFEUIjYuJdAoChEblxJoFIWIjUsJNIpCxMalBBpFIWLjUgKNcqAQJprp2/+kgGhYTQAIUwgAwhQCgDCFACBMIQAIUwgAwhQCgDCFACBMIQAI+/8+HH7qGgBGpgAAAABJRU5ErkJggg==" alt="" />
这里一定要使用OpenFileDialog控件,然后该页面代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml; namespace DBDesign
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
this.openFileDialog1.Filter = "pdm文件(*.pdm)|*.pdm";
this.openFileDialog1.Multiselect = false; if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
{
this.label2.Text = this.openFileDialog1.FileName;
}
} private void button2_Click(object sender, EventArgs e)
{
try
{
PdmReader mTest = new PdmReader(this.label2.Text);
Form2 f2 = new Form2(mTest, this.label2.Text);
f2.Show();
this.Visible = false;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
} private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
Application.Exit();
}
}
}
然后第二个页面界面如下:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAegAAAGrCAIAAACE/pOZAAAgAElEQVR4nO3dfXRUdZ7n8fvXdm/v9pne2azjuP4xJ2cW7RX/mAHPmdnZ7j6H+HDE9qmzE7Vtxcf06ExrMVqgNgJjnwYUIYkto4AINrbt09Ddiq0hPFQgIIIIeSSQhKQqlaRSSUhIKoCVSrN/XFLc/Op3byo3t6p+t+77db4n5/6KW1U/Lrc+fowI2gUAgKtoud4AAGB6CG4AcBmCGwBchuAGAJcRg/uxxx7jK1/5yle+KvVVQOMGAJeRN26juQCAzLvyyisvv/zyKTNZEtxCZM+bN6+ysrKzs3P6/0gAAExDIpFo6e3/n0XzCy67zPpM08Y9d+7csrKycDj8+vZjDMMwTHambujce00dyeyeXuOeN29eOBxev72WYRiGyeZUnx698v/dO+3GPXfu3MrKyvWf1DIMwzDZn229Mf373dNo3HPnzu3s7NzwxzqGYRgm+/N+7+iVV1457cZ97ty5jZ/WMwzDMNmfd3pic+fOnXbjvnDhwqbPGhiGYZjsz1vdF4N7eo37woULb1Y2MAzDMNmfN7rsNu7NO5oYhmGY7M9r4VGbjfutquMMwzC2p+L9mn9Zvv6+J1c5O/+yfH3F+zVZe4st7+y873u3FhUUOjv3fe/WLe/sNLt0r4TsNm6LX49A2nJ+6zAMk6t5dFF55b5j7ZFhZ6dy37FHF5Vn7S1un3Xdjg0bY/VfOjs7Nmy8fdZ1ZpcuGdzTbty/3tlsNoFAQFg2vn2FPrVv/eXhN/7iwOuX7X6lQDiNYRhPzQLfi+2R4X0NPc5Oe2R4ge/FrL1FUUHhSO2h3vfecHZGag8VFRSaXbo1QbuN++3dJ8wmEAgIy8a3r/hTf+Wf+iv/1LttvGvLeHDNH1b+N+G0t3ef8P9Qm8IPN6Zzjv5S81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Vyedpmma9eMWBzPH50odzt5g+k0i3DPGO8fiLuIGyw4adzb4fL7R0dFmp2maZvG43oOMS4un2DA6OsrnShHO3mDJO6d58g0jfTD1uU5tgxvMAo07G/TPVZPTNE2b8nHh2OwpNvC5UoeDN5h+h1jfJ9Jv1iU5so0mbjBLNO5s8Pl8sVisYcasPzCapunnGM9PfYWZb0MXi8X4XCnCwRvMeCy9wRos7yJusOygcWeD/rmqyy98rtTBDeY1NO5s8Pl8IyMjtfllZGSEz5UiuMG8hsadDX6/PxQK9ff3H80X/f39oVCIPy5ZEdxgXkPjzoZVq1aVlZWFw+GRfBEOh8vKylbxF5SogRvMa2jcWbJixQq/35/u37inPL/fv2LFilxfVFzCDeYpNG4AcBkaNwC4DI0bAFyGxg0ALkPjBgCXoXEDgMvQuAHAZWjcAOAyNG4AcBkaNwC4DI0bAFyGxg0ALkPjBgCXoXEDgMvQuAHAZWjcAOAyNG4AcBkaNwC4DI0bAFyGxg0ALkPjBgCXoXEDgMvQuAHAZWjcAOAyNG4AcBkaNwC4DI0bAFyGxg0ALkPjBgCXoXEDgMvQuAHAZWjcAOAyNG4AcBkaNwC4DI0bAFyGxg0ALkPjBgCXoXEDgMvQuAHAZWjcAOAyTjbuytoowzAMk/25+mjYZuPO+dYZhmG8OcngpnEzDMO4Y2jcDMMwLhsaN8MwjMuGxs0wDOOysdm4rz4aZhg3jjZZzvfDMPZGuJPTatyAS3EzIz9IvxFi1bgBl7K+3QG3mF5wX5jIbr7y1Y1fzW53FfbGV77O/E6+eHwByCM0buQHghseQnAjPxDc8Bbr/8IDuIXFncxtDQAuQ3ADgMsQ3ADgMv8fAEaeZ9CfH68AAAAASUVORK5CYII=" alt="" />
这个界面的代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.IO;
using System.Windows.Forms;
using Microsoft.Office.Interop.Excel; namespace DBDesign
{
public partial class Form2 : Form
{
private PdmReader pr = new PdmReader(); private string path = string.Empty; public Form2(PdmReader pr, string path)
{
InitializeComponent(); this.pr = pr;
this.path = path;
} private void Form2_Load(object sender, EventArgs e)
{
pr.InitData(); this.dataGridView1.AutoGenerateColumns = false;
this.dataGridView1.DataSource = pr.Tables; string[] names = null;
List<string> hms = new List<string>();
List<string> res = null;
for (int i = ; names != null && i < names.Length; i++)
{
string[] str = names[i].Split(new char[] { '!' }, StringSplitOptions.RemoveEmptyEntries);
res = hms.FindAll(M => M.Equals(str[].Substring()));
if (!(res != null && res.Count > ))
{
hms.Add(str[].Substring());
}
}
foreach (string s in hms)
{
this.comboBox1.Items.Add(s);
}
} private void button2_Click(object sender, EventArgs e)
{
this.Visible = false;
Form1 f1 = new Form1();
f1.Show();
} private void Form2_FormClosed(object sender, FormClosedEventArgs e)
{
System.Windows.Forms.Application.Exit();
} private void button3_Click(object sender, EventArgs e)
{
if (this.comboBox1.SelectedItem != null && !this.comboBox1.SelectedItem.Equals(""))
{
FileInfo file = new FileInfo(path);
if (!Directory.Exists("D:\\work\\Test\\XML\\" + file.Name.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries)[]))
{
Directory.CreateDirectory("D:\\work\\Test\\XML\\" + file.Name.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries)[]);
}
if (Directory.Exists("D:\\work\\Test\\XML\\" + file.Name.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries)[] + "\\" + this.comboBox1.SelectedItem.ToString() + ".txt"))
{
File.Delete("D:\\work\\Test\\XML\\" + file.Name.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries)[] + "\\" + this.comboBox1.SelectedItem.ToString() + ".txt");
}
string str = string.Empty;
foreach (DataGridViewRow dr in this.dataGridView1.Rows)
{
if (dr.Cells[].Value != null && int.Parse(dr.Cells[].Value.ToString()) == )
{
str += dr.Cells[].Value.ToString() + "|";
}
}
if (str.Length > )
{
str = str.Substring(, str.Length - );
}
FileStream fs = new FileStream("D:\\work\\Test\\XML\\" + file.Name.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries)[] + "\\" + this.comboBox1.SelectedItem.ToString() + ".txt", FileMode.Create);
StreamWriter sw = new StreamWriter(fs);
sw.Write(str);
sw.Flush();
sw.Close();
fs.Close();
}
} private void button1_Click(object sender, EventArgs e)
{
int n = ;
FileInfo file = new FileInfo(path);
Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.ApplicationClass();
app.Visible = false;
Workbook wb = app.Workbooks.Add(true);
Worksheet ws = (Worksheet)wb.ActiveSheet;
ws.Name = "所有表";
((Microsoft.Office.Interop.Excel.Range)ws.Columns["B", Type.Missing]).ColumnWidth = 25.50;
((Microsoft.Office.Interop.Excel.Range)ws.Columns["A", Type.Missing]).HorizontalAlignment = Microsoft.Office.Interop.Excel.XlVAlign.xlVAlignCenter;
((Microsoft.Office.Interop.Excel.Range)ws.Columns["E", Type.Missing]).HorizontalAlignment = Microsoft.Office.Interop.Excel.XlVAlign.xlVAlignCenter;
((Microsoft.Office.Interop.Excel.Range)ws.Columns["F", Type.Missing]).HorizontalAlignment = Microsoft.Office.Interop.Excel.XlVAlign.xlVAlignCenter;
((Microsoft.Office.Interop.Excel.Range)ws.Columns["C", Type.Missing]).ColumnWidth = 43.50;
((Microsoft.Office.Interop.Excel.Range)ws.Columns["D", Type.Missing]).ColumnWidth = 10.00;
((Microsoft.Office.Interop.Excel.Range)ws.Columns["E", Type.Missing]).ColumnWidth = 8.50;
((Microsoft.Office.Interop.Excel.Range)ws.Columns["F", Type.Missing]).ColumnWidth = 8.50;
Range r = ws.get_Range(ws.Cells[,],ws.Cells[,]);
r.Interior.ColorIndex = ;
r.Font.Size = ;
r.Font.Bold = true;
Borders borders = r.Borders;
borders.LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
ws.Cells[n, ] = "序号";
ws.Cells[n, ] = "表名";
ws.Cells[n, ] = "表说明";
ws.Cells[n, ] = "字段类型";
ws.Cells[n, ] = "长度";
ws.Cells[n, ] = "允许空"; n = ; List<string> list = new List<string>();
for (int i = ; i < this.dataGridView1.Rows.Count; i++)
{
DataGridViewRow dr = this.dataGridView1.Rows[i];
string str = dr.Cells[].Value.ToString();
if (dr.Cells["cbxTable"].Value != null && dr.Cells["cbxTable"].Value.ToString().Equals(""))
{
list.Add(dr.Cells[].Value.ToString());
}
} foreach (TableInfo table in pr.Tables)
{
bool print = false;
if (this.checkBox1.Checked)
{
print = true;
}
else
{
foreach (string s in list)
{
if (s.Equals(table.Code))
{
print = true;
}
}
}
if (print)
{
Range rt = ws.get_Range(ws.Cells[n, ], ws.Cells[n, ]);
rt.Interior.ColorIndex = ;
rt.Font.Size = ;
Borders border = rt.Borders;
border.LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
ws.Cells[n, ] = "T";
ws.Cells[n, ] = table.Code;
ws.Cells[n, ] = table.Comment;
ws.Cells[n, ] = "";
ws.Cells[n, ] = "";
ws.Cells[n, ] = ""; n = n + ; for (int i = ; i < table.Columns.Count; i++)
{
Range rtc = ws.get_Range(ws.Cells[n, ], ws.Cells[n, ]);
rtc.Font.Size = ;
Borders borderc = rtc.Borders;
borderc.LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
ws.Cells[n, ] = i + ;
ws.Cells[n, ] = table.Columns[i].Code;
ws.Cells[n, ] = table.Columns[i].Comment;
ws.Cells[n, ] = table.Columns[i].DataType.Contains("(") ? table.Columns[i].DataType.Split(new char[] { '(' }, StringSplitOptions.RemoveEmptyEntries)[] : table.Columns[i].DataType;
if (table.Columns[i].DataType.Equals("int"))
{
ws.Cells[n, ] = ;
}
else if (table.Columns[i].DataType.Equals("datetime"))
{
ws.Cells[n, ] = ;
}
else
{
ws.Cells[n, ] = table.Columns[i].Length;
}
ws.Cells[n, ] = table.Columns[i].Mandatory ? "" : "√"; if (table.Primary != null)
{
foreach (string pk in table.Primary)
{
if (pk.Equals(table.Columns[i].ColumnId))
{
rtc.Interior.ColorIndex = ;
}
}
} n = n + ;
}
}
} wb.Saved = true;
app.ActiveWorkbook.SaveCopyAs("D:\\Test.xlsx");
MessageBox.Show("over!");
}
}
}
然后这里还用到了四个别的类,分别列举一下:
1.TableInfo.cs
using System;
using System.Collections.Generic;
using System.Text; namespace DBDesign
{
//表信息
public class TableInfo
{
public TableInfo()
{
}
string tableId; public string TableId
{
get { return tableId; }
set { tableId = value; }
}
string objectID; public string ObjectID
{
get { return objectID; }
set { objectID = value; }
}
string name; public string Name
{
get { return name; }
set { name = value; }
}
string code; public string Code
{
get { return code; }
set { code = value; }
}
int creationDate; public int CreationDate
{
get { return creationDate; }
set { creationDate = value; }
}
string creator; public string Creator
{
get { return creator; }
set { creator = value; }
}
int modificationDate; public int ModificationDate
{
get { return modificationDate; }
set { modificationDate = value; }
}
string modifier; public string Modifier
{
get { return modifier; }
set { modifier = value; }
}
string comment; public string Comment
{
get { return comment; }
set { comment = value; }
} string physicalOptions; public string PhysicalOptions
{
get { return physicalOptions; }
set { physicalOptions = value; }
} IList<ColumnInfo> columns; public IList<ColumnInfo> Columns
{
get { return columns; }
} IList<PdmKey> keys; public IList<PdmKey> Keys
{
get { return keys; }
} IList<string> primary; public IList<string> Primary
{
get { return primary; }
set { primary = value; }
} public void AddColumn(ColumnInfo mColumn)
{
if (columns == null)
columns = new List<ColumnInfo>();
columns.Add(mColumn);
} public void AddKey(PdmKey mKey)
{
if (keys == null)
keys = new List<PdmKey>();
keys.Add(mKey);
} public void AddPrimary(string id)
{
if (primary == null)
primary = new List<string>();
primary.Add(id);
}
} }
2.PdmReader.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml; namespace DBDesign
{
public class PdmReader
{
public const string a = "attribute", c = "collection", o = "object"; public const string cClasses = "c:Classes";
public const string oClass = "o:Class"; public const string cAttributes = "c:Attributes";
public const string oAttribute = "o:Attribute"; public const string cTables = "c:Tables";
public const string oTable = "o:Table"; public const string cColumns = "c:Columns";
public const string oColumn = "o:Column"; XmlDocument xmlDoc;
XmlNamespaceManager xmlnsManager;
/// <summary>构造函数 </summary>
public PdmReader()
{
// TODO: 在此处添加构造函数逻辑
xmlDoc = new XmlDocument();
}
/// <summary>构造函数 </summary>
public PdmReader(string pdm_file)
{
PdmFile = pdm_file;
} string pdmFile; public string PdmFile
{
get { return pdmFile; }
set
{
pdmFile = value;
if (xmlDoc == null)
{
xmlDoc = new XmlDocument();
xmlDoc.Load(pdmFile);
xmlnsManager = new XmlNamespaceManager(xmlDoc.NameTable);
xmlnsManager.AddNamespace("a", "attribute");
xmlnsManager.AddNamespace("c", "collection");
xmlnsManager.AddNamespace("o", "object");
}
}
} IList<TableInfo> tables; public IList<TableInfo> Tables
{
get { return tables; }
set { tables = value; }
} public void InitData()
{
if (Tables == null)
Tables = new List<TableInfo>();
XmlNode xnTables = xmlDoc.SelectSingleNode("//" + cTables, xmlnsManager);
foreach (XmlNode xnTable in xnTables.ChildNodes)
{
Tables.Add(GetTable(xnTable));
}
} //初始化"o:Table"的节点
private TableInfo GetTable(XmlNode xnTable)
{
TableInfo mTable = new TableInfo();
XmlElement xe = (XmlElement)xnTable;
mTable.TableId = xe.GetAttribute("Id");
XmlNodeList xnTProperty = xe.ChildNodes;
foreach (XmlNode xnP in xnTProperty)
{
switch (xnP.Name)
{
case "a:ObjectID": mTable.ObjectID = xnP.InnerText;
break;
case "a:Name": mTable.Name = xnP.InnerText;
break;
case "a:Code": mTable.Code = xnP.InnerText;
break;
case "a:CreationDate": mTable.CreationDate = Convert.ToInt32(xnP.InnerText);
break;
case "a:Creator": mTable.Creator = xnP.InnerText;
break;
case "a:ModificationDate": mTable.ModificationDate = Convert.ToInt32(xnP.InnerText);
break;
case "a:Modifier": mTable.Modifier = xnP.InnerText;
break;
case "a:Comment": mTable.Comment = xnP.InnerText;
break;
case "a:PhysicalOptions": mTable.PhysicalOptions = xnP.InnerText;
break;
case "c:Columns": InitColumns(xnP, mTable);
break;
case "c:Keys": InitKeys(xnP, mTable);
break;
case "c:PrimaryKey": InitPrimary(xnP, mTable);
break;
}
}
return mTable;
}
//初始化"c:Columns"的节点
private void InitColumns(XmlNode xnColumns, TableInfo pTable)
{
foreach (XmlNode xnColumn in xnColumns)
{
pTable.AddColumn(GetColumn(xnColumn));
}
} //初始化c:Keys"的节点
private void InitKeys(XmlNode xnKeys, TableInfo pTable)
{
foreach (XmlNode xnKey in xnKeys)
{
pTable.AddKey(GetKey(xnKey));
}
} //初始化c:PrimaryKey的节点
private void InitPrimary(XmlNode xnKeys, TableInfo pTable)
{
foreach (XmlNode xnKey in xnKeys)
{
PdmKey key = GetPrimary(xnKey);
foreach (PdmKey pk in pTable.Keys)
{
if (pk.KeyId.Equals(key.KeyId))
{
foreach (ColumnInfo ci in pk.Columns)
{
pTable.AddPrimary(ci.ColumnId);
}
}
}
}
} private ColumnInfo GetColumn(XmlNode xnColumn)
{
ColumnInfo mColumn = new ColumnInfo();
XmlElement xe = (XmlElement)xnColumn;
mColumn.ColumnId = xe.GetAttribute("Id");
XmlNodeList xnCProperty = xe.ChildNodes;
foreach (XmlNode xnP in xnCProperty)
{
switch (xnP.Name)
{
case "a:ObjectID": mColumn.ObjectID = xnP.InnerText;
break;
case "a:Name": mColumn.Name = xnP.InnerText;
break;
case "a:Code": mColumn.Code = xnP.InnerText;
break;
case "a:CreationDate": mColumn.CreationDate = Convert.ToInt32(xnP.InnerText);
break;
case "a:Creator": mColumn.Creator = xnP.InnerText;
break;
case "a:ModificationDate": mColumn.ModificationDate = Convert.ToInt32(xnP.InnerText);
break;
case "a:Modifier": mColumn.Modifier = xnP.InnerText;
break;
case "a:Comment": mColumn.Comment = xnP.InnerText;
break;
case "a:DataType": mColumn.DataType = xnP.InnerText;
break;
case "a:Length": mColumn.Length = xnP.InnerText;
break;
case "a:Identity": mColumn.Identity = xnP.InnerText.Equals("Yes") ? true : false;
break;
case "a:Mandatory": mColumn.Mandatory = xnP.InnerText.Equals("") ? true : false;
break;
case "a:PhysicalOptions": mColumn.PhysicalOptions = xnP.InnerText;
break;
case "a:ExtendedAttributesText": mColumn.ExtendedAttributesText = xnP.InnerText;
break;
}
}
return mColumn;
} private PdmKey GetKey(XmlNode xnKey)
{
PdmKey mKey = new PdmKey();
XmlElement xe = (XmlElement)xnKey;
mKey.KeyId = xe.GetAttribute("Id");
XmlNodeList xnKProperty = xe.ChildNodes;
foreach (XmlNode xnP in xnKProperty)
{
switch (xnP.Name)
{
case "a:ObjectID": mKey.ObjectID = xnP.InnerText;
break;
case "a:Name": mKey.Name = xnP.InnerText;
break;
case "a:Code": mKey.Code = xnP.InnerText;
break;
case "a:CreationDate": mKey.CreationDate = Convert.ToInt32(xnP.InnerText);
break;
case "a:Creator": mKey.Creator = xnP.InnerText;
break;
case "a:ModificationDate": mKey.ModificationDate = Convert.ToInt32(xnP.InnerText);
break;
case "a:Modifier": mKey.Modifier = xnP.InnerText;
break;
//还差 <c:Key.Columns>
case "c:Key.Columns": GetKeyColumn(xnP, mKey);
break;
}
}
return mKey;
} public void GetKeyColumn(XmlNode xnP ,PdmKey mKey)
{
XmlElement xe = (XmlElement)xnP;
XmlNodeList nodeList = xe.ChildNodes;
foreach (XmlNode node in nodeList)
{
ColumnInfo ci = new ColumnInfo();
ci.ColumnId = ((XmlElement)node).GetAttribute("Ref");
mKey.AddColumn(ci);
}
} private PdmKey GetPrimary(XmlNode xnKey)
{
PdmKey mKey = new PdmKey();
XmlElement xe = (XmlElement)xnKey;
mKey.KeyId = xe.GetAttribute("Ref");
return mKey;
}
} }
3.PdmKey.cs
using System;
using System.Collections.Generic;
using System.Text; namespace DBDesign
{
public class PdmKey
{
public PdmKey()
{
} string keyId; public string KeyId
{
get { return keyId; }
set { keyId = value; }
}
string objectID; public string ObjectID
{
get { return objectID; }
set { objectID = value; }
}
string name; public string Name
{
get { return name; }
set { name = value; }
}
string code; public string Code
{
get { return code; }
set { code = value; }
}
int creationDate; public int CreationDate
{
get { return creationDate; }
set { creationDate = value; }
}
string creator; public string Creator
{
get { return creator; }
set { creator = value; }
}
int modificationDate; public int ModificationDate
{
get { return modificationDate; }
set { modificationDate = value; }
}
string modifier; public string Modifier
{
get { return modifier; }
set { modifier = value; }
} IList<ColumnInfo> columns; public IList<ColumnInfo> Columns
{
get { return columns; }
} public void AddColumn(ColumnInfo mColumn)
{
if (columns == null)
columns = new List<ColumnInfo>();
columns.Add(mColumn);
}
} }
4.ColumnInfo.cs
using System;
using System.Collections.Generic;
using System.Text; namespace DBDesign
{
public class ColumnInfo
{
public ColumnInfo()
{ } string columnId; public string ColumnId
{
get { return columnId; }
set { columnId = value; }
}
string objectID; public string ObjectID
{
get { return objectID; }
set { objectID = value; }
}
string name; public string Name
{
get { return name; }
set { name = value; }
}
string code; public string Code
{
get { return code; }
set { code = value; }
}
int creationDate; public int CreationDate
{
get { return creationDate; }
set { creationDate = value; }
}
string creator; public string Creator
{
get { return creator; }
set { creator = value; }
}
int modificationDate; public int ModificationDate
{
get { return modificationDate; }
set { modificationDate = value; }
}
string modifier; public string Modifier
{
get { return modifier; }
set { modifier = value; }
}
string comment; public string Comment
{
get { return comment; }
set { comment = value; }
}
string dataType; public string DataType
{
get { return dataType; }
set { dataType = value; }
}
string length; public string Length
{
get { return length; }
set { length = value; }
}
//是否自增量
bool identity; public bool Identity
{
get { return identity; }
set { identity = value; }
}
bool mandatory;
//禁止为空
public bool Mandatory
{
get { return mandatory; }
set { mandatory = value; }
}
string extendedAttributesText;
//扩展属性
public string ExtendedAttributesText
{
get { return extendedAttributesText; }
set { extendedAttributesText = value; }
}
string physicalOptions; public string PhysicalOptions
{
get { return physicalOptions; }
set { physicalOptions = value; }
}
} }
C#操作PowerDesigner代码的更多相关文章
- Entity Framework 实体框架的形成之旅--几种数据库操作的代码介绍(9)
本篇主要对常规数据操作的处理和实体框架的处理代码进行对比,以便更容易学习理解实体框架里面,对各种数据库处理技巧,本篇介绍几种数据库操作的代码,包括写入中间表操作.联合中间表获取对象集合.递归操作.设置 ...
- C#各种文件操作的代码与注释
C#各种文件操作的代码与注释,具体看下面代码: using System; using System.Collections.Generic; using System.Linq; using Sys ...
- Global.asax中的操作数据库代码无法执行
本人最近在做一个基于Access数据库的Web应用程序,为了实现一个定时更新数据库的需求,我在Global.asax中的Application_Start函数里写了个计时器, void Applica ...
- python之文件的读写和文件目录以及文件夹的操作实现代码
这篇文章主要介绍了python之文件的读写和文件目录以及文件夹的操作实现代码,需要的朋友可以参考下 为了安全起见,最好还是给打开的文件对象指定一个名字,这样在完成操作之后可以迅速关闭文件,防止一些无用 ...
- .NET下对Web.config与App.Config的增删改操作的代码
把代码过程常用的内容做个收藏,下边代码段是关于 .NET下对Web.config与App.Config的增删改操作的代码. <?xml version="1.0" encod ...
- 这些HTML、CSS知识点,面试和平时开发都需要 No10-No11(知识点:表格操作、代码编写规则)
系列知识点汇总 1.基础篇 这些HTML.CSS知识点,面试和平时开发都需要 No1-No4(知识点:HTML.CSS.盒子模型.内容布局) 这些HTML.CSS知识点,面试和平时开发都需要 No5- ...
- 完整全面的Java资源库(包括构建、操作、代码分析、编译器、数据库、社区等等)
构建 这里搜集了用来构建应用程序的工具. Apache Maven:Maven使用声明进行构建并进行依赖管理,偏向于使用约定而不是配置进行构建.Maven优于Apache Ant.后者采用了一种过程化 ...
- 整理分享C#通过user32.dll模拟物理按键操作的代码
对系统模拟按键方面的知识和按键映射代码做了一下梳理,在这里分享出来,适用于开发自动操作工具和游戏外挂. 主代码: public const int KEYEVENTF_EXTENDEDKEY = 0x ...
- 3种归并操作js代码
/**良哥的*/ function merge(a, b) { var aLen = a.length, bLen = b.length, maxLen = Math.max(aLen, bLen), ...
随机推荐
- 转载:【Oracle 集群】RAC知识图文详细教程(五)--特殊问题和实战经验
文章导航 集群概念介绍(一) ORACLE集群概念和原理(二) RAC 工作原理和相关组件(三) 缓存融合技术(四) RAC 特殊问题和实战经验(五) ORACLE 11 G版本2 RAC在LINUX ...
- AndroidStudio构建常见错误解答解决思路
一.Error:Configuration with name 'default' not found.解决思路 出现这问题的原因是你依赖的工程没有make project,意思是你导入项目的工程没有 ...
- PentesterLab-From SQL Injection to Shell: PostgreSQL edition
一.打开页面,随便点了几下,返现和From SQL Injection to Shell差不多,直奔主题开始注入 由于PostgreSQL与MySQL不同,几个关注点需要注意下 二.order by下 ...
- 剑指offer--45.二叉树的深度
时间限制:1秒 空间限制:32768K 热度指数:139716 题目描述 输入一棵二叉树,求该树的深度.从根结点到叶结点依次经过的结点(含根.叶结点)形成树的一条路径,最长路径的长度为树的深度. -- ...
- Shell 命令行实现将一个站点页面全部下载到本地并替换其中链接的脚本
Shell 命令行实现将一个站点页面全部下载到本地并替换其中链接的脚本 不知道为什么,我总想用 Shell 脚本来实现把一个站点内容给下载下来.但是下载什么站点我确不知道.今天尝试了一下利用 curl ...
- HashSet实现原理及源码分析
HashSet简介 HashSet是Set接口实现,它按照Hash算法来存储集合中的元素 不保证元素顺序 HashSet是非同步的,如果多个线程同时访问一个HashSet,要通过代码来保证其同步 集合 ...
- Java [Leetcode 384]Shuffle an Array
题目描述: Shuffle a set of numbers without duplicates. Example: // Init an array with set 1, 2, and 3. i ...
- bootstrap 折叠菜单
首先从 左侧的折叠菜单 开始.看图. 2. CSS 代码 以下是自定义的css代码,由于系统是内部使用,所以优先考虑chrome,firefox 不考虑IE了. #main-nav { margin- ...
- hadoop 的job.setOutputKeyClass和job.setOutputValueClass的几个问题
昨天写了一个mapreduce函数一直有错误,找不到错误,今天找了一天终于解决了,原来是hadoop 的job.setOutputKeyClass和job.setOutputValueClas设置输出 ...
- 【requirejs】JS模块化工具requirejs教程
初识requirejs 随着网站功能逐渐丰富,网页中的js也变得越来越复杂和臃肿,原有通过script标签来导入一个个的js文件这种方式已经不能满足现在互联网开发模式,我们需要团队协作.模块复用.单元 ...