Hey
I’m rewriting my app from ASP.NET MVC to ASP.NET Core.
just simple insert from MVC
db.Insert<Table>(new MyObject { Id = null, A = false, B = stawki.Name, C = stawki.Type, D = guid});
in Core i have:
var carriers = new Table { Id = null, A = false, B = stawki.Name, C = stawki.Type, D = guid };
Db.Insert(carriers);
Startup.cs:
container.Register<IDbConnectionFactory>(
c=>
{
OrmLiteConnectionFactory dbFactory = new OrmLiteConnectionFactory(Configuration.GetConnectionString("DefaultConnection"), OracleDialect.Provider);
dbFactory.RegisterConnection("DefaultConnection", dbFactory);
return dbFactory;
});
My model is:
[PrimaryKey]
[Sequence("SEQ_KT_PRZEWOZNICY_AI")]
[JsonProperty("id")]
public int? Id { get; set; }
and when trying to do just simple insert is shows:
Object reference not set to an instance of an object.at ServiceStack.OrmLite.Oracle.OracleOrmLiteDialectProvider.GetNextValue(IDbCommand dbCmd, String sequence, Object value) in C:\BuildAgent\work\27e4cc16641be8c0\src\ServiceStack.OrmLite.Oracle\OracleOrmLiteDialectProvider.cs:line 838
at ServiceStack.OrmLite.Oracle.OracleOrmLiteDialectProvider.SetParameterValues[T](IDbCommand dbCmd, Object obj) in C:\BuildAgent\work\27e4cc16641be8c0\src\ServiceStack.OrmLite.Oracle\OracleOrmLiteDialectProvider.cs:line 355
at ServiceStack.OrmLite.OrmLiteWriteCommandExtensions.Insert[T](IDbCommand dbCmd, T obj, Action1 commandFilter, Boolean selectIdentity) in C:\BuildAgent\work\27e4cc16641be8c0\src\ServiceStack.OrmLite\OrmLiteWriteCommandExtensions.cs:line 687 at ServiceStack.OrmLite.OrmLiteWriteApi.<>c__DisplayClass5_0
1.b__0(IDbCommand dbCmd) in C:\BuildAgent\work\27e4cc16641be8c0\src\ServiceStack.OrmLite\OrmLiteWriteApi.cs:line 72
at ServiceStack.OrmLite.OrmLiteExecFilter.Exec[T](IDbConnection dbConn, Func`2 filter) in C:\BuildAgent\work\27e4cc16641be8c0\src\ServiceStack.OrmLite\OrmLiteExecFilter.cs:line 64
at KT.Repository.StawkiRepository.Add(StawkiListModel stawki) in C:\Users\marcin.basiaga\Desktop\KThh\KT\KT\Repository\StawkiRepository.cs:line 42
at KT.Controllers.StawkiController.AddStawki(StawkiListModel stawki) in C:\Users\marcin.basiaga\Desktop\KThh\KT\KT\Controllers\StawkiController.cs:line 76
It seems to be problem with sequences cause if y do insert of MyObject = { Id= 545,…} it’s insert
any ideas?