Open Closed

Referencing Enums in MongoDB #2477


User avatar
0
james@melvin.tech created
  • ABP Framework version: v5.1.1
  • UI type: MVC
  • DB provider: MongoDB
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace: Cannot find namespace of this enum! Write the namespace of this enum into the file.
  • Steps to reproduce the issue:" Create a new MongoDb tiered solution. Add a enum file in the Domain.Shared filder. Generate a CRUD page referencing the Enum. Then if i set the Enum namespace and Enum name to match the file, i get the following error.
  • Cannot populate enum localizations! Error code: EN0004. System.NullReferenceException: Object reference not set to an instance of an object. at Volo.Abp.Suite.Areas.AbpSuite.CrudPageGenerator.Commands.EntityGenerateCommand.sI1wyT4PYy()

Ive built the project, tried different namespaces but no matter what i cant link to a enum.


1 Answer(s)
  • User Avatar
    0
    yekalkan created
    Support Team Fullstack Developer

    Hi @james

    There is a known problem with parsing enum files, it will be fixed in the next patch. I'm refunding your question credit.


    Urgent solution: Change the enum file to file-scoped namespace

    example:

    namespace MyApplication.Cars;
    
    public enum CarType
    {
        Sedan,
        StationWagon,
        Coupe
    }
    
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11