jeudi 21 janvier 2016

Replacement for sqlite-extensions: InsertWithChildren (too many Variables)

i have a project here, were a big amount of data is read from different sources. In a special logic, a data/object-modell is build with these data. So as a result i retrieve a complete SQLite capable object model.

The data were previously written to the SQLite database using a simple:

  _connection.InsertWithChildren(model, true);

But, since the source of the data became bigger, this is not possible anymore, cause the Insert method will throw an "too many variables" exception. ;(

Now, i am looking for an replacement for this method. The difficulty here is that within my model, i nearly always have Foreign-Keys in both directions. Parent has Childs, Childs knows Parent.

Performance is not an issue. I don't care if the function needs 10Seconds or 5Minutes. But does anyone have an idea how to handle the Insert, while all Foreign Keys are filled correctly?

If i use a simple

foreach(var entity in _entityList)
  _connection.Insert(entity);

the foreign Keys (IDs) are all Guid.Empty;

best regards and cheers,

Chris

Aucun commentaire:

Enregistrer un commentaire