Skip to content

Asp.net core putting the same Guid for all empty Guid's #1926

Closed
@jrrcdev

Description

@jrrcdev

Hello, guys.

I'm going through a problem when using Guid as Id, when I have Entity like:

`
public class SubcategoryDto
{
public Guid Id { get; set; }

    public string Description { get; set; }

    public Guid CategoryId { get; set; }
}`

and I have a Action in my controller with:

public IActionResult Create(Guid id) { var dto = new SubcategoryDto() { CategoryId = id }; return View(dto); }

I expect in my View I receive the follow object:

{
"id": "00000000-0000-0000-0000-000000000000",
"description": "",
"categoryid": "dba6b8e4-fb16-4f88-290d-08d44abea368"
}

But I receive:

{
"id": "dba6b8e4-fb16-4f88-290d-08d44abea368",
"description": "",
"categoryid": "dba6b8e4-fb16-4f88-290d-08d44abea368"
}

So, is it a issue or I need to do some configuration?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions