ngs-doo / revenj

DSL Platform compatible backend
https://dsl-platform.com
BSD 3-Clause "New" or "Revised" License
268 stars 44 forks source link

(AllowAspects-IDatabaseQuery.Fill) Unable to cast object of type 'System.Data.DataSet' to type 'System.Data.DataTable'. #123

Closed Kobus-Smit closed 5 years ago

Kobus-Smit commented 5 years ago

Hi @zapov

<add key="Revenj.AllowAspects" value="true" />
IDatabaseQuery qry
...
var dataTable = qry.Fill(sql);

throws this exception:

System.InvalidCastException
  HResult=0x80004002
  Message=Unable to cast object of type 'System.Data.DataSet' to type 'System.Data.DataTable'.
  Source=Revenj.Core.Interface
  StackTrace:
   at Revenj.Extensibility.AspectRepositoryHelper.<>c__DisplayClass50`4.<Around>b__4e(Object w, Object[] args, Func`2 baseFunc)

Any clues on how that can be fixed?

zapov commented 5 years ago

It's due to wrong API usage in Revenj.Plugins.Aspects.DatabaseTrace.Configuration It should be

aspectRegistrator.Around<IDatabaseQuery, IDbCommand, DataSet, int>(

I'll fix it for 1.5.1 You can either remove the Aspects reference (you don't really need it, it's just for some logging stuff) or rebuild it with a fix

Kobus-Smit commented 5 years ago

Thanks. I find the logging stuff useful in dev & debugging to see the sql and durations.