aspnet-core, angular: 5.4.1 I have a column in my database with a boolean data type, "IsPostedToServer". I have a nullable bool in my DTO, "IsPostedToServer". My REST endpoint receives a null, true, or false value. When converting my query to a list I use the following statement:
.WhereIf(input.IsPostedToServer != null, e => e.NcFormSubmission.IsPostedToServer == input.IsPostedToServer)
Null returns everything, as it should but true and false both return nothing. Can anyone tell me what is wrong with my code?
One for Aaron, I think. First, when an entity has a guid for primary key why do we place quotation marks around the string which is entered into the AbpEntityChanges.EntityId field? This causes all kinds of problems when trying to join data. Is it deliberate by design and if so, why? More importantly, if I have a parent-child table relationship and the child is fully audited and subject to entity history how do I retrieve all entity changes for children of the parent? I am trying to return entity changes for a given entity (say, Customer) and for all entities related as children to the same entity (say, CustomerOrder etc). Given the current design of the system I am not sure if that is possible. I have noticed that when a child table is updated the first entry in the AbpEntityChanges for the entity change set contains a reference to the parent table with no property change collection. After this entry we have the actual property changes to the child table. Is there any way this design can be used to return a entity history for a given entity including all child tables?
BTW - I am really enjoying working with the entity history system, thanks for all your efforts.
aspnet-core, angular 5.4.1 I am getting no entries from method AppAuthenticate in AppTokenAuthController. I have made the method virtual as per the documentation and added the [Audited] decorator but the login is not registered with the AuditLogStore.
How do I audit logins with the Zero framework?
In my [Projectname]CoreModule I replace IEntityHistoryStore with MongodbEntityHistoryStore:
Configuration.ReplaceService<IEntityHistoryStore, MongodbEntityHistoryStore>(DependencyLifeStyle.Transient);
. I implement MongodbEntityHistoryStore in the Core project:
using Abp.Dependency;
using Abp.Domain.Repositories;
using Abp.EntityHistory;
using Abp.Timing;
using MongoDB.Bson;
using MongoDB.Driver;
using Nuagecare.Mongodb;
using Nuagecare.MultiTenancy;
using System;
using System.Threading.Tasks;
namespace Nuagecare.App.Mongodb
{
/// <summary>
/// Implements <see cref="IEntityHistoryStore"/> to save entity change informations to Mongodb.
/// </summary>
public class MongodbEntityHistoryStore : IEntityHistoryStore, ITransientDependency
{
private readonly IRepository<EntityChangeSet, long> _changeSetRepository;
private readonly TenantManager _tenantManager;
/// <summary>
/// MongodbEntityHistoryStore
/// </summary>
public MongodbEntityHistoryStore(
IRepository<EntityChangeSet, long> changeSetRepository,
TenantManager tenantManager)
{
_changeSetRepository = changeSetRepository;
_tenantManager = tenantManager;
}
public async Task SaveAsync(EntityChangeSet changeSet)
{
var mongoClient = new MongodbConfig().Initialize();
IMongoDatabase db = mongoClient.GetDatabase(await GetTenancyNameFromTenantId(Convert.ToInt32(changeSet.TenantId)));
var collection = db.GetCollection<BsonDocument>("entityChangeSets");
var document = changeSet.ToBsonDocument();
document.Set("_id", ObjectId.GenerateNewId());
document.Set("CreationTime", Clock.Now);
await collection.InsertOneAsync(document);
}
private async Task<string> GetTenancyNameFromTenantId(int tenantId)
{
var tenant = await _tenantManager.FindByIdAsync(tenantId);
if (tenant == null)
{
return "Projectname";
}
return tenant.TenancyName;
}
}
}
This works great, my entity history data is now in Mongodb and all of my tenants have their own Mongodb database (user rights are set during the create tenant method). Now I need to read the data so I copy the code for AuditLogAppService and refactor it as MongodbAuditLogAppService which is placed in my Application project. I try register my new service in [Projectname]ApplicationModule:
IocManager.Register<IAuditLogAppService, MongodbAuditLogAppService>(DependencyLifeStyle.Transient);
, rebuild, run swagger, but the app still goes to AuditLogAppService. I have also tried register in [Projectname]WebHostModule to no avail.
What do I need to do to register and inject MongodbAuditLogAppService instead of Zero's standard AuditLogAppService?
aspnet-core, angular; 5.4.1 I downloaded the latest version of my source to a laptop. I am getting "You have to be inside an angular-cli project in order to use the serve command." when inside the angular project and running any ng command from the terminal. I have updated @angular/cli globally to 6.0.8 (npm install -g @angular/cli@latest). I have installed the latest @angular/cli in the project (npm install @angular/cli@latest). I have uninstalled and re-installed several times, running yarn in between, and rebooted also. My package.json file looks as follows (for devDependencies -
"devDependencies": {
"@angular-devkit/build-angular": "~0.6.0",
"@angular/cli": "^6.0.8",
"@angular/compiler-cli": "6.0.0",
ng -v gives me the following:
angular-cli: 1.0.0-beta.28.3
node: 8.11.3
os: win32 x64
@angular/animations: 6.0.0
@angular/common: 6.0.0
@angular/compiler: 6.0.0
@angular/core: 6.0.0
@angular/forms: 6.0.0
@angular/http: 6.0.0
@angular/platform-browser: 6.0.0
@angular/platform-browser-dynamic: 6.0.0
@angular/platform-server: 6.0.0
@angular/router: 6.0.0
@angular/cli: 6.0.8
@angular/compiler-cli: 6.0.0
I can run the project with npm start but I can not run ng serve or ng build. Any ideas anyone?
If my understanding is correct settings are only persisted should they differ from default values declared in your settings provider. I really don't think this is good practise, it may be necessary to read the database for analytics and debugging purposes. The system has to read the database to see if it holds the default value, why then delete it?
Surely settings should be persisted at all times?
dotnet-core, angular, 5.4.1 Hi all, Can anyone point me in the direction of documentation and/or code for token expiration dates? I use an Ionic app to log into Zero.
How long is the token valid for? How does sliding expiration work?
I know this is probably off-piste for Zero and more of a dotnet question but I have looked both in the code base and in the documentation and can find no detail of how to test both the expiration data and sliding expiration. Thanking you in advance....
Did I see a discussion somewhere here or in github (I have searched both) with regard to entities belonging to multiple OrganizationUnits? If so, could someone point me to it? Given the interfaces IMayHaveOrganizationUnit/IMustHaveOrganizationUnit how does one go about implementing such a pattern? Are there any guidelines anywhere?
Hi guys, I ran all tests and almost all failed with the message "Message: Castle.MicroKernel.ComponentNotFoundException : No component for supporting the service Abp.Organizations.OrganizationUnitManager was found". It's a while since I ran tests so I'm not sure what's changed, I was fully expecting some to fail due to changes I have made to core Zero code but this seems to be an entirely different problem. Can anyone point me in the right direction? I am not fully conversant with how the Tests project is put together and in the past I have simply run it and then modified tests to reflect changes to core code and new tests for my own code. Can anyone point me in the right direction?
I am sure I have seen a post here or on the github site about implementing a Mongodb driver for entity history functionality. I have searched but can not find anything. My Azure database is growing too fast with the insertions into the three entity history tables. I would like to cut into the code and push all entity history entries into Mongodb. Does anyone have any pointers on how to do this?