Base solution for your next web application

Activities of "khai"

Hello, The error appears at runtime (it means I can compile it successfully). Is that a bug?

thx we want to have the calendar features on new metronic theme.

hi, we are working on project which need features of new metronic theme v5.x with angular 4, no sure when it live?

hi, I am also waiting for V5 as our project need features of V5. hope that you release ASAP. not sure if it will be available next Monday, 20 Nov?

Hello, these are my files.

1. AppUrlServiceBase

public abstract class AppUrlServiceBase : IAppUrlService, ITransientDependency
    {
        public abstract string EmailActivationRoute { get; set; }

        public abstract string PasswordResetRoute { get; set; }

        protected readonly IWebUrlService WebUrlService;
        protected readonly ITenantCache TenantCache;

        protected AppUrlServiceBase(IWebUrlService webUrlService, ITenantCache tenantCache, IConfigurationRoot appConfigurationRoot)
        {
            WebUrlService = webUrlService;
            TenantCache = tenantCache;
            this.Initialize(appConfigurationRoot);
        }

        private void Initialize(IConfigurationRoot appConfigurationRoot)
        {
            EmailActivationRoute = appConfigurationRoot["WebUIConfig:EmailActivationRoute"];
            PasswordResetRoute = appConfigurationRoot["WebUIConfig:PasswordResetRoute"];
        }

        public string CreateEmailActivationUrlFormat(int? tenantId)
        {
            return CreateEmailActivationUrlFormat(GetTenancyName(tenantId));
        }

        public string CreatePasswordResetUrlFormat(int? tenantId)
        {
            return CreatePasswordResetUrlFormat(GetTenancyName(tenantId));
        }

        public string CreateEmailActivationUrlFormat(string tenancyName)
        {
            var activationLink = WebUrlService.GetSiteRootAddress(tenancyName).EnsureEndsWith('/') + EmailActivationRoute + "?userId={userId}&confirmationCode={confirmationCode}";

            if (tenancyName != null)
            {
                activationLink = activationLink + "&tenantId={tenantId}";
            }

            return activationLink;
        }

        public string CreatePasswordResetUrlFormat(string tenancyName)
        {
            var resetLink = WebUrlService.GetSiteRootAddress(tenancyName).EnsureEndsWith('/') + PasswordResetRoute + "?userId={userId}&resetCode={resetCode}";

            if (tenancyName != null)
            {
                resetLink = resetLink + "&tenantId={tenantId}";
            }

            return resetLink;
        }


        private string GetTenancyName(int? tenantId)
        {
            return tenantId.HasValue ? TenantCache.Get(tenantId.Value).TenancyName : null;
        }
    }

2. AngularAppUrlService

public class AngularAppUrlService : AppUrlServiceBase
    {
        public override string EmailActivationRoute { get; set; }

        public override string PasswordResetRoute { get; set; }

        public AngularAppUrlService(
                IConfigurationRoot appConfigurationRoot,
                IWebUrlService webUrlService,
                ITenantCache tenantCache
            ) : base(
                webUrlService,
                tenantCache,
                appConfigurationRoot
            )
        {
            
        }
    }

3. MvcAppUrlService (I don't see this file)

4. NullAppUrlService

public class NullAppUrlService : IAppUrlService
    {
        public static IAppUrlService Instance { get; } = new NullAppUrlService();

        private NullAppUrlService()
        {
            
        }

        public string CreateEmailActivationUrlFormat(int? tenantId)
        {
            throw new NotImplementedException();
        }

        public string CreatePasswordResetUrlFormat(int? tenantId)
        {
            throw new NotImplementedException();
        }

        public string CreateEmailActivationUrlFormat(string tenancyName)
        {
            throw new NotImplementedException();
        }

        public string CreatePasswordResetUrlFormat(string tenancyName)
        {
            throw new NotImplementedException();
        }
    }

For the first question, after I added setter to both of the override fields, I see that the instance of AppUrlService is NullAppUrlService and I cannot use it. Please help me to figure out that.

Hello,

I am trying to config two things which are relevant to IConfigurationRoot to get config inside AppSettings.json.

  1. I want to inject IConfiguration to file AngularAppUrlService.cs. However, those fields are read-only therefore I cannot assign new value to it.

  2. I implement new class for Email Sender Service and I put it outside ASPNETZero Sourcecode. However, I cannot inject IConfigurationRoot to my class. I got this error.

Please help me to archive this. Thank you

Showing 21 to 27 of 27 entries