Hi,
I’ve got a model like this:
public class Company : IHasId < long > {
[PrimaryKey]
[AutoIncrement]
public long Id { get; set; }
public ulong RowVersion { get; set; }
public string Description {get;set;}
…}
When I try to save a new company I get a exception.
var company = new Company() {Description = “description”};
db.Save(company);
I get this exception:
Exception of type ‘ServiceStack.Data.OptimisticConcurrencyException’ was thrown.
at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.UpdateAndVerify[T](IDbCommand dbCmd, Action
1 commandFilter, Boolean hadRowVersion) in C:\BuildAgent\work\27e4cc16641be8c0\src\ServiceStack.OrmLite\OrmLiteWriteCommandExtensions.cs:line 455 at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.UpdateInternal[T](IDbCommand dbCmd, Object obj, Action
1 commandFilter) in C:\BuildAgent\work\27e4cc16641be8c0\src\ServiceStack.OrmLite\OrmLiteWriteCommandExtensions.cs:line 446
at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.Update[T](IDbCommand dbCmd, T obj, Action1 commandFilter) in C:\BuildAgent\work\27e4cc16641be8c0\src\ServiceStack.OrmLite\OrmLiteWriteCommandExtensions.cs:line 425 at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.Save[T](IDbCommand dbCmd, T obj) in C:\BuildAgent\work\27e4cc16641be8c0\src\ServiceStack.OrmLite\OrmLiteWriteCommandExtensions.cs:line 973 at ServiceStack.OrmLite.OrmLiteWriteApi.<>c__DisplayClass35_0
1.b__0(IDbCommand dbCmd) in C:\BuildAgent\work\27e4cc16641be8c0\src\ServiceStack.OrmLite\OrmLiteWriteApi.cs:line 361
at ServiceStack.OrmLite.OrmLiteExecFilter.Exec[T](IDbConnection dbConn, Func2 filter) in C:\BuildAgent\work\27e4cc16641be8c0\src\ServiceStack.OrmLite\OrmLiteExecFilter.cs:line 64 at ServiceStack.OrmLite.OrmLiteReadExpressionsApi.Exec[T](IDbConnection dbConn, Func
2 filter) in C:\BuildAgent\work\27e4cc16641be8c0\src\ServiceStack.OrmLite\OrmLiteReadExpressionsApi.cs:line 17
at ServiceStack.OrmLite.OrmLiteWriteApi.Save[T](IDbConnection dbConn, T obj, Boolean references) in C:\BuildAgent\work\27e4cc16641be8c0\src\ServiceStack.OrmLite\OrmLiteWriteApi.cs:line 361
What I’m doing wrong?
Thanks a lot