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.
Yes, its working now Thank you for your Support.
We are encountering an issue with a project(Single Layer) created using ABP Suite (8.0.4), specifically with tables that have a many-to-many relationship, such as the Book and Category entities. The Book entity is associated with multiple categories. While we are able to create a book with categories successfully, we are unable to delete it. We are receiving an error message stating, "The property 'Books.BooksId' is part of a key and cannot be modified or marked as modified. To change the principal of an existing entity with an identifying foreign key, first delete the dependent, invoke 'SaveChanges', and then associate the dependent with the new principal." Interestingly, the same code worked in a previous version of the project(Single Layer) using ABP Suite 6.0.2.
Hi ,
I am able to implement cmskit in single layer application by following steps provided by you.
I have tried at my end but in my case css is applied to newly created page just like.I am not getting exactly what is the issue at your end.
Hi, Is the style class with cms page is compatible with the ABP Suite version 6.0.2?
Hi ,
I am able to implement cmskit in single layer application by following steps provided by you.
I have tried at my end but in my case css is applied to newly created page just like.I am not getting exactly what is the issue at your end.
Hi,
I can create a single-layer application in the same way (We are using abp suite version 6.0.2). However, the issue arises when the style class is not applied to the newly created CMS page. I am also getting the same as you've shown in the images (in preview mode only). But, when I try to access it via the URL /pages/{slug}, the style and ID are not applied.
This is the result - without style class and ids
Hello,
Yes, Redis cache is required for using CMS kit.
You may check here https://docs.abp.io/en/abp/latest/Modules/Cms-Kit/Index#pre-requirements.thanks
Hi,
Could you please provide a solution for the issue related to style classes? This is an urgent requirement for us, and the previous solution lacked sufficient details.
Hi Anjali,
We are waiting for the solution from you. Kindly, send response immediately.
Hello,
Yes, Redis cache is required for using CMS kit.
You may check here https://docs.abp.io/en/abp/latest/Modules/Cms-Kit/Index#pre-requirements.thanks
Hi,
Could you please provide a solution for the issue related to style classes? This is an urgent requirement for us, and the previous solution lacked sufficient details.
Hi,
2.The CMS page contents aren't acquiring the style classes we have specified. However, they seem to work fine in some demo applications that accept CSS classes on content pages. 3.Is it necessary for our Single Layer solution to use Redis Cache? Because it appears that the ABP suite CMS kit Pro can only be added after selecting a public website.
Can you please provide solutions for these questions?
can you add this in
GlobalFeatureConfigurator
class in the `Domain.Shared``GlobalFeatureManager.Instance.Modules.CmsKitPro(cmsKitPro => { cmsKitPro.EnableAll(); });`
and restart the application.
Hi,
We are currently investigating this issue within our application, specifically the Application template (single layer) generated using ABP Suite. We have completed the following steps:
1.Install the CMSKit packages: Add below code in project file <ItemGroup> <PackageReference Include="Volo.CmsKit.Pro.Admin.Web" Version="6.0.0" /> <PackageReference Include="Volo.CmsKit.Pro.Admin.Application" Version="6.0.0" /> <PackageReference Include="Volo.CmsKit.Pro.Admin.HttpApi" Version="6.0.0" /> <PackageReference Include="Volo.CmsKit.Pro.EntityFrameworkCore" Version="6.0.0" /> </ItemGroup>
2.Add module dependencies : In project Module File typeof(CmsKitProAdminWebModule), typeof(CmsKitProAdminHttpApiModule), typeof(CmsKitProEntityFrameworkCoreModule), typeof(CmsKitProAdminApplicationModule)
3.Add MyGlobalFeatureConfigurator class in project
public class QueuingSystemGlobalFeatureConfigurator { private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
public static void Configure() { OneTimeRunner.Run(() => { GlobalFeatureManager.Instance.Modules.CmsKit(cmsKit => { cmsKit.EnableAll(); }); GlobalFeatureManager.Instance.Modules.CmsKitPro(cmsKitPro => { cmsKitPro.EnableAll(); }); }); } }
4.Add ''GlobalFeatureConfigurator.Configure(); in project Module File - PreConfigureServices() 5.Configure the DbContext : Add below code
builder.ConfigureCmsKitPro(); builder.ConfigureCmsKit();
6.Create a new migration file and update database Create a new migration for CMS (dotnet ef migrations add InitialCmsKitProMigration) and update database (dotnet ef database update)
After successfully following these two steps—installing CMS Kit Pro and creating tables for CMS Kit in the database—it is not displaying the CMS menu as you mentioned.
When I connect to the database that was previously working with an existing project, the same application functions correctly. Could this be related to a migration issue? I encountered a similar problem before, and at that time, I generated the migration file using the Package Manager Console and then used the CLI, which resolved the issue. However, this approach is not currently resolving the problem.
Hi,
Now the cms kit pro Installation issue in single layer is fixed (Permission Issue) but the style issue is not fixed.Please provide a resolution on this.
Run migrations (if using Entity Framework Core): dotnet ef migrations add InitialCmsKitProMigration and for style classe related issue please check this ticket https://support.abp.io/QA/Questions/5784/CSS-styles-and-Java-Script-Code-doesn%27t-apply-to-the-HTML-code
HI,
From the below link it is clear that the cms page will accept the style classes, but it is not clear how it achieved.I just downloaded the sample code they are provided and I can't see any resolution that you are provided. https://blog.abp.io/abp/Unleash-the-Power-of-ABP-CMS-Kit-A-Dynamic-Content-Showcase