Nergy101
❔ Entity framework custom select query
Just checking here: the same query runs on the same db/connectionstring directly just fine?
The error suggests it's a LINQ-TO-SQL problem...
I'd suggest using Dapper-ORM in that case, through extension methods on your dbcontext like you said... Its basically like doing the raw query but has some nice features for mapping to types in a more "raw" manner (different than linq to Sql)
Or use the barebones c# Sql command and Sql result classes, with those I'm quite sure you can just get back the exact same records as you'd expect
3 replies
✅ Dependency Inversion Principle, Dependency Injection
I think the marker interface is confusing you.
Normally your interfaces would be pretty specific to the functionality you want to achieve
E.g
ICow
- walk()
- stop()
- Moo()
ICat
- walk(int speed) <- different!
- stop()
- Meow() <- different
If I wanted to program a cat I'd use the ICat and if I wanted to program a cow I'd use ICow.
Now what if I want to list all animals I have interfaces for?
That's what you use a "marker" interface for.
I'd add to ICat and the ICow interfaces. Now I could list out all animals and maybe add more generic functionality like "MakeASound" or the "stop" method since both ICat and ICow have the same Stop method signature
Does this help?
6 replies
❔ Send using http post with multiple parameters, to an endpoint defined in C# with minimal APIs
Ill list some options for you to google/research into:
you could try using "query parameters" from the URL
you could try using a HTTP body that is JSON representation of the
class Test
, and using a single parameter of type Test
After some googling I found that .net6 and minimal-api's doesnt support [FromForm]
<-- Hints to how to find the query parameters ;)8 replies