Cleaning up after calls to SMO Server and Database
问题 How do you make SMO release it's connections? I have this code: public static class SqlServerConnectionFactory { public static Server GetSmoServer() { using (var c = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString)) { var s = new ServerConnection(c); c.Close(); return new Server(s); } } public static Database GetSmoDatabase(Server server) { var db = server.Databases[ConfigurationManager.AppSettings["Database"]]; db.AutoClose = true; return db; }