Skip to content

IsRowVersion or [Timestamp] on property that maps to provider byte[] type should generate rowversion column #12434

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
ajcvickers opened this issue Jun 20, 2018 · 1 comment · Fixed by #29961

Comments

@ajcvickers
Copy link
Contributor

As described in #5936, mapping a ulong with a store type of "rowversion" (or "timestamp") results in a rowversion column in SQL Server that can be used effectively in LINQ queries. This should also work for cases like this:

public class Blog
{
    public int Id { get; set; }
    public ulong RowVersion { get; set; }
}

modelBuilder
    .Entity<Blog>()
    .Property(e => e.RowVersion)
    .HasConversion<byte[]>()
    .IsRowVersion();

and this:

public class Blog
{
    public int Id { get; set; }

    [Timestamp]
    public ulong RowVersion { get; set; }
}

modelBuilder
    .Entity<Blog>()
    .Property(e => e.RowVersion)
    .HasConversion<byte[]>();

And possibly even when .HasConversion<byte[]>() is not used explicitly, since IsRowVersion or [Timestamp] imply this, at least for SQL Server

@AndriySvyryd
Copy link
Member

Related: #12436

@ajcvickers ajcvickers modified the milestones: 8.0.0, 8.0.0-preview1 Jan 29, 2023
@ajcvickers ajcvickers modified the milestones: 8.0.0-preview1, 8.0.0 Nov 14, 2023
@ajcvickers ajcvickers removed their assignment Sep 1, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
2 participants