开发者

Restore Database backup from code?

I have an application extension which I need to test. Part of the extension applies some updates to the application database schema (via the applications API). i want to test that given version 1 of the application when my class is开发者_开发百科 run the schema becomes v1.1 and that certain queries for items which should exist in 1.1 return correctly. I have backup of the database at schema v1.0 and what I would like to do in my tests is:

1/ restore the database from a backup

2/ call the code which does the update

3/ call several methods which verify that the schema updates have succeeded

4/restore the database from a backup

Are there classes I can use to do this restore in my c# code, or do I have to execute the command in shell process?


If you are uysing SQL Server, you could use the SQL Management objects (SMO)

An example can be found here

Kindness,

Dan

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜