Insert runtime created object (with Alias attributes) causes {"SQL logic error or missing database\r\nnear \")\": syntax error"} exception

I’ve got the following scenario:

  • Have to retrieve data from a Solr apache server and store them to a DB
  • I dinamically create an item using a typebuilder that I’ve attached under
  • I try to perform an insert
  • I got the exception reported above and the GetLastSql returns > INSERT INTO “Object” () VALUES ()

Since the item I’ve generated has the AliasAttribute set shouldn’t this be honored to retrieve the table name?Is there a way I can manage this?

Here’s my sample project

What’s the generated Type and what is the Primary Key that you’re trying to INSERT? Find out what Type it is you’re trying to generate, test that Type with OrmLite then compare it against the dynamic type you’re trying to create.

Yes,
I’ve tested it but looking at your source code, it seems you get the properties via and that’s an object at runtime…have u got a moment to check my sample?
Thanks

OrmLite supports creating tables using typed code-first POCOs, if you create what’s equivalent to a typed POCO it should work without OrmLite caring it was created dynamically so I’d start with what Type you’re trying to create and compare it with the Type you’ve created.