Skip to content

Question: Should all properties of class be updated when using fields? #573

Open
@Swoorup

Description

@Swoorup

I have table like

[<CLIMutable>]
type commandentity =
  { id: int64
    eventid: Guid
    aggregateid: Guid
    commandid: Guid
    causationid: Guid
    correlationid: Guid
    commandpayload: string
    payloadtype: string
    queuename: string
    expectedversion: int64
    processid: obj
    ``Timestamp Utc``: DateTime }

And insert using

  let createNewCmd () =
    counter <- counter + 1
    let cstr = string counter

    { commandentity.id = -1L
      aggregateid = Guid.NewGuid()
      eventid = Guid.NewGuid()
      commandid = Guid.NewGuid()
      causationid = Guid.NewGuid()
      correlationid = Guid.NewGuid()
      commandpayload = cstr
      payloadtype = cstr
      queuename = cstr
      expectedversion = 1L
      processid = null
      ``Timestamp Utc`` = DateTime.UtcNow }

    let a = [| createNewCmd ();  |]
    // ctx.DeleteAll<CommandEntity>() |> ignore

    let fieldsToWrite =
      Field.From(
        "eventid",
        "aggregateid",
        "commandid",
        "causationid",
        "correlationid",
        "commandpayload",
        "payloadtype",
        "queuename",
        "expectedversion",
        "processid")
                                        
    let ret = ctx.InsertAll(entities=a, fields=fieldsToWrite)
    printfn "ctx.InsertedAll %A" a
    printfn "ctx.InsertedAll = %d" ret

However the a or the entities isn't updated.

ctx.InsertedAll [|{ id = -1L
    eventid = cedace2e-1686-4b79-a3fa-fdf168e59088
    aggregateid = c262825d-5419-4e75-a94c-0529e4500d6e
    commandid = 7ea4beb7-09a7-4a78-b535-9e979efb883e
    causationid = 3856515a-67bc-4b73-b1cd-6e57086e7d09
    correlationid = fb7622c5-9150-4ac6-902d-0a13614bb737
    commandpayload = "1"
    payloadtype = "1"
    queuename = "1"
    expectedversion = 1L
    processid = null
    Timestamp Utc = 16/09/2020 17:06:27 }|]
ctx.InsertedAll = 1

Querying it using a select functions, gives the id as 1 which is expected. Should repodb update all columns to latest?

V: RepoDb 1.12.0-beta3

Metadata

Metadata

Assignees

Labels

questionFurther information is requestedunder assessmentThe feature request is under assessmentwontfixThis will not be worked on

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions