c# - Get Error : The 'Id' property on 'Match' could not be set to a 'System.Int32' value -


i got error :

the 'id' property on 'match' not set 'system.int32' value. must set property non-null value of type 'system.int64'. "

with code snippet like:

match _match =_entities.match.singleordefualt(match => match.id == matchid); 

it happened not time , check type of poco class database , it's correct! use ef 6.1.3 code first. i'm confused!

my entity class is:

[table("match")] public class match {     public match()     {         hands = new hashset<hand>();         rounds = new hashset<round>();     }      public long id { get; set; }      public datetime creationdate { get; set; }      public long firstplayerid { get; set; }      public byte firstplayerredrawhandcount { get; set; }      public long? secondplayerid { get; set; }      public byte secondplayerredrawhandcount { get; set; }      public byte speedtype { get; set; }      public matchtype matchtype { get; set; }      public byte firstplayerscore { get; set; }      public byte secondplayerscore { get; set; }      public matchstatus status { get; set; }      public long? dcuser { get; set; }      public datetime? retrytime { get; set; }      [timestamp]     public byte[] rowversion { get; set; }      public registerstate registerstate { get; set; }      [foreignkey("firstplayerid")]     public virtual user user { get; set; }     [foreignkey("secondplayerid")]     public virtual user user1 { get; set; }      public virtual icollection<hand> hands { get; set; }      public virtual icollection<round> rounds { get; set; } } 

from message, sure table has id of type system.int32 (int), , class has type of system.int64 (long).

change match.id int, if database field int (what must case here).


Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -