I have been create a project in VS2015 with entity framework 6 - Code First with
I am try Migrations
command: Add-Migration Initial
error: Sequence contains no matching element
I've been trying a bunch of things, and get the cause of this
[Timestamp]
public byte[] RowVersion { get; set; }
this is the sample model-code first
using MySql.Data.Entity;
using System.Data.Common;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace TokoBersama.Model
{
// Code-Based Configuration and Dependency resolution
[DbConfigurationType(typeof(MySqlEFConfiguration))]
public class MySqlDatabaseConnection : DbContext
{
#region Tabels
public DbSet<returnpenjualan> ReturnPenjualan { get; set; }
#endregion
#region member Event
public MySqlDatabaseConnection()
: base("name=myConnectionString")
{
}
public MySqlDatabaseConnection(DbConnection existingConnection, bool contextOwnsConnection)
: base(existingConnection, contextOwnsConnection)
{
}
//protected override void OnModelCreating(DbModelBuilder modelBuilder)
//{
// base.OnModelCreating(modelBuilder);
//
// Map entity to table
// modelBuilder.Entity<jenis>().MapToStoredProcedures();
//}
#endregion
}
#region tabels
public class returnpenjualan
{
[Key]
[StringLength(12)]
public string frjb { get; set; }
[Required]
[StringLength(12)]
public string fjb { get; set; }
//THE CAUSE OF ERROR
[Timestamp]
public byte[] RowVersion { get; set; }
[Required]
[StringLength(15)]
public string kepada { get; set; }
[Required]
[StringLength(45)]
public string alamat { get; set; }
[StringLength(45)]
public string ktp { get; set; }
[Required]
public double jumlahreturnpenjualan { get; set; }
[Required]
[StringLength(45)]
public string username { get; set; }
}
#endregion
}
ASK
I've search tutorial and the like for using Timestamp in DataAnnotation and get the same answer for using "Timestamp", is there something iam missing to use "Timestamp"???
I have been search "mysql ef6: timestamp" and using this code for the time being, i don't know this the best solution for my question, is there some another solution, please reply
[Column(TypeName = "timestamp")]
public DateTime RowVersion { get; set; }