This is fine but my Issue is, I can't delete Category from a particular Book. We are waiting for your reply because its very urgent.
Oh okay, sorry for the misunderstanding, I thought the problem was being not able to delete books. I'm able to reproduce the problem you stated now.
To quickly fix this problem for now, you can change the delete behavior in the dbcontext class. So, please open your DbContext class and make the following changes:
if (builder.IsHostDatabase())
{
builder.Entity<Book>(b =>
{
b.ToTable(DbTablePrefix + "Books", DbSchema);
b.ConfigureByConvention();
b.Property(x => x.Name).HasColumnName(nameof(Book.Name));
b.HasMany(x => x.Categories).WithOne().HasForeignKey(x => x.BookId).IsRequired()
- .OnDelete(DeleteBehavior.NoAction);
+ .OnDelete(DeleteBehavior.Cascade);
});
builder.Entity<BookCategory>(b =>
{
b.ToTable(DbTablePrefix + "BookCategory", DbSchema);
b.ConfigureByConvention();
b.HasKey(
x => new { x.BookId, x.CategoryId }
);
b.HasOne<Book>().WithMany(x => x.Categories).HasForeignKey(x => x.BookId).IsRequired()
- .OnDelete(DeleteBehavior.NoAction);
+ .OnDelete(DeleteBehavior.Cascade);
b.HasOne<Category>().WithMany().HasForeignKey(x => x.CategoryId).IsRequired()
- .OnDelete(DeleteBehavior.NoAction);
+ .OnDelete(DeleteBehavior.Cascade);
b.HasIndex(
x => new { x.BookId, x.CategoryId }
);
});
}
Just change the .OnDelete(DeleteBehavior.NoAction)
to .OnDelete(DeleteBehavior.Cascade)
, and then create a new migration and apply it to the database. Then, your problem should be fixed.
Note: We have already made this change in the v8.1.0-rc.1+, so you can also consider updating your application.
Best regards.
Hi, I'll test this and write you back asap.
i have added new field in table and unchecked test generation, still it didn't generate ui for new field
From the previous logs, it seemed the UI code generation did not happen because being not able to generate unit tests. So, to be able to understand the current problem, please share the latest ABP Suite logs again, they should be changed.
It is strange why it has stopped UI generation, though it does not give any error as well. i have done more changes but for all of them no error and no UI code generated.
We cannot afford this type of issue as we have to generate the front end angular code because we cannot do that code manually and it defeats the purpose of using the ABP.Thanks
The reason is the unit test generation. We had problems generating unit tests due to changes we made in the v8.0 testing structure (it's fixed with v8.1.0-rc.1), so you can either implement the unit testing changes we made in v8.0 by examining the v8.0 template or you can uncheck unit test generation and regenerate the entity. Then, it should successfully generate the UI. (please fix the build errors before the code generation)
Hi, I think that's a great suggestion. We have created an internal issue (#16977) for your suggestion and will evaluate it and try to prioritize it. Thanks for your suggestion.
Best regards.
yes problem was some duplicate package, but now when i made changes to model it is not generating changes for front end in angular even if i tick the generate ui checkbox while generating. it is generating code for backend projects and not for front end
Hi, did you get any error while the entity is being generated? Please share the suite logs, so I can better assist you.
Hi, thanks for reporting. The URL should be encoded as you stated, we have created an internal issue for this problem (#16954). Regards.
Hi, Thanks for the reply. Let me explain in detail. I am having Module A and Module B. i want entity in module A to be used in Module B. i am generating via abp suite. can you please explain the process to do that. i also heard like creating a Shared module and use the shared module to communicate . can you please explain the process to do that. what i did was, i created Module abd added to solution. then i separately added entity to each module created via abpsuite. please let me know the process is correcr or not.
The entity in "Module A" has extra properties I guess right? If so, ABP Suite generates all required code for you except the configurations for extra properties, you need to make some modifications. So, if you can share your project (with the code generation) with an email to support@abp.io with the question number, I can better assist you with the configurations.
Hi, currently ABP Suite does nothing for an entity if it has extra properties on it. We have an internal issue for that (in backlog), but for now, you need to manually check the ef-core configuration and fix it accordingly. If you cannot fix it, then please share the OnModelCreating
method. Also please share the entity metadata from Suite UI, so I can better assist you.