Closed CWolffIF closed 4 years ago
true xaf strips the password out I will see to it
We will try to answer all questions that do not require research within 24hr. To prioritize cases that require research we use the following labels in order. For all other issues the posting time is respected.
This case is prioritized.
Hi, a had a 2nd project, there it works without problems (same structure of the connection string).
If I add "Persist Security Info=true" to the conection string, it works in the 1st project too, but in the 2nd project the add is not necessary.
Is there switch in XPO/XAF?
from what i remember from the old implementation there was a special structure to support the SequenceGenerator. I had to get the connectionstring using reflection so it will return intact. This feature is never tested in the new package
I need a sample to reproduce the problem, i tried this connectionstring but worked fine
Data Source=APO-BEK;Initial Catalog=Solution60;Integrated Security=SSPI;User ID=APO-BEK\Tolis;Password=mypass;
also looking at the source code the GetConnectionString method does not retrieve it from XAF rather from lower classes and should be intact
works fine as well
Data Source=APO-BEK;Initial Catalog=Solution60;User ID=sa;Password=sa;
The miraculous is, that in one projects it works but in the other not. Both old projects and the problem comes up with 20.1.701.4.
But if I add "Persist Security Info=true" to
Data Source=TestSQL;Initial Catalog=Test;User ID=sa;Password=xxxx;Persist Security Info=true
it works in both projects. So it seems to me that XPO/XAF deletes the password in one project and in the other not.
adding Persist Security Info=true
works for me also
XPO/XAF deletes the password in one project and in the other not.
i already mentioned to you previusly that the connectionstring is removed only from XAF and the SequenceGenerator does not use the XAF methods.
But since I cannot repro it I am unassigned for now
fyi
this the xaf code that removes the password from the XPObjectSpaceProvider
public String ConnectionString {
get {
IDataLayer dataLayer = this.dataLayer;
if(dataLayer != null && dataLayer.Connection != null) {
return dataLayer.Connection.ConnectionString;
}
return RemovePassword(dataStoreProvider.ConnectionString);
}
set {
SetDataStoreProvider(new ConnectionStringDataStoreProvider(value));
}
}
and the code that SequenceGenerator uses to get the connectionstring where we see that is ether from the connection or from the DataStoreProvider. So what is your DataStoreProvider? does by any chnace is to blame?
public static string GetConnectionString(this IObjectSpaceProvider objectSpaceProvider){
var connection = objectSpaceProvider.GetPropertyValue("DataLayer")?.GetPropertyValue("Connection");
return (string) (connection != null ? connection.GetPropertyValue("ConnectionString")
: ( objectSpaceProvider.GetPropertyValue("DataStoreProvider")).GetPropertyValue("ConnectionString"));
}
It runs with the add "Persist Security Info=true" and I can see no difference to other projects. So we can close the task.
If I connect ta Database with a connectionstring not based on SSPI I got an Error on SequenceGeneratorService.cs:Zeile 277
If you connect with SSPI there is no error. Maybe the password in the connectionstring is lost?
SequenceGeneratorService.cs:
The error occurred:
bei System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager) bei System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) bei System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions) bei System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource
1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) bei System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource
1 retry, DbConnectionOptions userOptions) bei System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 retry) bei System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource
1 retry) bei System.Data.SqlClient.SqlConnection.Open() bei DevExpress.Xpo.DB.MSSqlConnectionProvider.CreateDataBase(IDbConnection conn) ClientConnectionId:d455f5f8-d7c7-42bc-877a-fd42829af5ef Fehlernummer (Error Number):18456,Status (State):1,Klasse (Class):14' Data: 0 entries Stack trace:bei DevExpress.Xpo.DB.MSSqlConnectionProvider.CreateDataBase(IDbConnection conn) bei DevExpress.Xpo.DB.MSSqlConnectionProvider.CreateDataBase() bei DevExpress.Xpo.DB.ConnectionProviderSql..ctor(IDbConnection connection, AutoCreateOption autoCreateOption) bei DevExpress.Xpo.DB.MSSqlConnectionProvider..ctor(IDbConnection connection, AutoCreateOption autoCreateOption) bei DevExpress.Xpo.DB.MSSqlConnectionProvider.CreateProviderFromString(String connectionString, AutoCreateOption autoCreateOption, IDisposable[]& objectsToDisposeOnDisconnect) bei DevExpress.Xpo.XpoDefault.GetConnectionProvider(String connectionString, AutoCreateOption defaultAutoCreateOption, IDisposable[]& objectsToDisposeOnDisconnect) bei DevExpress.Xpo.XpoDefault.GetDataLayer(String connectionString, XPDictionary dictionary, AutoCreateOption defaultAutoCreateOption, IDisposable[]& objectsToDisposeOnDisconnect) bei DevExpress.Xpo.XpoDefault.GetDataLayer(String connectionString, XPDictionary dictionary, AutoCreateOption defaultAutoCreateOption) bei Xpand.XAF.Modules.SequenceGenerator.SequenceGeneratorService.<>c__DisplayClass34_0.b_0() in D:\a\1\s\src\Modules\SequenceGenerator\SequenceGeneratorService.cs:Zeile 277.
bei System.Reactive.Linq.ObservableImpl.Defer`1..Run() in /_/Rx.NET/Source/src/System.Reactive/Linq/Observable/Defer.cs:Zeile 38.