Hi
but in this we my DLL is strict dependent from ABP version. I see that in Core version the shared dll is not a module, is it correct?
@demirmusa
Yes I do it on my base module and works fine.
@ismcagdas
I try to implement the example that has suggested but it doesn't work, but I check on Windsor docs at Select() and I see the correct implementation.
So the problem is related to the name because to registrer class with different name than the interface I use this code
public class ReportConventionalRegistrar : IConventionalDependencyRegistrar
{
public void RegisterAssembly(IConventionalRegistrationContext context)
{
context.IocManager.IocContainer.Register(
Classes.FromAssembly(context.Assembly)
.BasedOn<IReportData>()
.If(type => !type.GetTypeInfo().IsGenericTypeDefinition)
.WithService.Self()
.WithService.Base()
);
}
}
Hi @ismcagdas
sorry I forget to add the framework used. ASPNETZERO AngualrJS. It try to look your suggestion and I uppdate you.
Thanks
@ismcagdas
I open a issue on Git I try to fix it localy if it works I send a PR to NSwag. So has you try to use TypeScript with ABP AngularJs? Beacuse i try to move to TS our solution but is not quite simple integrate on ABP. My road map is:
I think is the only way to upgrade to .NetCore
Hi @ismcagdas
I can't test this week beacuse I don't have time to do it. I plan to do next week and I give you an update ASAP.
Hi @aaron
I complete the integration with my custom session (ABP MVC + ZERO ver 6.6.1). During test I use a single tenant but after move to production we see a strnge situation in some case our session change the value from user to use, this happen because we use the AppSessionAppService to inject our session and any use call this method (login or F5) the session change with the lastest one.
I search the correct place to put my custom session and I found it in UserManager
public override async Task<ClaimsIdentity> CreateIdentityAsync(User user, string authenticationType)
{
var identity = await base.CreateIdentityAsync(user, authenticationType);
using (var uo = _unitOfWorkManager.Begin())
{
_unitOfWorkManager.Current.SetTenantId(user.TenantId);
// Read Company for user from db
var companyId = await _settingManager.GetSettingValueForUserAsync<long>("userSettings.CompanyId",
user.TenantId, user.Id);
identity.AddClaim(new Claim(CustomClaim.ClaimCompany, companyId.ToString()));
uo.Complete();
}
return identity;
}
In this way my user has correct value on every roundtrip.
The only problem is when I need to change the value of my session data and is not allowed so I need to force a signIn & signOut
User user;
ClaimsIdentity identity;
using (var uo = _unitOfWorkManager.Begin())
{
user = await ClayUserManager.FindByIdAsync(AbpSession.UserId.Value);
identity = await ClayUserManager.CreateIdentityAsync(user,
DefaultAuthenticationTypes.ApplicationCookie);
uo.Complete();
}
I need to use UOW beacuse in code above set the new value on DB. So in that way I can use my custom sassion
public interface IMySession : ITransientDependency
{
long? CompanyId { get; }
}
And the implementation is
//// Take care of name to use auto registration path MySession -> IMySession
public class MySession : ClaimsAbpSession, IMySession
{
public MySession(
IPrincipalAccessor principalAccessor,
IMultiTenancyConfig multiTenancy,
ITenantResolver tenantResolver,
IAmbientScopeProvider<SessionOverride> sessionOverrideScopeProvider) :
base(principalAccessor, multiTenancy, tenantResolver, sessionOverrideScopeProvider)
{
}
public long? CompanyId
{
get
{
var company = PrincipalAccessor.Principal?.Claims.FirstOrDefault(c => c.Type == appConsts.ClaimCompany);
if (string.IsNullOrEmpty(company?.Value))
{
return null;
}
return System.Convert.ToInt64(company.Value);
}
//...
}
}
Now all data is stored on claim and user filter company works fine based on session value.
I hope this explanation can be useful for other user.
@aaron thank for the calrification but if I call from my web site after debug restart I found data in my AbpSession, so some method call AbpSession to reload it (like when you do the login or do a reload page) I need to identify this event and add my logic to restore my data from DB
@aaron my test work fine and mY custom session do what I need.
So know I found an issue, during debugging. If I restart the debug session my custom will be lost until I redo a F5 on my browser. When I do that ABP call SessionAppService and in GetCurrentLoginInformations I reset the data for my custom session.
The same happen on login in account controller. But if I don't do a F5 AbpSession is populate (I read the abpSession is on cookie) but my session no wich is the entrt point where abpsession is restored from cookies?
Yes