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

Activities of "codenewa"

From the documentation, it seems that the background jobs are retried for up to 2 days which is the default timeout.

  1. Is there a way to cancel the job in case of exceptions?
  2. How do I get the identifier for the current BackgroundJob<TJobArgs> which is being executed?
  3. Also, how can I push the exceptions from a background job into the audit logs?

In my application, I have two entities Attribute and Package which have a many to many relationship. So, I have a PacakgeAttribute entity which is a FullAuditedEntity

public class PackageAttribute: FullAuditedEntity{
...
}

public class Package: FullAuditedEntity{
  public IList<PackageAttribute> PackageAttributes{get;set;}
}

In this code, I cannot remove a PackageAttribute by doing:

package.Attribute.Remove(packageAttribute);
pacakgeRepository.UpdateAsync(package)

This throws error:

The relationship could not be changed because one or more of the foreign-key properties is non-nullable. When a change is made to a relationship, the related foreign-key property is set to a null value. If the foreign-key does not support null values, a new relationship must be defined, the foreign-key property must be assigned another non-null value, or the unrelated object must be deleted.

However, I cannot make the relationship an identifying relationship, as it is a soft delete.

I tried including the Id as a part of the composite key but the database does not set the id column as an identity column. (Could this be an issue?)

So, I ended up using IRepository<PackageAttribute> to remove the packageAttribute by calling DeleteAsync() method.

Am I missing something? Or, is this how it is supposed to be done?

Thank you that worked.

I have an entity Location which is associated to the Tenant entity via association class TenantLocation. I need to track changes to TenantLocation, so I have set it to inherit from FullAuditedEntity.

Tenant has a property IList<TenantLocation> TenantLocations.

<ins>Issue 1</ins>: When I add a TenantLocation, the CreatorId is not populated for the TenantLocation Record.

<ins>Issue 2</ins>: Unless I go through a IRepository<TenantLocation>, I cannot remove a tenant location. When I attempt that I get an error: <span style="color:#FF0000">"The operation failed: The relationship could not be changed because one or more of the foreign-key properties is non-nullable. When a change is made to a relationship, the related foreign-key property is set to a null value. If the foreign-key does not support null values, a new relationship must be defined, the foreign-key property must be assigned another non-null value, or the unrelated object must be deleted."</span>. Seems like I have to update the Association record one by one. So, when I use the repository, the error goes away but it does not populate DeleterUserId.

Scenario:

In the application, the host creates entities: Package1, Package2. There are Tenants => Tenant1, Tenant2 Host assigns packages to tenants. So, we have tenantpackages: TP1 => Tenant1+Package1 for Tenant 1 TP2 => Tenant1+Package2 for Tenant 1 TP3 => Tenant2+Package1 for Tenant 2

Tenant1 also creates a new package: Package3 which will create a tenantPackage entity (TP4=> Tenant1+Package3).

Here, Tenant1 has full control over Package3. But neither Host nor Tenant2 are able to see Package3. So, Host won't be able to create a tenantpackage (TP5) such that TP5= Tenant2+Package3.

To allow for this, I was thinking following.

  1. Package will be IMayHaveTenant because it can be created by both Host and Tenants, but only the creator can update them.
  2. TenantPackage will be IMustHaveTenant because it needs to have a tenant and other tenants shouldn't see it.

Am I going in the wrong direction?

I'm currently working on a multi-tenant application where the host admin can create data that can be consumed by the users in the tenants. However, the data created by the tenants would not be available to other tenants.

I think that the IMayHaveTenant interface can be used to make allow the data created by the host to be consumed by the tenants. Is that correct?

Thank you for the guidance.

I'm looking at it now. But I'm not sure how to query across the tenants. Do you have documentation on that?

Thank you. I'll take a look at it.

You mentioned before that there might be some issues when we set the tenantid after completing the authentication. Can you tell me what they are?

Currently, there are two ways of logging into the system for the multi tenant applications.

  1. Use subdomain routing to identify the tenant.
  2. If we do not use subdomains for routing, then the user has to provide the tenancy name on the login screen to identify the tenant.

We want to be able to login to the application from the same login screen. Since the user is tied to a tenant, it should be possible to set the tenant after authenticating the user. Is that right?

We don't plan on using separate databases for the tenants.

Is it possible to set the tenantId after the user has logged in?

Showing 11 to 20 of 25 entries