Base solution for your next web application
Open Closed

How to update ABP database tables? #2161


User avatar
0
rev319303 created

I am implementing Stripe JS into my project which upon validation will give me a token per user. I want to store that token in the AbpUsers table. The ABP dbContext file seems to be compiled. Do I just manually update the SQL table or do you have another standard way of doing this?

I guess a better way of asking this is how do I update the out of the box ABP database tables?

I am using the .Net Core template.


4 Answer(s)
  • User Avatar
    0
    jonas452 created

    Just change(extend,..) the user class and update by using code-first migrations. Certainly don't do it manually on your sql database.

  • User Avatar
    0
    rev319303 created

    Please forgive me but this is my first code-first project. I'm used to the .edmx file doing these types of things for me.

    Your answer is exactly what I thought but I do not see the AbpUser.cs class anywhere. Do you mean extend it here "MyProjectName.Authorization.Users.User.cs"? Or, do yo mean create my own User.cs that inherits AbpUser like "public class User : AbpUser<User>" and extend it here?

  • User Avatar
    0
    rev319303 created

    I figured it out.

    I just added this:

    public virtual string StripeToken { get; set; }
    

    to this file: MyProjectName.Authorization.Users.User.cs

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can also take a look at this document <a class="postlink" href="https://aspnetzero.com/Documents/Extending-Existing-Entities">https://aspnetzero.com/Documents/Extend ... g-Entities</a>