sapiens / SqlFu

Fast and versatile .net core data mapper/micro-orm
Other
229 stars 50 forks source link

Upsert sample? #53

Closed cuentawarra closed 9 years ago

cuentawarra commented 9 years ago

I dont know how to do an upsert nor select table where i have the following code dynamic list is a dynamic object from a linq query:

        var cnx = @"host=localhost;port=5432;database=db1;user id=postgres;   password=testing";
        var sql = new SqlFuConnection(cnx, DbEngine.PostgreSQL);
        sql.Upsert(dynamiclist);

How i can do it right? Thank you.

sapiens commented 9 years ago

I don't think Upsert works with lists

cuentawarra commented 9 years ago

Then how i can do to work

sapiens commented 9 years ago

Try it the old fashioned way, try to update rows then do inserts when the update returns 0. But I think you can't use any strongly typed helpers, dynamic is supported only for queries (mapping to).