Base solution for your next web application
Open Closed

NotificationSubscription Seed method #1398


User avatar
0
epgeroy created

I'm trying to make a seed with some notification subscription but when I add NotificationSubscription entity to dbContext, like this:

public virtual IDbSet<NotificationSubscription> NotificationSubscription { get; set; }

this is what I got

EntityType 'NotificationSubscription' has no key defined. Define the key for this EntityType. NotificationSubscription: EntityType: EntitySet 'NotificationSubscription' is based on type 'NotificationSubscription' that has no keys defined.

Is there a way to do this?

thanks


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Do you want to subscribe users to some notifications on your seed method ? If so, you should use UserNotificationInfo which is already included in the dbContext.

    If you just want to create some notifications then you should use NotificationInfo.

  • User Avatar
    0
    epgeroy created

    it works thanks a lot