diff --git a/src/Umbraco.Core/IO/PhysicalFileSystem.cs b/src/Umbraco.Core/IO/PhysicalFileSystem.cs index 1be25138e6..74d7f27671 100644 --- a/src/Umbraco.Core/IO/PhysicalFileSystem.cs +++ b/src/Umbraco.Core/IO/PhysicalFileSystem.cs @@ -147,7 +147,7 @@ namespace Umbraco.Core.IO } catch (FileNotFoundException ex) { - LogHelper.Info(string.Format("DeleteFile failed with FileNotFoundException: {0}", ex.InnerException)); + LogHelper.Info(string.Format("DeleteFile failed with FileNotFoundException: {0}", ex.InnerException)); } } diff --git a/src/Umbraco.Core/Persistence/Repositories/ContentTypeRepository.cs b/src/Umbraco.Core/Persistence/Repositories/ContentTypeRepository.cs index 4e81334a56..03bb6ceca3 100644 --- a/src/Umbraco.Core/Persistence/Repositories/ContentTypeRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/ContentTypeRepository.cs @@ -56,8 +56,7 @@ namespace Umbraco.Core.Persistence.Repositories var templates = Database.Fetch("WHERE contentTypeNodeId = @Id", new { Id = id }); if(templates.Any()) { - contentType.AllowedTemplates = - templates.Select(template => _templateRepository.Get(template.TemplateNodeId)); + contentType.AllowedTemplates = templates.Select(template => _templateRepository.Get(template.TemplateNodeId)).ToList(); } var list = Database.Fetch("WHERE childContentTypeId = @Id", new { Id = id}); diff --git a/src/Umbraco.Core/Persistence/SqlSyntax/MySqlSyntaxProvider.cs b/src/Umbraco.Core/Persistence/SqlSyntax/MySqlSyntaxProvider.cs index 8439daa1c7..1d124b3687 100644 --- a/src/Umbraco.Core/Persistence/SqlSyntax/MySqlSyntaxProvider.cs +++ b/src/Umbraco.Core/Persistence/SqlSyntax/MySqlSyntaxProvider.cs @@ -41,11 +41,21 @@ namespace Umbraco.Core.Persistence.SqlSyntax public override bool DoesTableExist(Database db, string tableName) { - db.OpenSharedConnection(); - var result = - db.ExecuteScalar("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES " + - "WHERE TABLE_NAME = @TableName AND " + - "TABLE_SCHEMA = @TableSchema", new { TableName = tableName, TableSchema = db.Connection.Database }); + long result; + try + { + db.OpenSharedConnection(); + result = + db.ExecuteScalar("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES " + + "WHERE TABLE_NAME = @TableName AND " + + "TABLE_SCHEMA = @TableSchema", + new {TableName = tableName, TableSchema = db.Connection.Database}); + + } + finally + { + db.CloseSharedConnection(); + } return result > 0; } diff --git a/src/Umbraco.Core/Persistence/UmbracoDatabase.cs b/src/Umbraco.Core/Persistence/UmbracoDatabase.cs index a67e7960ba..60d28e5292 100644 --- a/src/Umbraco.Core/Persistence/UmbracoDatabase.cs +++ b/src/Umbraco.Core/Persistence/UmbracoDatabase.cs @@ -1,6 +1,7 @@ using System; using System.Data; using System.Data.Common; +using Umbraco.Core.Logging; namespace Umbraco.Core.Persistence { @@ -14,10 +15,7 @@ namespace Umbraco.Core.Persistence /// public class UmbracoDatabase : Database { - - - - private readonly Guid _instanceId = Guid.NewGuid(); + private readonly Guid _instanceId = Guid.NewGuid(); /// /// Used for testing /// @@ -41,5 +39,11 @@ namespace Umbraco.Core.Persistence public UmbracoDatabase(string connectionStringName) : base(connectionStringName) { } + + public override void OnException(Exception x) + { + LogHelper.Info(x.StackTrace); + base.OnException(x); + } } } \ No newline at end of file