diff --git a/Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/Foundation/DynamicTypesCommon.cs b/Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/Foundation/DynamicTypesCommon.cs index 1514fd7894..b8d4cb7452 100644 --- a/Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/Foundation/DynamicTypesCommon.cs +++ b/Composite/Plugins/Data/DataProviders/MSSqlServerDataProvider/Foundation/DynamicTypesCommon.cs @@ -33,13 +33,31 @@ internal static string GenerateTableName(DataTypeDescriptor dataTypeDescriptor, throw new InvalidOperationException("Unsupported data scope identifier: '{0}'".FormatWith(dataScope.Name)); } - string result = string.Format("{0}_{1}_{2}", tableNameStem, dataTypeDescriptor.Name, publicationScope); + string storageKey = GetStorageName(publicationScope.ToString(), cultureInfo.Name); - if (!string.IsNullOrEmpty(cultureInfo.ToString())) result += "_" + cultureInfo.ToString().Replace("-", ""); + return string.Format("{0}_{1}_{2}", tableNameStem, dataTypeDescriptor.Name, storageKey); - return result; +#warning MRJ: BM: Clean this + //string result = string.Format("{0}_{1}_{2}", tableNameStem, dataTypeDescriptor.Name, publicationScope); + + //if (!string.IsNullOrEmpty(cultureInfo.ToString())) result += "_" + cultureInfo; + + //return result; } + + internal static string GetStorageName(string dataScope, string cultureName) + { + string result = dataScope; + if (!cultureName.IsNullOrEmpty()) + { + result += "_" + cultureName.Replace('-', '_').Replace(' ', '_'); + } + return result; + } + + + internal static string GenerateListTableName(DataTypeDescriptor typeDescriptor, DataFieldDescriptor fieldDescriptor) { return string.Format("{0}_{1}", GenerateTableName(typeDescriptor), fieldDescriptor.Name);