Open Closed

Abp Suite not generate ModelBuilder for ModelCreating #81


User avatar
0
thanhvl1 created

HI,

I'm facing a problem that I cannot generate modelbuilder using abp suite v2.3.0. It only generate namespace of model but not anything at all


11 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi We will check this problem.

  • User Avatar
    0
    alper created
    Support Team Director

    To reproduce the problem, we need some extra info:

    Your project name:

    Template options:

    • UI Framework: MVC / Angular
      • (If MVC) Tiered: Yes / No
      • (If Angular) Separated Identity Server: Yes / No
    • Database Provider: EF Core / MongoDB

    Entity JSON

    • Write us your entity JSON. It's located here => %UserProfile%\.abp\suite\{Your-Project-Name}\entities\{Your-Entity-Name}.json
  • User Avatar
    0
    thanhvl1 created

    Hi alper,

    My project name: FPT.DDC.BackendService

    UI framework: Angular, Tiered, separated Identitty server DB: EF Core

    I have many Entities

    A sample of entity

    { "Id": "416c6275-6d00-0000-0000-000000000000", "Name": "Album", "OriginalName": "Album", "NamePlural": "Albums", "DatabaseTableName": "Albums", "Namespace": "DMS.Albums", "BaseClass": "FullAuditedEntity", "PrimaryKeyType": "Guid", "IsMultiTenant": true, "ShouldCreateUserInterface": true, "ShouldAddMigration": false, "ShouldUpdateDatabase": false, "Properties": [ { "Id": "416c6275-6d41-6c62-756d-436f64650000", "Name": "AlbumCode", "Type": "string", "IsNullable": true, "IsRequired": true, "MinLength": 0, "MaxLength": 40, "SortOrder": 0, "SortType": 0 }, { "Id": "416c6275-6d41-6c62-756d-4e616d650000", "Name": "AlbumName", "Type": "string", "IsNullable": true, "IsRequired": true, "MinLength": 0, "MaxLength": 100, "SortOrder": 0, "SortType": 0 }, { "Id": "fce92864-0cd9-bc50-dc84-2d9a004fa496", "Name": "ApplyForCode", "Type": "string", "IsNullable": true, "IsRequired": true, "MinLength": 0, "MaxLength": 40, "SortOrder": 0, "SortType": 0 }, { "Id": "416c6275-6d53-7061-6365-000000000000", "Name": "Space", "Type": "string", "IsNullable": true, "IsRequired": false, "MinLength": 0, "MaxLength": 40, "SortOrder": 0, "SortType": 0 }, { "Id": "416c6275-6d46-726f-6d44-617465000000", "Name": "FromDate", "Type": "DateTime", "IsNullable": true, "IsRequired": true, "MinLength": null, "MaxLength": null, "SortOrder": 0, "SortType": 0 }, { "Id": "416c6275-6d54-6f44-6174-650000000000", "Name": "ToDate", "Type": "DateTime", "IsNullable": true, "IsRequired": true, "MinLength": null, "MaxLength": null, "SortOrder": 0, "SortType": 0 }, { "Id": "416c6275-6d41-6c62-756d-547970650000", "Name": "AlbumType", "Type": "string", "IsNullable": true, "IsRequired": true, "MinLength": 0, "MaxLength": 40, "SortOrder": 0, "SortType": 0 }, { "Id": "416c6275-6d53-7461-7475-730000000000", "Name": "Status", "Type": "string", "IsNullable": true, "IsRequired": true, "MinLength": 0, "MaxLength": 1, "SortOrder": 0, "SortType": 0 }, { "Id": "f8b494d2-48e0-8c1c-3a2f-05c8b51a7c4e", "Name": "Description", "Type": "string", "IsNullable": true, "IsRequired": false, "MinLength": 0, "MaxLength": 1000, "SortOrder": 0, "SortType": 0 } ], "PhysicalFileName": "Album.json" }

  • User Avatar
    0
    alper created
    Support Team Director

    I couldn't reproduce your problem. There'll be new version on Monday 06 April. Can you try with the latest version. In the new version, there's also a new feature: "Unit test". Suite creates unit tests of your entity.

  • User Avatar
    0
    thanhvl1 created

    Hi @alper,

    Can you share the template's name and content Abp Suite using to generate model ?

    Thanks for your support!

  • User Avatar
    0
    alper created
    Support Team Director

    there's no template for adding the DbSet to the DbContext. Wait for v2.4.1 which I guess solves your problem (probably it'll be released today 08 April) If it's not solved, I need to get your solution to reproduce it.

  • User Avatar
    0
    thanhvl1 created

    Hi @alper,

    Now I can generate the DbSet for each models. But when I run "SaveAndGenerate" I got a new issue "message": "Error occurred on DB migration step! Make sure the project is not working. Command output: Build started...\r\nBuild failed.\r\n",

    I thinks the unit test caused this problem because of there is no Id in the constructor of model. Please provide hotfix soon

  • User Avatar
    0
    alper created
    Support Team Director

    normally there should be an ID field in Book entity. What's the base class of your entity? Did you delete the Id field from your Book.json

  • User Avatar
    0
    thanhvl1 created

    This is my Book.json, it still has Id field

    { "Id": "eb6b50df-1049-4a82-bd74-18d97d81d20c", "Name": "Book", "OriginalName": "Book", "NamePlural": "Books", "DatabaseTableName": "Books", "Namespace": "Books", "BaseClass": "FullAuditedEntity", "PrimaryKeyType": "Guid", "IsMultiTenant": true, "ShouldCreateUserInterface": true, "ShouldAddMigration": true, "ShouldUpdateDatabase": true, "CreateTests": true, "Properties": [ { "Id": "2de78020-a59d-45ce-b50d-567304461e57", "Name": "BookCode", "Type": "string", "IsNullable": false, "IsRequired": true, "MinLength": null, "MaxLength": 40, "SortOrder": 0, "SortType": 0, "Regex": null, "EmailValidation": false }, { "Id": "837e5bda-fbaf-4a05-83c6-3ca9c00ebf31", "Name": "BookName", "Type": "string", "IsNullable": false, "IsRequired": false, "MinLength": null, "MaxLength": 255, "SortOrder": 0, "SortType": 0, "Regex": null, "EmailValidation": false }, { "Id": "f42138a5-f16c-4398-b658-8a88760afb0c", "Name": "BookNumber", "Type": "int", "IsNullable": false, "IsRequired": false, "MinLength": null, "MaxLength": null, "SortOrder": 0, "SortType": 0, "Regex": "", "EmailValidation": false }, { "Id": "ac052a38-c9bf-4dca-8e70-67255bcc09da", "Name": "BookPrice", "Type": "float", "IsNullable": false, "IsRequired": false, "MinLength": null, "MaxLength": null, "SortOrder": 0, "SortType": 0, "Regex": "", "EmailValidation": false }, { "Id": "0d438639-60f3-4aee-9e21-f4a1e5ee85e4", "Name": "BookExprireDate", "Type": "DateTime", "IsNullable": false, "IsRequired": true, "MinLength": null, "MaxLength": null, "SortOrder": 0, "SortType": 0, "Regex": "", "EmailValidation": false } ], "NavigationProperties": null, "PhysicalFileName": "Book.json" }

  • User Avatar
    0
    alper created
    Support Team Director

    can you send your project to support@abp.io delete all bin and obj folders. and share it on google drive and send us link

  • User Avatar
    0
    alper created
    Support Team Director

    can you send your project to support@abp.io delete all bin and obj folders. and share it on google drive and send us link

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