Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6211237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:18:07+00:00 2026-05-24T06:18:07+00:00

I am using EF4 and creating classes through the Entity design surface then generating

  • 0

I am using EF4 and creating classes through the Entity design surface then generating the database from them. I want to add an attribute to some of the classes to show the timestamp they were last updated.

I have added a Version attribute to them, but I don’t know which .Net datatype to associate with them so they become either Timestamp or RowVersion in the database when it is generated.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:18:08+00:00Added an answer on May 24, 2026 at 6:18 am

    You use byte[] type for rowversion/timestamp

    Example use: http://www.ienablemuch.com/2011/07/using-checkbox-list-on-aspnet-mvc-with_16.html

    If you are in the designer, just type in byte[] or System.Byte[], I think the field types dropdown selection on EF designer can be typed-in upon.

    Given this DDL

    create table Movie
    (
    MovieId int identity(1,1) not null primary key,
    MovieName varchar(100) not null unique,
    MovieDescription varchar(100) not null unique,
    YearReleased int not null,
    Version rowversion  -- rowversion and timestamp are alias of each other
    );
    

    This is the class mapping:

    public class Movie
    {
        [Key]
        public virtual int MovieId { get; set; }
         
        [   Required, Display(Name="Title")
        ]   public virtual string MovieName { get; set; }
         
        [   Required, Display(Name="Description")
        ]   public virtual string MovieDescription { get; set; }
         
        [   Required, Display(Name="Year Released"), Range(1900,9999)
        ]   public virtual int? YearReleased { get; set; }
         
        [Timestamp]
        // byte[] is the rowversion/timestamp .NET type
        public virtual byte[] Version { get; set; }  
     
         
        public virtual IList<Genre> Genres { get; set; }              
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using EF 4.1 Code first I wanted to stop EF creating database from Models.
I'm using EF4. I want to insert a new MyObject into the database. MyObject
I am getting started with Entity Framework using EF4 in VS 2010 RC. So
Possible Duplicate: Entity Framework with NOLOCK I'm using EF4 and .Net 4 to load
I have to share ObjectContext (from EF4) between many objects, so i'm creating one
I want to execute stored procedure with one parameter that returns table using EF4
Im using EF4 in VS2010, POCO's and the model-first approach. My entity has the
New to Entity Framework .Using EF4. I have found articles and managed to use
I'm creating a multi-tenant Asp.Net MVC 3 Web app, and using EF4.1 code first
How can I retrieve Tuples at Select using EF4? var productCount = (from product

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.