"Id" is null in response in C# from Editor()

"Id" is null in response in C# from Editor()

wadeparallonwadeparallon Posts: 64Questions: 9Answers: 0

Even before getting to the JS, this is the first load (HttpGet)

This is the Database

And this is the model

I've originally did not have the .Set(false) on the property, I was validating it to be NotEmpty. I'm unsure why Id is not being populated. I've referenced the .net package and the jsonidcontroller and I've practically matched it.

I've searched around the forums and can't seem to find the issue.

This question has an accepted answers - jump to answer

Answers

  • wadeparallonwadeparallon Posts: 64Questions: 9Answers: 0

    Looking at SQL Profiler, it appears as though its in conflict with a default? There are two "id"s being queried.

    SELECT  [id] as 'id', [Id] as 'Id', [Name] as 'Name', [Description] as 'Description', [IsActive] as 'IsActive', [CreateDate] as 'CreateDate', [ModifyDate] as 'ModifyDate' FROM  [BusinessOwnerPriorities] 
    

    :|

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Add "Id" as the third parameter to the constructor.

    The default is id, which is not Id, hence the issue. Telling the library what the correct name of the primary key is, should resolve this.

    Allan

Sign In or Register to comment.