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

Activities of "rickfrankel"

Ok thanks for that hint. I wasn't but I will.

I have found the cause of the issue. Complex and I'm not entirely sure it is intended behaviour but I understand it now.

  1. The notificationpublisher code has these lines in it. So even if you pass null or empty for the tenant Id's in your notification the publisher will add in the current logged in session one (which in my case is an actual tenant and not the host account).

       if (tenantIds.IsNullOrEmpty() && userIds.IsNullOrEmpty())
       {
           tenantIds = new[] { AbpSession.TenantId };
       }
    
  2. Then there is this code in the DefaultNotificationDistributor, before the call to the _notificationStore.GetSubscriptionsAsync. If this check passes then it will call the GetSubscriptionsAsync that has the disabling of the filters. If this check DOESN'T pass then it will use the tenant ID passed into it and not disable the filter. if (tenantIds.IsNullOrEmpty() || (tenantIds.Length == 1 && tenantIds[0] == NotificationInfo.AllTenantIds.To<int>())) {

Solutions:

  1. If you want to send a notification from a tenant to the HOST only then switch to the host context before publishing the notification (using (_unitOfWorkManager.Current.SetTenantId(null))

  2. If you are publishing a notification from a tenant and want to send it to any tentant or host subscribed to that particular notification name then set the tenantID to NotificationInfo.AllTenantIds (which is 0).

Got love digging through the ABP Code :)

Cheers to anyone else who comes across this.

Rick

I agree you can upgrade, just wanted people to know that it broke lots of my code.

The workaround is to install entityframework pre-release nuget packges into the web.host project.

I don't use a lot of automapper and make use of a lot of LINQ to map to my models.

Eg lots of this style of code.

repo.GetAll() .Include( => .SomeFK) .Where( => .Name == "Name") .Select( => new ModelIWantToReturn { Prop1 = _.Name, Prop2 = _.Description Prop3 = _.SomeFk.Any(x => x.IsActive) );

That kind of code above pretty much broken in EF Core 3.0 and you need the pre-release version to make it work again.

I had about 3 or 4 failures that worked in EF 2.0 that broke in EF Core 3.0 and worked straight away once I got the pre-release version in.

So it was more a warning to people who have bigger projects than I. If you have lots of LINQ style code be prepared it may not work in EF Core 3.0 without the 3.1 pre-release.

Thanks

Ok problem solved and it was me being an idiot :)

You have to do this to ensure it disables the filters for AbpUsers using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.MustHaveTenant, AbpDataFilters.MayHaveTenant))

And NOT just using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.MustHaveTenant))

Because the host user has no tenant ID the tenantID in the AbpUsers table is nullable and thus only MayHaveTenant. It was working for all my other foreign keys as they were all MustHaveTenant.

Thanks all.

Note that the full table below isn't represented but the key parts are I believe.

It has the constraint in place to the abpusers table. (Note I'm using MySql). All my other foreign key constraints work perfectly. Tenant has no issue. Just Users.

This is the only place I've had another foreign key to Users before like this. Other than the ones provided by the Auditing interfaces.

CREATE TABLE orders ( Id int(11) NOT NULL AUTO_INCREMENT, CreationTime datetime(6) NOT NULL, CreatorUserId bigint(20) DEFAULT NULL, LastModificationTime datetime(6) DEFAULT NULL, LastModifierUserId bigint(20) DEFAULT NULL, IsDeleted bit(1) NOT NULL, DeleterUserId bigint(20) DEFAULT NULL, DeletionTime datetime(6) DEFAULT NULL, TenantId int(11) NOT NULL, OrderNumber varchar(255) DEFAULT NULL, OrderDate datetime(6) NOT NULL, Completed bit(1) NOT NULL, CompletedById bigint(20) DEFAULT NULL, Canceled bit(1) NOT NULL, CanceledById bigint(20) DEFAULT NULL, PRIMARY KEY (Id), UNIQUE KEY IX_Orders_OrderNumber (OrderNumber), KEY IX_Orders_CanceledById (CanceledById), KEY IX_Orders_CompletedById (CompletedById), KEY IX_Orders_TenantId (TenantId), CONSTRAINT FK_Orders_AbpTenants_TenantId FOREIGN KEY (TenantId) REFERENCES abptenants (Id) ON DELETE CASCADE, CONSTRAINT FK_Orders_AbpUsers_CanceledById FOREIGN KEY (CanceledById) REFERENCES abpusers (Id) ON DELETE RESTRICT, CONSTRAINT FK_Orders_AbpUsers_CompletedById FOREIGN KEY (CompletedById) REFERENCES abpusers (Id) ON DELETE RESTRICT, ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

Cheers Rick

[rows] is the answer. That was what caused the issue.

Thanks

I'm also having the same issue. It appears to be a known issue with .net core and chrome. https://github.com/aspnet/AspNetCore/issues/4398#issuecomment-452548971

It was meant to be fixed but appears not. I'm yet to try and the workaround everyone mentions but suspect that might be the way to go.

Would be good for this to be in the initial download if its the only way forward for now.

Answer

I have solved my own problem I think here. The issue is related to number 2 above.

After you delete all the migration files you need to clean your solution, rebuild it and then run add-migrations. This then added the correct initial migration file and away we go.

Showing 81 to 87 of 87 entries