Open Closed

How to share one table between two modules #2794


User avatar
0
Anthony_Albutt created

Hi

This is my solution configuration

  • ABP Framework version: v5.1.4
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

I have previously asked about using the Volo Chat module for real time notifications. The response was that the Chat module does not support what I want to do

I have come back to this requirement as I have a some time to kook at this requirement again.

What I have done is recreate the 4 Entities used by the Volo Chat modules with the required CRUD functionality. All the changes are working as I want them to. I have but one problem. I can't add migrations, I get the following error. There may be a simple solution that I have not tried. Cannot use table 'ChatConversations' for entity type 'Conversation' since it is being used for entity type 'NoticeConversation' and potentially other entity types, but there is no linking relationship. Add a foreign key to 'Conversation' on the primary key properties and pointing to the primary key on another entity type mapped to 'ChatConversations'.

What seems to be the precured method, is to configure the shared tables in the project DbContect class under /* Configure the shared tables (with included modules) here */

I am getting the following error

I think that I have figgured out all the requirements, but I may have missed something out

This is my code for one of the 4 entities for the ModelBuilders What I did is to create my entity builder as below and set my To Table to ChatUser in place of NoticeUser

I Did this to all 4 entity builders I created an interface for each entity

I created the Configuration method for each entity in the DbContextModelCreatingExtensions class:

And in the OnModelCreating method of project DbContext class I added the 4 ModelBuilder entries

Please let me know what I have left out, that is causing the following error

Thanks and regards Tony


3 Answer(s)
  • User Avatar
    0
    levees created

    I don't think share data table is good idea Is it possible to use Distributed Event Bus finish it ?

  • User Avatar
    0
    Tony_Albutt created

    Thanks, I wont use shared data tables.

    I will look at Distributed Event again.

    I don't see yet how this will work with SignalR to send multiple notifications to multiple UI elements.

    My goal was to centralize all chats, chat bots and in app notifications to the user.

    Regards Tony

  • User Avatar
    0
    Tony_Albutt created

    Hi

    Finished real time notification via background job and a NotificationHub

    Can you please close this issue

    Thanks and regards Tony

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11