使用しているローカル データベース用のデータベース スクリプト ツールを作成しようとしています。
テーブル、主キー、インデックス、および外部キーの作成スクリプトを生成できましたが、テーブルのデフォルトの作成スクリプトを生成する方法が見つかりません。
インデックスの場合、次のように簡単です
foreach (Index index in table.Indexes)
{
ScriptingOptions drop = new ScriptingOptions();
drop.ScriptDrops = true;
drop.IncludeIfNotExists = true;
foreach (string dropstring in index.Script(drop))
{
createScript.Append(dropstring);
}
ScriptingOptions create = new ScriptingOptions();
create.IncludeIfNotExists = true;
foreach (string createstring in index.Script(create))
{
createScript.Append(createstring);
}
}
ただし、Table オブジェクトには Defaults プロパティがありません。テーブルのデフォルトのスクリプトを生成する他の方法はありますか?