Hi,
I'm calling CurrentTenant.Change(existingTenant.Id) within a using statement an attempting to save a new record that belongs to the tenant. Unfortunately, the resulting record in the DB has null in the tenantId. What am I missing?
// Change Tenant
using (CurrentTenant.Change(existingTenant.Id))
{
// Create New Store
var newStore = new StoreCreateDto
{
ExternalId = storeName,
Name = storeName,
Timezone = ecomStore.Timezone
};
await _storesAppService.CreateAsync(newStore);
}
// Simplified Store Entity Below
public class Store : FullAuditedAggregateRoot<Guid>, IMultiTenant
{
public virtual Guid? TenantId { get; set; }
[NotNull] public virtual string Name { get; set; }
[CanBeNull] public virtual string ExternalId { get; set; }
// Etc
}
Any assistance would be appreciate.
Also, while I'm on the topic of switching tenants, what's the best way to manually locate a tenant (in situations where you can't use a resolver) . Is there a better way than this. Using GetList with a filter seems a but clunky.
// 1. Load existing Tenant
var existingTenant = (await _tenantAppService.GetListAsync(new GetTenantsInput { Filter = name})).Items.SingleOrDefault();
Thanks
Mat
Hi,
I'm using Entity Framework with SQL Server and am having a few issues with the relationships and the entities generated by abp suite.
For instance, I'd like to create a one-to-many between customer and address where the customer can have multiple addresses. I'd expect to see the Customer entity have a Collection navigation property (as below), but abp suite appears to create a one-to-one relationship with the navigation property defined in CustomerWithNavigationProperties. hHen I review the documentation for AggregateRoot Class it suggests my expected entity structure is correct. What am I doing wrong / missing?
Similarly, I'd like to create a one-to-one relationship between Customer and a second table MarketingStatus. I'd expect to see a Reference navigation property added to Customer entity but I can't seem to achieve this either.
public class Customer
{
public string FirstName { get; set; }
public string LastName { get; set; }
public List<Address> Addresses { get; set; }
public MarketingStatus MarketingStatus { get; set; }
}
Is this possible to achieve using entity generation using abp suite or do I need to defining these by hand. Can you assist?
Thanks
Mat