22using GeneXus . Application ;
33using GeneXus . Configuration ;
44using GeneXus . Data ;
5+ using GeneXus . Data . ADO ;
56using GeneXus . Encryption ;
67using GxClasses . Helpers ;
78using log4net ;
@@ -121,6 +122,7 @@ public class GxDatabaseSession : ISessionService
121122 internal static string SESSION_SCHEMA = "SESSION_PROVIDER_SCHEMA" ;
122123 internal static string SESSION_TABLE_NAME = "SESSION_PROVIDER_TABLE_NAME" ;
123124 internal static string SESSION_DATASTORE = "SESSION_PROVIDER_DATASTORE" ;
125+ const string DEFAULT_SQLSERVER_SCHEMA = "dbo" ;
124126
125127 public GxDatabaseSession ( GXService serviceProvider )
126128 {
@@ -130,15 +132,18 @@ public GxDatabaseSession(GXService serviceProvider)
130132 GxContext context = GxContext . CreateDefaultInstance ( ) ;
131133 IGxDataStore datastore = context . GetDataStore ( datastoreName ) ;
132134 string schema = datastore . Connection . CurrentSchema ;
135+ if ( string . IsNullOrEmpty ( schema ) )
136+ schema = DEFAULT_SQLSERVER_SCHEMA ;
133137 string tableName = serviceProvider . Properties . Get ( SESSION_TABLE_NAME ) ;
134- ConnectionString = datastore . Connection . ConnectionString ;
138+ GxConnection conn = datastore . Connection as GxConnection ;
135139 Schema = schema ;
136140 TableName = tableName ;
137141 context . CloseConnections ( ) ;
138142 GxDataRecord dr = datastore . Db as GxDataRecord ;
139- if ( dr != null )
143+ if ( dr != null && conn != null )
140144 {
141- GXLogging . Debug ( log , "Database ConnectionString:" , dr . ConnectionStringForLog ( ) ) ;
145+ ConnectionString = dr . BuildConnectionStringImpl ( conn . DataSourceName , conn . InternalUserId , conn . UserPassword , conn . DatabaseName , conn . Port , conn . CurrentSchema , conn . Data ) ;
146+ GXLogging . Debug ( log , "Database ConnectionString:" , dr . ConnectionStringForLog ( ) ) ;
142147 }
143148
144149 }
0 commit comments