I'm using the SecuritySystem in a non Xaf Win application. My application is like a console used by the user to connect to different system with different account.
So it is multi user and each user has a dedicated connection, session and a dedicated security system which could be connected to different databases.
My question is about SecuritySystem.Instance, since the property istance is static, it is shared by all user accounts and it is not correct behavior in my scenario. Is there a way to not use the static instance?
Thank you for contacting us. The SecuritySystem.Instance property returns a value obtained from the ValueManager class. This architecture allows us to use the same code in applications based on different platforms - WinForms, ASP.NET, WCF. For instance, ASPSessionValueManager stores values in HttpSessionState, so each user has its own value storage.
>> each user has a dedicated ..., session
You can create your own ValueManager based on the session, implement the IValueManager interface, and register your class using the static ValueManager.ValueManagerType property at the application startup.
ValueManager.ValueManagerType = typeof(MultiThreadValueManager<>).GetGenericTypeDefinition();
For more information on MultiThreadValueManager, refer to About MultiThreadValueManager and https://search.devexpress.com/?q=MultiThreadValueManager&m=SupportCenter
Additionally research this and other default implementations within the XAF source code: HttpContextValueManager, WcfInstanceContextValueManager, SimpleValueManager, ASPSessionValueManager.
I must emphasize that these APIs are internal and undocumented and can be changed without notice in the future.