Base solution for your next web application
Open Closed

ASPNET-Zero-Tool---Failure-on-Master-Detail-form #12394


User avatar
0
Theunis created

Hi,

My code created a file "Core.AlertNotification.json"

When I run the file I get "An error occured. : Object reference not set to an instance of an object."
i.e. dotnet AspNetZeroRadTool.dll .\Core.AlertNotification.json

When I run any other.json file that has no Master detail , there is no issue.

Could you please reply to this ticket to ian@gofuseit.com


{
"IsRegenerate": true,
"MenuPosition": "main",
"RelativeNamespace": "Core",
"EntityName": "AlertNotification",
"EntityNamePlural": "AlertNotifications",
"TableName": "AlertNotifications",
"PrimaryKeyType": "int",
"BaseClass": "Entity",
"EntityHistory": false,
"AutoMigration": true,
"UpdateDatabase": false,
"CreateUserInterface": true,
"CreateViewOnly": true,
"CreateExcelExport": false,
"CreateExcelImport": false,
"IsNonModalCRUDPage": false,
"IsMasterDetailPage": true,
"GenerateOverridableEntity": false,
"GenerateUnitTest": false,
"GenerateUiTest": false,
"GenerateMobile": false,
"PagePermission": {
"Host": false,
"Tenant": true
},
"Properties": [
{
"Name": "DateOccured",
"Type": "DateTime",
"MaxLength": -1,
"MinLength": -1,
"Range": {
"IsRangeSet": false,
"MinimumValue": 0.0,
"MaximumValue": 0.0
},
"Required": false,
"Nullable": false,
"Regex": "",
"IsMultiLingual": false,
"UserInterface": {
"AdvancedFilter": true,
"List": true,
"ListMaui": false,
"CreateOrUpdate": false
},
"ViewType": null,
"AdditionalData": {}
},
{
"Name": "AlertRead",
"Type": "bool",
"MaxLength": -1,
"MinLength": -1,
"Range": {
"IsRangeSet": false,
"MinimumValue": 0.0,
"MaximumValue": 0.0
},
"Required": false,
"Nullable": false,
"Regex": "",
"IsMultiLingual": false,
"UserInterface": {
"AdvancedFilter": true,
"List": true,
"ListMaui": false,
"CreateOrUpdate": false
},
"ViewType": null,
"AdditionalData": {}
},
{
"Name": "DateLastModified",
"Type": "DateTime",
"MaxLength": -1,
"MinLength": -1,
"Range": {
"IsRangeSet": false,
"MinimumValue": 0.0,
"MaximumValue": 0.0
},
"Required": false,
"Nullable": false,
"Regex": "",
"IsMultiLingual": false,
"UserInterface": {
"AdvancedFilter": true,
"List": true,
"ListMaui": false,
"CreateOrUpdate": false
},
"ViewType": null,
"AdditionalData": {}
},
{
"Name": "Latitude",
"Type": "double",
"MaxLength": -1,
"MinLength": -1,
"Range": {
"IsRangeSet": false,
"MinimumValue": 0.0,
"MaximumValue": 0.0
},
"Required": false,
"Nullable": false,
"Regex": "",
"IsMultiLingual": false,
"UserInterface": {
"AdvancedFilter": false,
"List": true,
"ListMaui": false,
"CreateOrUpdate": true
},
"ViewType": null,
"AdditionalData": {}
},
{
"Name": "Longitude",
"Type": "double",
"MaxLength": -1,
"MinLength": -1,
"Range": {
"IsRangeSet": false,
"MinimumValue": 0.0,
"MaximumValue": 0.0
},
"Required": false,
"Nullable": false,
"Regex": "",
"IsMultiLingual": false,
"UserInterface": {
"AdvancedFilter": false,
"List": true,
"ListMaui": false,
"CreateOrUpdate": true
},
"ViewType": null,
"AdditionalData": {}
},
{
"Name": "AlertValue",
"Type": "string",
"MaxLength": -1,
"MinLength": -1,
"Range": {
"IsRangeSet": false,
"MinimumValue": 0.0,
"MaximumValue": 0.0
},
"Required": false,
"Nullable": false,
"Regex": "",
"IsMultiLingual": false,
"UserInterface": {
"AdvancedFilter": false,
"List": true,
"ListMaui": false,
"CreateOrUpdate": true
},
"ViewType": null,
"AdditionalData": {}
},
{
"Name": "FullStreetName",
"Type": "string",
"MaxLength": -1,
"MinLength": -1,
"Range": {
"IsRangeSet": false,
"MinimumValue": 0.0,
"MaximumValue": 0.0
},
"Required": false,
"Nullable": false,
"Regex": "",
"IsMultiLingual": false,
"UserInterface": {
"AdvancedFilter": true,
"List": true,
"ListMaui": false,
"CreateOrUpdate": true
},
"ViewType": null,
"AdditionalData": {}
},
{
"Name": "Roadspeed",
"Type": "int",
"MaxLength": -1,
"MinLength": -1,
"Range": {
"IsRangeSet": false,
"MinimumValue": 0.0,
"MaximumValue": 0.0
},
"Required": false,
"Nullable": false,
"Regex": "",
"IsMultiLingual": false,
"UserInterface": {
"AdvancedFilter": false,
"List": true,
"ListMaui": false,
"CreateOrUpdate": true
},
"ViewType": null,
"AdditionalData": {}
},
{
"Name": "DriverId",
"Type": "int",
"MaxLength": -1,
"MinLength": -1,
"Range": {
"IsRangeSet": false,
"MinimumValue": 0.0,
"MaximumValue": 0.0
},
"Required": false,
"Nullable": false,
"Regex": "",
"IsMultiLingual": false,
"UserInterface": {
"AdvancedFilter": true,
"List": true,
"ListMaui": false,
"CreateOrUpdate": true
},
"ViewType": null,
"AdditionalData": {}
},
{
"Name": "DriverFirstName",
"Type": "string",
"MaxLength": 250,
"MinLength": 0,
"Range": {
"IsRangeSet": false,
"MinimumValue": 0.0,
"MaximumValue": 0.0
},
"Required": false,
"Nullable": true,
"Regex": "",
"IsMultiLingual": false,
"UserInterface": {
"AdvancedFilter": true,
"List": true,
"ListMaui": false,
"CreateOrUpdate": true
},
"ViewType": null,
"AdditionalData": {}
},
{
"Name": "DriverLastName",
"Type": "string",
"MaxLength": 250,
"MinLength": 0,
"Range": {
"IsRangeSet": false,
"MinimumValue": 0.0,
"MaximumValue": 0.0
},
"Required": false,
"Nullable": true,
"Regex": "",
"IsMultiLingual": false,
"UserInterface": {
"AdvancedFilter": true,
"List": true,
"ListMaui": false,
"CreateOrUpdate": true
},
"ViewType": null,
"AdditionalData": {}
},
{
"Name": "DriverTag",
"Type": "string",
"MaxLength": 250,
"MinLength": 0,
"Range": {
"IsRangeSet": false,
"MinimumValue": 0.0,
"MaximumValue": 0.0
},
"Required": false,
"Nullable": true,
"Regex": "",
"IsMultiLingual": false,
"UserInterface": {
"AdvancedFilter": true,
"List": true,
"ListMaui": false,
"CreateOrUpdate": true
},
"ViewType": null,
"AdditionalData": {}
},
{
"Name": "RegistrationNumber",
"Type": "string",
"MaxLength": 250,
"MinLength": 0,
"Range": {
"IsRangeSet": false,
"MinimumValue": 0.0,
"MaximumValue": 0.0
},
"Required": false,
"Nullable": true,
"Regex": "",
"IsMultiLingual": false,
"UserInterface": {
"AdvancedFilter": true,
"List": true,
"ListMaui": false,
"CreateOrUpdate": true
},
"ViewType": null,
"AdditionalData": {}
},
{
"Name": "Imei",
"Type": "string",
"MaxLength": 250,
"MinLength": 0,
"Range": {
"IsRangeSet": false,
"MinimumValue": 0.0,
"MaximumValue": 0.0
},
"Required": false,
"Nullable": true,
"Regex": "",
"IsMultiLingual": false,
"UserInterface": {
"AdvancedFilter": true,
"List": true,
"ListMaui": false,
"CreateOrUpdate": true
},
"ViewType": null,
"AdditionalData": {}
},
{
"Name": "AlertIdentifier",
"Type": "string",
"MaxLength": 50,
"MinLength": 0,
"Range": {
"IsRangeSet": false,
"MinimumValue": 0.0,
"MaximumValue": 0.0
},
"Required": false,
"Nullable": true,
"Regex": "",
"IsMultiLingual": false,
"UserInterface": {
"AdvancedFilter": true,
"List": true,
"ListMaui": false,
"CreateOrUpdate": true
},
"ViewType": null,
"AdditionalData": {}
}
],
"NavigationProperties": [
{
"Namespace": "ITS.Core",
"ForeignEntityName": "Device",
"ForeignEntityNamePlural": "Devices",
"IdType": "int",
"IsNullable": true,
"PropertyName": "DeviceId",
"DuplicationNumber": 0,
"RelationType": "single",
"ViewType": "LookupTable",
"DisplayPropertyNameInfos": {
"MergeFormat": "{0}",
"DisplayPropertyNames": [
"IMEI"
]
}
},
{
"Namespace": "ITS.Core",
"ForeignEntityName": "AlertType",
"ForeignEntityNamePlural": "AlertTypes",
"IdType": "int",
"IsNullable": true,
"PropertyName": "AlertTypeId",
"DuplicationNumber": 0,
"RelationType": "single",
"ViewType": "LookupTable",
"DisplayPropertyNameInfos": {
"MergeFormat": "{0}",
"DisplayPropertyNames": [
"AlertDescription"
]
}
}
],
"NavigationPropertyOneToManyTables": [
{
"EntityJson": "Core.AlertComment.json",
"ForeignPropertyName": "AlertNotificationId",
"IsNullable": true,
"DisplayPropertyName": "",
"ViewType": "LookupTable"
}
],
"EnumDefinitions": [],
"DbContext": null
}



6 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @Theunis

    Is the "Core.AlertComment.json" entity file that you associated as One to Many located in the same directory as the "Core.AlertNotification.json" file? It is giving this error because it cannot find "Core.AlertComment.json" file. If this file exists, make sure that its name and content are configured correctly.

  • User Avatar
    0
    Theunis created

    Hi,

    Is the "Core.AlertComment.json" entity file that you associated as One to Many located in the same directory as the "Core.AlertNotification.json" file? Yes indeed that is the case.

    Here it is for reference:


    {
    "IsRegenerate": true,
    "MenuPosition": "main",
    "RelativeNamespace": "Core",
    "EntityName": "AlertComment",
    "EntityNamePlural": "AlertComments",
    "TableName": "AlertComments",
    "PrimaryKeyType": "int",
    "BaseClass": "Entity",
    "EntityHistory": false,
    "AutoMigration": true,
    "UpdateDatabase": true,
    "CreateUserInterface": true,
    "CreateViewOnly": true,
    "CreateExcelExport": false,
    "CreateExcelImport": true,
    "IsNonModalCRUDPage": false,
    "IsMasterDetailPage": false,
    "GenerateOverridableEntity": false,
    "GenerateUnitTest": false,
    "GenerateUiTest": false,
    "GenerateMobile": false,
    "PagePermission": {
    "Host": false,
    "Tenant": true
    },
    "Properties": [
    {
    "Name": "AlertCommentDetail",
    "Type": "string",
    "MaxLength": -1,
    "MinLength": -1,
    "Range": {
    "IsRangeSet": false,
    "MinimumValue": 0.0,
    "MaximumValue": 0.0
    },
    "Required": false,
    "Nullable": false,
    "Regex": "",
    "IsMultiLingual": false,
    "UserInterface": {
    "AdvancedFilter": false,
    "List": true,
    "ListMaui": false,
    "CreateOrUpdate": true
    },
    "ViewType": null,
    "AdditionalData": {}
    },
    {
    "Name": "DateLastModified",
    "Type": "DateTime",
    "MaxLength": -1,
    "MinLength": -1,
    "Range": {
    "IsRangeSet": false,
    "MinimumValue": 0.0,
    "MaximumValue": 0.0
    },
    "Required": false,
    "Nullable": false,
    "Regex": "",
    "IsMultiLingual": false,
    "UserInterface": {
    "AdvancedFilter": false,
    "List": true,
    "ListMaui": false,
    "CreateOrUpdate": true
    },
    "ViewType": null,
    "AdditionalData": {}
    }
    ],
    "NavigationProperties": [
    {
    "Namespace": "ITS.Core",
    "ForeignEntityName": "AlertNotification",
    "ForeignEntityNamePlural": "AlertNotifications",
    "IdType": "int",
    "IsNullable": true,
    "PropertyName": "AlertNotificationId",
    "DuplicationNumber": 0,
    "RelationType": "single",
    "ViewType": "LookupTable",
    "DisplayPropertyNameInfos": {
    "MergeFormat": null,
    "DisplayPropertyNames": []
    }
    },
    {
    "Namespace": "ITS.Authorization.Users",
    "ForeignEntityName": "User",
    "ForeignEntityNamePlural": "Users",
    "IdType": "long",
    "IsNullable": true,
    "PropertyName": "UserId",
    "DuplicationNumber": 0,
    "RelationType": "single",
    "ViewType": "LookupTable",
    "DisplayPropertyNameInfos": {
    "MergeFormat": "{,"IsGeneratedByMasterPage": true0}",
    "DisplayPropertyNames": [
    "Name"
    ]
    }
    }
    ],
    "NavigationPropertyOneToManyTables": [],
    "EnumDefinitions": [],
    "DbContext": null
    }


  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @Theunis

    In your "Core.AlertComment.json" file, the "MergeFormat" variable with the value "{,"IsGeneratedByMasterPage": true0}" in the NavigationProperties has an incorrect value and therefore gives the relevant error. To fix this in the relevant entity, you need to set the "MergeFormat" value to "{0}". The reason for this problem is that while the Child Entity is being created in the MasterDetail and the Existing Property is being updated, the new value to be added is added to the wrong line, so you have encountered this problem. I have created an issue for this. You can follow the developments here. Thank you for your feedback.

    Core.AlertComment.json file content with corrected MergeFormat value

    {
      "IsRegenerate": true,
      "MenuPosition": "main",
      "RelativeNamespace": "Core",
      "EntityName": "AlertComment",
      "EntityNamePlural": "AlertComments",
      "TableName": "AlertComments",
      "PrimaryKeyType": "int",
      "BaseClass": "Entity",
      "EntityHistory": false,
      "AutoMigration": true,
      "UpdateDatabase": true,
      "CreateUserInterface": true,
      "CreateViewOnly": true,
      "CreateExcelExport": false,
      "CreateExcelImport": true,
      "IsNonModalCRUDPage": false,
      "IsMasterDetailPage": false,
      "GenerateOverridableEntity": false,
      "GenerateUnitTest": false,
      "GenerateUiTest": false,
      "GenerateMobile": false,
      "PagePermission": {
        "Host": false,
        "Tenant": true
      },
      "Properties": [
        {
          "Name": "AlertCommentDetail",
          "Type": "string",
          "MaxLength": -1,
          "MinLength": -1,
          "Range": {
            "IsRangeSet": false,
            "MinimumValue": 0.0,
            "MaximumValue": 0.0
          },
          "Required": false,
          "Nullable": false,
          "Regex": "",
          "IsMultiLingual": false,
          "UserInterface": {
            "AdvancedFilter": false,
            "List": true,
            "ListMaui": false,
            "CreateOrUpdate": true
          },
          "ViewType": null,
          "AdditionalData": {}
        },
        {
          "Name": "DateLastModified",
          "Type": "DateTime",
          "MaxLength": -1,
          "MinLength": -1,
          "Range": {
            "IsRangeSet": false,
            "MinimumValue": 0.0,
            "MaximumValue": 0.0
          },
          "Required": false,
          "Nullable": false,
          "Regex": "",
          "IsMultiLingual": false,
          "UserInterface": {
            "AdvancedFilter": false,
            "List": true,
            "ListMaui": false,
            "CreateOrUpdate": true
          },
          "ViewType": null,
          "AdditionalData": {}
        }
      ],
      "NavigationProperties": [
        {
          "Namespace": "ITS.Core",
          "ForeignEntityName": "AlertNotification",
          "ForeignEntityNamePlural": "AlertNotifications",
          "IdType": "int",
          "IsNullable": true,
          "PropertyName": "AlertNotificationId",
          "DuplicationNumber": 0,
          "RelationType": "single",
          "ViewType": "LookupTable",
          "DisplayPropertyNameInfos": {
            "MergeFormat": null,
            "DisplayPropertyNames": []
          }
        },
        {
          "Namespace": "ITS.Authorization.Users",
          "ForeignEntityName": "User",
          "ForeignEntityNamePlural": "Users",
          "IdType": "long",
          "IsNullable": true,
          "PropertyName": "UserId",
          "DuplicationNumber": 0,
          "RelationType": "single",
          "ViewType": "LookupTable",
          "DisplayPropertyNameInfos": {
            "MergeFormat": "{0}",
            "DisplayPropertyNames": ["Name"]
          }
        }
      ],
      "NavigationPropertyOneToManyTables": [],
      "EnumDefinitions": [],
      "DbContext": null
    }
    
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @Theunis

    May I know your Power Tools version so I can reproduce the situation?

  • User Avatar
    0
    Theunis created

    Yes, certainly. It is version 4.5.4

  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @Theunis

    Can you please tell us the steps to create the Entities to avoid this issue? Thank you