Open Closed

Extending AppUsers #97


User avatar
0
Annwar created

Hi, I have been trying to add properties in AppUser, we are using MongoDb, it is not reflecting in dB, I have also try to initialize those properties in AppUser constructor they are still not reflecting, how can I extend AppUser Entity . What I did is I updated the AppUser with following code

public virtual bool MyProperty { get; private set; }

    private AppUser()
    {
        MyProperty = true;
    }

I also tried diffrent things in in following method like protected override void CreateModel(IMongoModelBuilder modelBuilder) { base.CreateModel(modelBuilder);

        modelBuilder.Entity<AppUser>(b =>
        {
            /* Sharing the same "AbpUsers" collection
             * with the Identity module's IdentityUser class. */
            b.CollectionName = "AbpUsers";
           b.BsonMap.MapProperty(x => x.MyProperty);
        });
       
    }

what do I need to add property or properties to extend AppUser what methods I need to update ?


3 Answer(s)
  • User Avatar
    0
    gterdem created
    Senior .NET Developer

    Hello, Did you check this guide here? https://github.com/abpframework/abp/blob/dev/docs/en/Customizing-Application-Modules-Extending-Entities.md

  • User Avatar
    0
    michael.sudnik created

    Hi, thanks. Could you also point us in the right direction to make these properties accesible in the UI? We have found the information about overriding paged, but where can we find the original page templates? e.g. registration page, profile page and user management pages. Also, how do we update the relevant application services and DTOs to include these new properties when saving? Is there a nice example that illustrates this? I imagine this would be a fairly common scenario?

  • User Avatar
    0
    alper created
    Support Team Director

    we are working on a customization solution that you can easily extend existing items. but for now, it's only possible with replacing the pages (or upgrading to source-code included plan)

Made with ❤️ on ABP v9.1.0-preview. Updated on November 01, 2024, 05:35