model-first rowversion (timestamp) property RRS feed

  • Question

  • I am developing Entity Framework based app. I am using model-first approach. I would like to handle the concurrency issues. As written in many articles I am going to do it by turning the ConcurrencyMode to fixed on a field which is a timestamp. At the moment I am facing the problem - I cannot add field (column) of type timestamp. How can I do it in model?

    As written here:


    I tried installiing Entity Designer Database Generation Power Pack, but still I see no possibility to have the timestamp generated from the model (I have even tried setting it manually in edmx file, but still I am not receiving timestamp fcolumn in generated database).

    Please help.

    Wednesday, March 7, 2012 10:54 AM


  • Hi rideronthestorm,

    Welcome to MSDN Forum.

    In code first, if you want to set a property as timestamp, you need use byte[] type on it, except that, you also need to add an annotation on that property to specify this property is timestamp. Here's a sample.

    class TestClass
        public int ID { get; set; }
        public string Name { get; set; }
        public byte[] TimeStamp { get; set; } 

    Best Regards

    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Allen_MSDN Monday, March 12, 2012 2:11 AM
    Friday, March 9, 2012 3:16 AM