dcsimg
Results 1 to 2 of 2

Thread: Entity Framework and TimeStamp/RowVersion

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2018
    Posts
    42

    Question Entity Framework and TimeStamp/RowVersion

    Hi everyone,

    I'm reading a book to learn how to use Entity Framework, exactly using "Code First".

    The book takes the issue of Concurrency and tell how to avoid problems with it (if I'm honest, I thought using a database with SQL Server Express would do it by himself configuring nothing special).

    Since the book is in english and it's not my first language perhaps I'm not understanding it completely, so I come here to see if someone can lend me a hand.

    The book explains how to add concurrency in some different ways, using annotations on the definition of the classes that contains the tables and also using the fluent API. My doubt comes when the book later talks about configuring non-timestamp fields for concurrency. I don't know if it's an alternative way to do this or I've to do togheter with the definition of a certain field of byte kind and declared as TimeStamp.

    To sum up, I've add this field to all my classes that defines a table:

    Code:
    [Timestamp]
    public byte[] RowVersion { get; set; }
    Is this enought to be sure I'll not have concurrency problems or I have to so something else??

    Many thanks

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    5,574

    Re: Entity Framework and TimeStamp/RowVersion

    If you are not interfering with the rowversion yourself (it can be done) and let the sql database handle the inserted values then I guess you are fine.

    Edit:
    I believe I show the article you read. Be caution as doing this type of concurrency can add overhead to large database.
    Last edited by sapator; May 22nd, 2019 at 04:12 AM.
    Slow as hell.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width