Base solution for your next web application
Open Closed

Auto-Tenant Selection #1454


User avatar
0
thomas created

Hi,

Setup is for Multi-Tenancy:
I´m trying to remove the tenant from the login view, so that the user only need to insert email and password.
The application should know the tenant by the user-email.

I tried the following steps:

  1. get all users

  2. find user by email

  3. if ONE user was found, continue with login function

private async Task.AbpLoginResult> GetLoginResultAsync(string usernameOrEmailAddress, string password, string tenancyName)
        {
            // try to get all user
            string sqlCommand = "SELECT * FROM USER";
            ObjectQuery query = new ObjectQuery(sqlCommand, context , MergeOption.NoTracking);

            var loginResult = await _userManager.LoginAsync(usernameOrEmailAddress, password, tenancyName);
            
          //....Login-Code

The problem is, that ObjectQuery needs an context object - from where I can use the context object?

Is there a better way to implement this function/way?

Thanks,
Thomas


1 Answer(s)