From 27428bf5453e279a5a2e5e2cbde35625e4838aff Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 23 May 2017 16:23:40 +1000 Subject: [PATCH] U4-9907 Translations Section : Getting "open datareader" Issue : Relates to (U4-9201) --- src/umbraco.cms/businesslogic/ContentType.cs | 26 +++++++++----------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/umbraco.cms/businesslogic/ContentType.cs b/src/umbraco.cms/businesslogic/ContentType.cs index 7f1f3db742..8ffd207cd5 100644 --- a/src/umbraco.cms/businesslogic/ContentType.cs +++ b/src/umbraco.cms/businesslogic/ContentType.cs @@ -611,21 +611,19 @@ namespace umbraco.cms.businesslogic //its own + inherited property types, which is wrong. Once we are able to fully switch to the new api //this should no longer be a problem as the composition always contains a correct list of property types. var result = new Dictionary(); - using (var sqlHelper = Application.SqlHelper) - using (IRecordsReader dr = sqlHelper.ExecuteReader( - "select id from cmsPropertyType where contentTypeId = @ctId order by sortOrder", - sqlHelper.CreateParameter("@ctId", Id))) - { - while (dr.Read()) - { - int id = dr.GetInt("id"); - PropertyType pt = PropertyType.GetPropertyType(id); - if (pt != null) - result.Add(pt.Id, pt); - } - } - // Get Property Types from the master content type + var ids = ApplicationContext.Current.DatabaseContext.Database.Fetch( + "select id from cmsPropertyType where contentTypeId = @ctId order by sortOrder", + new {ctId = Id}); + + foreach (var id in ids) + { + var pt = PropertyType.GetPropertyType(id); + if (pt != null) + result.Add(pt.Id, pt); + } + + // Get Property Types from the master content type if (MasterContentTypes.Count > 0) { foreach (var mct in MasterContentTypes)