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

Activities of "rickfrankel"

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

Hi,

I have a custom entity that has multiple foreignkeys to user. Even after including them in the query they don't populate.

EG:

If I have an Order entity defined as (simplified for example)

[Table("Orders")] [Audited] public class Order : FullAuditedEntity, IMustHaveTenant {

    public int TenantId { get; set; }
    [ForeignKey("TenantId")]
    public virtual Tenant TenantFk { get; set; }
    public virtual bool Completed { get; set; }
    public virtual long? CompletedById { get; set; }

    [ForeignKey("CompletedById")]
    public virtual User CompletedByFk { get; set; }

    public virtual bool Canceled { get; set; }
    public virtual long? CanceledById { get; set; }

    [ForeignKey("CanceledById")]
    public virtual User CanceledByFk { get; set; }
}


When I load up the order using an IRepository<Order> and Include(_ => _.CompletedByFk) for example.  It never populates the CompletedByFk object, even though the CompletedById has a value and it maps to a valid row in that AbpUsers table.

Any thoughts?

Thanks
Rick

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

Thanks

Hi,

When using the RAD tool to generate UI for entities. The paging on the UI doesn't appear to work correctly.

ASP.NET CORE & Angular .NET Core 2.2 v7.1.0

It appears as tho the rows value is hard coded to 5. I've tried all sorts of methods to try and change it, but not having a lot of luck.

I've changed the rows= value in two spots in the html files and remove the hard coded setting of it to 5 in the .ts files.

Am I missing something? I want a default page size of 100. I've set this up and all existing pages are working fine, however any newly created ones with the RAD tool do not work.

Thanks Rick

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.

Question

Hi,

So I've followed the instructions here. https://aspnetboilerplate.com/Pages/Documents/EF-Core-MySql-Integration

My setup is based on ASP.NET CORE & Angular .NET Core 2.2 v7.1.0 However I had to do a few different things.

  1. BuildWebHost section was ignored as I don't believe that is used any more in .Net Core 2.2

  2. Initially I tried to delete all the migrations as the document mentions and then run add-migration Initial_Migration

    1. The problem with this is that the initial_migration class that is added had nothing in it and basically was useless.
  3. So I put all the migrations back from the downloaded package and tried to run them.

  4. There is an error with migrationBuilder.AddColumn<string>( name: "Discriminator", table: "AbpEditions", nullable: false, defaultValue: "");

            Failed executing DbCommand (7ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
    

ALTER TABLE AbpEditions ADD Discriminator longtext NOT NULL DEFAULT ''; MySql.Data.MySqlClient.MySqlException (0x80004005): BLOB, TEXT, GEOMETRY or JSON column 'Discriminator' can't have a default value ---> MySql.Data.MySqlClient.MySqlException (0x80004005): BLOB, TEXT, GEOMETRY or JSON column 'Discriminator' can't have a default value

Looking into it they appear to be correct. Default values are not supported for text types.

Commenting out the default to continue and we move onto this file. 5) 20170913133916_Added_SharedMessageId_To_ChatMessage 1) The type specified in there is an MSSQL type only. 2) migrationBuilder.AddColumn<string>( name: "SharedMessageId", table: "AppChatMessages", type: "nvarchar(max)", nullable: true);

            Failed executing DbCommand (3ms) [Parameters=[], CommandType='Text', CommandTimeout='30']

ALTER TABLE AppChatMessages ADD SharedMessageId nvarchar(max) NULL; MySql.Data.MySqlClient.MySqlException (0x80004005): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'max) NULL' at line 1 --->

And there is more if I continue. So the question is. Does ASP.Net Zero really support MySQL. Based on the migration scripts I'm seeing that are on top of Boilerplate. I'm guessing the answer is actually No and not the yes I was previously told.

Thanks Rick

Showing 121 to 128 of 128 entries