.net - Adding TimeStamps with EF 4.3 Migrations -


i'm using code first migrations , i'm altering model add timestamp fields tables. i'm trying add timetamp fields in second migration. here sample of code looks like

public class user {     public int userid { get; set; }     public string username { get; set; }           public byte[] timestamp { get; set; } }   public class usermodelconfiguration: entitytypeconfiguration<user> {         public usermodelconfiguration() {             property(p => p.username).isrequired().hasmaxlength(250);             property(p => p.timestamp).isrowversion();                     }     } 

the generated migration looks

public override void up()         {                             addcolumn("users", "timestamp", c => c.binary(nullable: false, fixedlength: true, timestamp: true, storetype: "rowversion"));         } 

when execute update-database command, error message says "defaults cannot created on columns of data type timestamp. table 'users', column 'timestamp'. not create constraint" moved data table, didn't solve issue.

how can go adding timestamp field migration set?

use nullable:true. timestamp column have null in column specification filled anyway.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -