Skip to content

Commit 67503c6

Browse files
Fix test for reading Redis configuration from Cloudservices.dev.config.
1 parent 779ce5d commit 67503c6

File tree

4 files changed

+90
-11
lines changed

4 files changed

+90
-11
lines changed

dotnet/src/dotnetcore/GxClasses/Helpers/CompatibilityExtensions.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,17 @@ public AssemblyLoader(string path)
1515
}
1616
internal static Type GetType(string typeFullName)
1717
{
18-
string typeName = typeFullName.Split(',').First();
19-
string assemblyName = typeFullName.Substring(typeName.Length + 1);
20-
AssemblyName assName = new AssemblyName(assemblyName);
21-
return LoadContext.LoadFromAssemblyName(assName).GetType(typeName);
18+
if (typeFullName.Contains(','))
19+
{
20+
string typeName = typeFullName.Split(',').First();
21+
string assemblyName = typeFullName.Substring(typeName.Length + 1);
22+
AssemblyName assName = new AssemblyName(assemblyName);
23+
return LoadContext.LoadFromAssemblyName(assName).GetType(typeName);
24+
}
25+
else
26+
{
27+
return Type.GetType(typeFullName, true, true);
28+
}
2229
}
2330
/*Try to resolve by name when resolution fails. Keep compatibility with previous resolver*/
2431
private static Assembly LoadContext_Resolving(AssemblyLoadContext arg1, AssemblyName assemblyName)

dotnet/src/dotnetcore/GxClasses/Services/Session/GXSessionFactory.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,30 @@ public static ISessionService GetProvider()
2020
{
2121
try
2222
{
23+
Type type = null;
2324
string className = providerService.ClassName;
2425
//Compatibility
2526
if (string.IsNullOrEmpty(className))
2627
{
2728
if (providerService.Name.Equals(REDIS, StringComparison.OrdinalIgnoreCase))
28-
className = typeof(GxRedisSession).FullName;
29+
type = typeof(GxRedisSession);
2930
else if (providerService.Name.Equals(DATABASE, StringComparison.OrdinalIgnoreCase))
30-
className = typeof(GxDatabaseSession).FullName;
31+
type = typeof(GxDatabaseSession);
3132
}
32-
33-
GXLogging.Debug(log, "Loading Session provider:", providerService.ClassName);
34-
if (!string.IsNullOrEmpty(providerService.ClassName))
33+
else
3534
{
35+
36+
GXLogging.Debug(log, "Loading Session provider:", className);
3637
#if !NETCORE
37-
Type type = Type.GetType(providerService.ClassName, true, true);
38+
type = Type.GetType(className, true, true);
3839
#else
39-
Type type = AssemblyLoader.GetType(providerService.ClassName);
40+
type = AssemblyLoader.GetType(className);
4041
#endif
42+
}
43+
if (type != null)
44+
{
4145
sessionService = (ISessionService)Activator.CreateInstance(type, new object[] { providerService });
46+
return sessionService;
4247
}
4348
}
4449
catch (Exception e)

dotnet/test/DotNetRedisTest/DotNetRedisTest.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
</ItemGroup>
2323

2424
<ItemGroup>
25+
<None Update="appsettings.json">
26+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
27+
</None>
2528
<None Update="CloudServices.dev.config">
2629
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2730
</None>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"appSettings": {
3+
"AppMainNamespace": "GeneXus.Programs",
4+
"DataStore1": "Default",
5+
"DataStore-Count": "1",
6+
"DataStore-Default": "Default",
7+
"Connection-Default-DBMS": "sqlserver",
8+
"Connection-Default-Port": "",
9+
"Connection-Default-LockTimeout": "0",
10+
"Connection-Default-LockRetryCount": "10",
11+
"Connection-Default-IsolationLevel": "CR",
12+
"Connection-Default-Datasource": "",
13+
"Connection-Default-User": "",
14+
"Connection-Default-Password": "",
15+
"Connection-Default-DB": "",
16+
"Connection-Default-Schema": "",
17+
"Connection-Default-Opts": "",
18+
"Connection-Default-TrnInt": "1",
19+
"DateFormat": "MDY",
20+
"YearLimit": "1940",
21+
"TimeAmPmFormat": "12",
22+
"VER_STAMP": "20210602.093942",
23+
"CS_BLOB_PATH": "PublicTempStorage",
24+
"TMPMEDIA_DIR": "PrivateTempStorage",
25+
"PRINT_LAYOUT_METADATA_DIR": "LayoutMetadata",
26+
"StorageTimeZone": "1",
27+
"LOGIN_AS_USERID": "0",
28+
"LANGUAGE": "eng",
29+
"LANG_NAME": "English",
30+
"DECIMAL_POINT": ".",
31+
"DATE_FMT": "MDY",
32+
"CTOD_DATE_FMT": "L",
33+
"Culture": "en-US",
34+
"Theme": "Carmine",
35+
"UseNamedParameters": "1",
36+
"EnableIntegratedSecurity": "0",
37+
"MAX_CURSOR": "100",
38+
"STATIC_CONTENT": "",
39+
"GX_BUILD_NUMBER": "11103481",
40+
"CACHE_CONTENT_EXPIRATION": "36",
41+
"ENABLE_MANAGEMENT": "0",
42+
"COMPRESS_HTML": "1",
43+
"IE_COMPATIBILITY_VIEW": "EmulateIE7",
44+
"DocumentType": "HTML5",
45+
"EXPOSE_METADATA": "0",
46+
"SMART_CACHING": "0",
47+
"wcf:serviceHostingEnvironment:useClassicReadEntityBodyMode": "true",
48+
"HTTP_PROTOCOL": "Unsecure",
49+
"SAMESITE_COOKIE": "Lax",
50+
"CACHE_INVALIDATION_TOKEN": "20216211291931",
51+
"CORS_ALLOW_ORIGIN": "https://normal-website.com",
52+
"MY_CUSTOM_PTY": "DEFAULT_VALUE"
53+
},
54+
"languages": {
55+
"English": {
56+
"code": "eng",
57+
"culture": "en-US",
58+
"date_fmt": "MDY",
59+
"decimal_point": ".",
60+
"thousand_sep": ",",
61+
"time_fmt": "12"
62+
}
63+
}
64+
}

0 commit comments

Comments
 (0)