Thanks Juraj, but unfortunately I'm running into problems with either example. For the using statement you suggested, I got this error:
The initialization of CMS.DataEngine.AbstractInfoBase1[[CMS.DataEngine.DataClassInfo, CMS.DataEngine, Version=13.0.13.0, Culture=neutral, PublicKeyToken=834b12a258f213f9]] failed. See the inner exception for details.
at CMS.DataEngine.AbstractInfoBase1.EnsureData(Boolean loadDefault, Boolean applyTypeCondition)
at CMS.DataEngine.AbstractInfoBase1.get_DataClass()
at CMS.DataEngine.AbstractInfoBase1.ItemChanged(String columnName)
at CMS.DataEngine.AbstractInfoBase1.TryGetValue(String columnName, Object& value)
at CMS.DataEngine.AbstractInfoBase1.GetValue(String columnName)
at CMS.DataEngine.DataClassInfoBase1.get_ClassShowAsSystemTable()
at CMS.DataEngine.DataClassInfo.get_TypeInfo()
at CMS.DataEngine.BaseInfo.CheckLicense(ObjectActionEnum action, String domainName)
at CMS.DataEngine.BaseInfo.GeneralizedInfoWrapper.CheckLicense(ObjectActionEnum action, String domainName)
at CMS.DataEngine.AbstractInfoProvider3.GetObjectQuery(Boolean checkLicense)
at CMS.DataEngine.DataClassInfoProviderBase1.GetInfoByColumn[T](String columnName, T value)
at CMS.DataEngine.AbstractInfoProvider3.GetInfoByCodeName(String codeName, Boolean useHashtable)
at CMS.DataEngine.DataClassInfoProviderBase1.GetDataClassInfo(String name)
at CMS.DocumentEngine.DocumentEngineModule.AbstractProvider_LoadProvider(Object sender, LoadProviderEventArgs e)
at CMS.DataEngine.InfoProviderLoader.OnLoadProvider.Invoke(Object sender, LoadProviderEventArgs e)
at CMS.DataEngine.InfoProviderLoader.GetInfoProvider(String objectType, Boolean exceptionIfNotFound)
at CMS.DataEngine.InfoProviderLoader.GetInfoProvider[TProvider](String objectType, Boolean exceptionIfNotFound)
at CMS.DocumentEngine.TreeNodeProvider.GetDocuments(String className)
at CMS.DocumentEngine.DocumentHelper.GetDocuments(String className)
As for the old code, when I paste it into VS I get an error for CMSStatic.CurrentContext = connString:
CS0305: Using the generic type 'CMSStatic<TValue>' requires 1 type arguments.