Base solution for your next web application

Activities of "namaro"

var task = Task.Run(async () => await SendEmail(solicitud, tipoDeLaSolicitud));

I want to send an email in the background so that the user doesn't need to wait for the email to be sent.

In order to achieve this I have run a Task.Run() for the process runs in the background and not in the same thread. When SendEmailSolicitanteAsync calls GetUserDomainByUserName and finishes is jumping to MultiDbContextConnectionStringResolver.GetNameOrConnectionString method causing an object null reference exception and crashing the program. I don't understand why is jumping to that context because I'm not doing interacting with the database.

Please help and thank you before hand.

private async Task SendEmail(Solicitud solicitud, TipoSolicitud tipoDeLaSolicitud)
{
    Logger.Info("Evento crear una solicitud fue ejecutado.");

    await _solicitudEmailer.SendEmailSolicitanteAsync(solicitud.EmailSolicitante,
        tipoDeLaSolicitud.Nombre,
        solicitud.CodigoSolicitud,
        solicitud.Aprobadores.Split(","), true);
}

public async Task SendEmailSolicitanteAsync(string to, string tipoSolicitud, string codigoSolicitud, string[] aprobadores, bool appendLinkUrl)
{
    var tasks = aprobadores.Select(aprobador => _userDomainAppService.GetUserDomainByUserName(aprobador));
    var listAprobadores = await Task.WhenAll(tasks);
    // more code but it is not necessary for me to put it
}

public async Task<UsersDomain> GetUserDomainByUserName(string userName)
{
    UsersDomain userDomain = null;
    var response = await _clientHttp.GetAsync(_urlGetUser + userName);

    if (response.IsSuccessStatusCode)
    {
        userDomain = await response.Content.ReadAsAsync<UsersDomain>();
    }

    return userDomain;
}

public class MultiDbContextConnectionStringResolver : DefaultConnectionStringResolver
{
    private readonly IAbpStartupConfiguration _configuration;
    
    public MultiDbContextConnectionStringResolver(IAbpStartupConfiguration configuration)
        : base(configuration)
    {
        _configuration = configuration;
    }

    public override string GetNameOrConnectionString(ConnectionStringResolveArgs args)
    {
        if (args["DbContextConcreteType"] as Type == typeof(SICIDbContext))
        {
            // var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());
            return (string)_configuration.Get(TestConsts.ConnextionStringNameSici);
            // configuration.GetConnectionString(TestConsts.ConnextionStringNameSici);
        }

        return base.GetNameOrConnectionString(args);
    }
}

We have choose ASPNETZERO as our application development framework. We want to have one modular front-end (Angular JS) as a back office, and multiples back-end (webapi) to interacting with the different modules. We want to centralize the security using IdentityServer, it will act as the controller. ASPNETZERO security will serve as role/permission handler. We have Windows Authentication for internal users, UserName/Password for external users and WebApi.

Have you guys done something like this? There is a way in ASPNETZERO to accomplish this?

Thanks @alper, I fixed the internet connection, now i see my api from my emulator browser, but I have another problem with the CrossConnectivity plugging, the property IsConnected is always false

Question

I have created project with the name "Test" and it appears in the download's list. I want to know if this count as project. I will like to see what is my current project count ? Thanks in advance

I've been guided by the documentation, but in the same way the application launches the following: "Without an Internet connection, do you want to enable Internet and try again?"

I change the IP address as the documentation tells me, but the application starts in the same way. I'm a junion in xamarin form programmer and I need help with this, thanks

Showing 1 to 5 of 5 entries