You need to define foreign key, by convention:
public class Policy : Entity<long>, IMustHaveTenant
{
public int TenantId { get; set; }
public ClonedPolicyDefinition CreatedFrom { get; set; }
public long CreatedFromId { get; set; }
}
Resolved here: #4101@346344f6-15e8-4523-9b12-bb98907bebc3
Running
dotnet build
from the command line in the public project folder will fix this.
That's not a common behavior, but you might be able to achieve that by doing:
public virtual void MyMethod()
{
//...
_repository.Insert(entity);
_unitOfWorkManager.Current.SaveChanges(); // Tracking state is EntityState.Added
entity.LastModificationTime = entity.CreationTime; // Change tracking state to EntityState.Modified; will be overwritten
_unitOfWorkManager.Current.SaveChanges();
// Check that entity.LastModifierUserId is set
// ...
}
If you want this for all entities, override ApplyAbpConceptsForAddedEntity in MyDbContext:
protected override void ApplyAbpConceptsForAddedEntity(EntityEntry entry, long? userId, EntityChangeReport changeReport)
{
base.ApplyAbpConceptsForAddedEntity(entry, userId, changeReport);
SetModificationAuditProperties(entry.Entity, userId);
}
Did you try this?
- Try commenting out this line: await _userManager.UpdateAsync(user);
See this answer: <a class="postlink" href="https://stackoverflow.com/a/45816317/8601760">https://stackoverflow.com/a/45816317/8601760</a>
You are right. Please follow this issue for updates: https://github.com/aspnetzero/aspnet-zero-core/issues/504
It was set to true in v4.6.0 (as per my original reply) and in the current v4.6.1.
Override and use [ColumnName] attribute:
public class MyFullAuditedEntity : FullAuditedEntity
{
[ColumnName("InputUN")]
public override long? CreatorUserId { get; set; }
[ColumnName("InputTime")]
public override DateTime CreationTime { get; set; }
}
That's because you resolve CustomerAppService directly in Resolve(typeof(CustomerAppService)). See restrictions of AbpAuthorize attribute: https://aspnetboilerplate.com/Pages/Documents/Authorization#abpauthorize-attribute-notes
You need to:
private async Task ImportData(DataImportJobArgs dataImportJobArgs)
{
// var userId = ...
// var tenantId = ...
using (_session.Use(userId, tenantId))
{
ImportAppService = (IImportAppService)IocManager.Instance.Resolve(typeof(ICustomerAppService));
await ImportAppService.ImportData(dataImportJobArgs.DataToImport, false);
}
}