XmlDocument config=null;
private DataBaseInstaller()
{
System.IO.Stream stream =
System.Reflection.Assembly.GetExecutingAssembly().
GetManifestResourceStream(
"CustomSteps.Resources.InstallationFiles.xml");
config=new XmlDocument();
config.Load(stream);
}
此构造函数会加载包含有关这些脚本文件详细信息的 InstallationFiles.xml 文件。您还记得吧,您已经将此文件的 Build Action 显式设置为 Embedded resource。之后,您就拥有了封装创建数据库功能的各种成员。表 3 提供了有关上述内容的一些详细信息。
表 3. DatabaseInstaller 的成员。
成员 说明
CreateDataBase()
调用以创建数据库的公共方法。
DropDataBase()
删除数据库的公共方法。
CreateObjects()
创建对象(如表、存储过程等)的公共方法。
文章来源于领测软件测试网 https://www.ltesting.net/