question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not Implemented Exception While Using SRTP

See original GitHub issue

Issue Calling code similar to below will result in a Not Implemented Exception. Area of code is found here for the ‘isIn’ function https://github.com/Dzoukr/Dapper.FSharp/blob/master/src/Dapper.FSharp/MSSQL/LinqExpressionVisitors.fs#L218

Use Case I have a quite a few similar queries where I need to check for existence in various tables and other minute validations. If I am thinking about this correctly, I think adding support for SRTP would provide benefit in being able to create re-usable queries so I don’t have to create a new query for each table.

#r "nuget: Dapper.FSharp"
open Dapper.FSharp
open Dapper.FSharp.MSSQL
open System.Data

[<CLIMutable>]
type Person = 
    { 
        Id : int 
    }

[<CLIMutable>]
type Dog = 
    { 
        Id : int 
    }

let people = table'<Person> "People"
let dogs = table'<Dog> "Dogs"

let inline getIds<'T 
    when 'T: (member Id : int)> 
    (ids : int list) 
    (querySource : QuerySource<'T>) 
    (conn : IDbConnection) 
    = async {
    // This is required in order to use SRTP w/ the query builder
    let getId (item : 'T) = item.Id
    
    let query = select {
        for row in querySource do
            where (isIn (getId row) ids)
    }

    return! conn.SelectAsync<'T>(query) |> Async.AwaitTask
}

Issue Analytics

  • State:closed
  • Created 2 months ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
1eyewondercommented, Jul 21, 2023

Yep, that makes sense. Thank you so much for your help!

1reaction
JordanMarrcommented, Jul 21, 2023

Personally, I will always opt for an extra type or function over SRTP for simplicity. I think using an anonymous record would be the better play in this case:

let queryByIds<'T> (ids: int list) tableName (conn: IDbConnection) = 
  async {
    let query = 
      select {
          for row in table'<{| Id: int |}> tableName do
          where (isIn row.Id ids)
      }

    return! conn.SelectAsync<'T>(query) |> Async.AwaitTask
  }
let! dogs = queryByIds<Dog> [1;2;3] "Dogs" conn
Read more comments on GitHub >

github_iconTop Results From Across the Web

NotImplementedException Class (System)
The NotImplementedException exception is thrown when a particular method, get accessor, or set accessor is present as a member of a type but...
Read more >
c# - System.NotImplementedException error
This is code in your solution; so on your page, your method is likely not implemented. Share.
Read more >
SRTP Configuration and Troubleshooting
Authentication provides assurance that packets are from the purported source, and that the packets have not been tampered with during transmission. Encryption ...
Read more >
Issues with DTLS-SRTP setup
I've recently started working on getting the existing Asterisk 11 DTLS-SRTP implementation to work with Chrome and Firefox WebRTC implementations.
Read more >
Oops, error creating inbound SRTP session for component ...
It's a libsrtp error in srtp_create . First of all, try master, as lines in dtls.c don't match. Have you also checked if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found