Closed oschwab closed 7 years ago
Hi, are you looking at the 3.2.x branch?
6.3.x even!
Yes sorry for forgetting this precision, I use Microlite 6.3.0.0 (last from nuget)
The actual exception text will be from the database itself, are the property types in your object compatible with the column types in the table?
As Fetch< > works, I bet this is because of DbGenerated ID. I used a sequence and trigger as explained in Firebird Docs
ID Column seems correctly detected by mapping though. And log files (Microlite or Firebird) don't show any query.
Can you paste the full stack trace?
Of course !
MicroLite.MicroLiteException was unhandled HResult=-2146233088 Message=Invalid data type: 26. Source=MicroLite StackTrace: at MicroLite.Core.Session.ExecuteScalarQuery[T](SqlQuery sqlQuery) at MicroLite.Core.Session.InsertReturningIdentifier(IObjectInfo objectInfo, Object instance) at MicroLite.Core.Session.Insert(Object instance) at MicroliteEval.Repository.Database.DBRepository`1.Insert(T obj) in C:\Users\Olivier Schwab\Documents\Diasys\Development\dt-soft\proto\MicroliteEval\MicroliteEval\Repository\Database\DBRepository.cs:line 60 at MicroliteEval.Program.Main(String[] args) in C:\Users\Olivier Schwab\Documents\Diasys\Development\dt-soft\proto\MicroliteEval\MicroliteEval\Program.cs:line 55 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: HResult=-2147024809 Message=Invalid data type: 26. Source=FirebirdSql.Data.FirebirdClient StackTrace: at FirebirdSql.Data.Common.TypeHelper.GetDbDataTypeFromDbType(DbType type) at FirebirdSql.Data.FirebirdClient.FbParameter.set_DbType(DbType value) at MicroLite.Driver.DbDriver.BuildParameter(IDbDataParameter parameter, String parameterName, SqlArgument sqlArgument) at MicroLite.Driver.DbDriver.BuildCommand(IDbCommand command, SqlQuery sqlQuery) at MicroLite.Core.SessionBase.ConfigureCommand(SqlQuery sqlQuery) at MicroLite.Core.Session.ExecuteScalarQuery[T](SqlQuery sqlQuery) InnerException:
This looks to be where the exception comes from
FirebirdSql.Data.Common.TypeHelper.GetDbDataTypeFromDbType(DbType type)
If I understand correctly, during the query construction, Microlite asks to FB provider a mapping for a type , and the provider complains about it ?
It's when MicroLite sets the value for a parameter.
It could be related to the enum, do you have any constraints on that column & a mismatch between the enum values and what's in the db?
Unfortunately, same error message with an entity without enum. Two other points :
internal enum DbDataType { Array, BigInt, Binary, Boolean, Char, Date, Decimal, Double, Float, Guid, Integer, Numeric, SmallInt, Text, Time, TimeStamp, VarChar, Null }
The last one (Null) has 17 as value, so obviously 26 is not in the list. May be it's linked to my version of the provider. I'm gonna try to debug inside MicroLite directly.The problems comes from DbType.DateTime2 (= 26). Trying to investigate deeper.
Ah OK, the default mapping for System.DateTime
in MicroLite 6.3+ is DbType.DateTime2
, however if Firebird doesn't support DbType.DateTime2
then you will need to override that . See the DateTime mapping section of Upgrading to MicroLite 6.3 as that explains how to alter the default mappings.
Cristal clear ! My test project is working perfectly now. I must now perform some benchmarks . Maybe this information should be added in using Firebird page ? I have some other questions (mainly regarding managing 1-1 and 1-many relationships) but I'll create another issue for it. This issue can be closed, thank you very much for your quick help.
I'll update the page - to be honest I haven't used Firebird since I did the original MicroLite implementation so I wasn't aware that it didn't support DbType.DateTime2
until 30 mins ago when you dug into your problem.
To be honest on my side, Firebird is an obligation, not a real choice ....
Hello,
I'm evaluating using Microlite with Firebird database in version 3. I'm stuck on the following problem: Executing session.Insert triggers the exception: I logged Microlite output but all seems OK , mapping included :
https://gist.github.com/oschwab/66c7a740ca8ff6b80502c5b6f1d7a3d7#file-gistfile1-txt
I had a quick look to Microlite code, and found no path from where this message is triggered. Nothing on Firebird side too.
Thanks by advance for help.