Giter Site home page Giter Site logo

Comments (5)

dmitry-a-morozov avatar dmitry-a-morozov commented on August 23, 2024

@jackfoxy Do you need one-way (from record to json) serialization or two-way (from json to record too) ?

from fsharp.data.sqlclient.

jackfoxy avatar jackfoxy commented on August 23, 2024

Record to JSON would really be a nice feature for SqlCmd.

I will be receiving posts with JSON that is almost like table row in my database, but I am assuming I will parse with Newtonsoft JSON (or similar) to build in code SQL for SqlCmd. This will be the first time I have updated/inserted w/ SqlCmd. Does it support UPDATE/INSERT from record instead of explicit SQL? The JSON I will receive does not correspond to all the SQL columns I need for an INSERT (and also not for an UPDATE), and there is probably going to be a little logic involved, so if you did implement something like JSON to SqlCmd record I might not be able to use it anyway.

from fsharp.data.sqlclient.

jackfoxy avatar jackfoxy commented on August 23, 2024

One more thing... Record to JSON from SqlCmd in some other way than CLIMutable solves one hassle and creates another, as now I need to tell the "automagic" in WebAPI to emit JSON I have explicitly built. (I'm sure it's easy to do, just one more thing for me to learn and one more workaround to put in the code). At this point I don't know enough to evaluate the trade-off.

from fsharp.data.sqlclient.

dmitry-a-morozov avatar dmitry-a-morozov commented on August 23, 2024

I meant to write for docs to show update examples but here is sample code
https://github.com/fsprojects/FSharp.Data.Experimental.SqlCommandProvider/blob/master/src/SqlCommandProvider.Samples/WpfDataBinding/Program.fs#L29
Basic idea is to create SqlDataAdapter based on original command.
So you might want to use ResultType.DataTable.
I believe Json.NET can be configured to support DataTable via DataTableConverter.
http://james.newtonking.com/json/help/index.html?topic=html/T_Newtonsoft_Json_Converters_DataTableConverter.htm
In general speaking of Records serialization, I think I might change SqlCommnadProvider to erase ResultType.Records to dynamic objects instead of obj[]. This should help.

from fsharp.data.sqlclient.

dmitry-a-morozov avatar dmitry-a-morozov commented on August 23, 2024

Release 1.1.25

from fsharp.data.sqlclient.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.