1

I've ran into an issue I've never had before where I've created a stored stored using EF and two of the columns that are meant to be returning values around 2,950 - 3,100 are returning 0s

Code which calls the stored procedure

public static List<USP_Get_TilesetInformation> USP_Get_TilesetInformation()
{
    return new DefaultContext().Database.SqlQuery<USP_Get_TilesetInformation>("USP_Get_TilesetInformation").ToList();
}

The class I am returning

public class USP_Get_TilesetInformation
{
    public int Id { get; set; }

    public byte X { get; set; }

    public byte Y { get; set; }

    [Column("TilesX")]
    public ushort TilesX { get; set; }

    [Column("TilesY")]
    public ushort TilesY { get; set; }

    public int TileId { get; set; }

    public byte OrderId { get; set; }

    public byte TilesetLayerOptionId { get; set; }

    public bool IsAnimated { get; set; }
}

I've put in two random numbers in the stored procedure to what it return and even though I have 23 and 42 hard coded in the stored procedure, it will still return 0

enter image description here

enter image description here

I've tried changing the column names, thinking it might be an issue with keywords, it went from 'LocationX' to 'PositionX' and now to 'TilesX', I've even added an attribute to try and map it to that column

[Column("TilesX")]

But now I am completely stuck on this.

  • Can you show the DbContext class? – vernou Jul 26 '21 at 13:57
  • What is the db column type? – vernou Jul 26 '21 at 13:58
  • 1
    please check out [this question](https://stackoverflow.com/questions/26303631/how-to-use-unsigned-int-long-types-with-entity-framework) there have been some issues mapping unsigned types in EF across some EF versions – derloopkat Jul 26 '21 at 14:13
  • Ah yes that seems to be the problem, ushort doesn't want to pick it up as the datatype, but once I changed that datatype back to a normal int, it now works, that is very interesting why it's doing that – Sythnet Partridge Jul 26 '21 at 14:53

0 Answers0