Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "fastsoft"

Hi!.

how can I get the phone format of the selected language. I want to use for input mask in angular.

Hi!

I created custom session class. And ı can call it in my services. i can get session property value when i set add claim at TokenAuthController.cs>Authenticate methot.(loginResult.Identity.AddClaim(new Claim("Application_ActiveSchoolName", "High Trade School"))).

But i can't get value when i set value in any service methot.

FastAppSession.cs

public class FastAppSession : ClaimsAbpSession, ITransientDependency
    {
        public FastAppSession(
        IPrincipalAccessor principalAccessor,
        IMultiTenancyConfig multiTenancy,
        ITenantResolver tenantResolver,
        IAmbientScopeProvider<SessionOverride> sessionOverrideScopeProvider) :
        base(principalAccessor, multiTenancy, tenantResolver, sessionOverrideScopeProvider)
        {

        }

        public string ActiveSchoolName
        {
            get
            {
                var activeSchoolName = PrincipalAccessor.Principal?.Claims.FirstOrDefault(c => c.Type == "Application_ActiveSchoolName");
                if (string.IsNullOrEmpty(activeSchoolName?.Value))
                {
                    return null;
                }

                return activeSchoolName.Value;
            }
            set
            {
                ((ClaimsIdentity)PrincipalAccessor.Principal?.Identity).AddClaim(new Claim("Application_ActiveSchoolName", value));
            }
        }
    }

OgrenciAppService.cs

public class OgrenciAppService : OKYSFastAppServiceBase, IOgrenciAppService
    {
        private IRepository<VOgrenciInfo> _ogrenciRepository;

        public OgrenciAppService() : base()
        {
            _ogrenciRepository = new Repository<VOgrenciInfo>();
        }
        //Methods
        [HttpPost]
        public async Task<PagedResultDto<VOgrenciInfo>> GetData(FGetEntityExpression searchParams)
        {

            string test = FastAppSession.ActiveSchoolName; //it return null every calling

            FastAppSession.ActiveSchoolName = "High Trade School";

            test = FastAppSession.ActiveSchoolName; //it return setting value one time.

            return await _ogrenciRepository.GetDataWithPaging(searchParams);
        }
}
Showing 1 to 2 of 2 entries