I am using saving a FullyAuditedEntity as:
var spotifyChannel = new UserSalesChannel()
{
AccessToken = accessToken,
ChannelName = SalesChannelConst.Shopify,
ChannelDomain = shop
};
_salesChannelRepository.Insert(spotifyChannel);
and the function is decorated with [UnitOfWork]. When I check database, the audited columns(creatorUserId etc) are null.
I am calling this function as:
using (_session.Use(tenantId.ToInt(), userId.ToInt()))
{
await _shopifyManager.ValidateAndInstallHook(shop, code);
}
here tenantId is 2 and userId is 4. All the values are valid and AbpSession reflects correct values.
4 Answer(s)
-
0
Since you're in a unit of work that began without a tenant, you need to set that as well.
using (_session.Use(tenantId.ToInt(), userId.ToInt())) { using (_unitOfWorkManager.Current.SetTenantId(tenantId.toInt())) { await _shopifyManager.ValidateAndInstallHook(shop, code); } }
-
0
Hi @aaron,
I tried this solution but CreatorUserId and TenantId are still saved NULL in the database.
-
0
How is _shopifyManager.ValidateAndInstallHook implemented?
-
0
Hi @ajayak,
I think this problem is related to AbpSession.UserId & AbpSession.TenantId being null when you make a redirect to third party app and redirect back, right ?
If so, we must understand your redirect urls first to solve this problem. I have asked about it on your other forum post #3968
Thanks.