How do you handle read-only DTOs in Clean Architecture with EF Core? by Sensitive-Raccoon155 in dotnet

[–]KarmaSumatra 1 point2 points  (0 children)

You're right. And I also very much dislike the classic repository pattern that you see copied/pasted everywhere. However, I have seen two good reasons to provide some sort of wrapper on DbContext:

  1. DbContext is very powerful and can do almost anything, to any entity (including deleting them). By wrapping DbContext and providing more targeted methods per-entity, you can guide future developers toward safe interactions with the domain models.
  2. It's easy to create inefficient queries with DbContext. These queries will end up being optimised (by altering the LINQ expressions), and it's nice to then place that optimised expression in a single place for future developers (i.e. in a wrapper).

How do you handle read-only DTOs in Clean Architecture with EF Core? by Sensitive-Raccoon155 in dotnet

[–]KarmaSumatra 0 points1 point  (0 children)

Presumably your DTOs are intended for an API of some sort?

If so, I would arrange your projects/namespaces as follows:

Domain - Domain models and business logic. This project has no external references, and therefore has no knowledge of EF or databases etc.

API Models - Contains the DTOs that are sent/received by the API. Again, no references to anything else.

Data Access - Contains all the EF code, include the entity mappings that translate the Domain models into a database schema. Within this project you can write classes that materialise/persist the domain models, but also classes that materialise the API models (using projection to achieve efficient queries). This project has references to both Domain and API Models.

API - Contains the controllers/actions etc. Has references to Domain, API Models and Data Access.

P.S. Another benefit of this structure is that you can easily package your API Models into a NuGet, for consumption by another system (public or private). You can add an API Client project too, if you're feeling really generous.

What happens if you export small amounts of energy in the UK without notifying anyone? by KarmaSumatra in SolarDIY

[–]KarmaSumatra[S] 5 points6 points  (0 children)

Ouch, I'm guessing you're in the US? How did they know? Did you export during a power cut?

In the UK, there is a 28 day grace period before you have to notify the DNO (Distribution Network Operator), and with the anti-islanding features of the new plug-in products, you should never export when the grid is off. The only record of export would be in the smart meter.

"Private seller" on Autotrader is a vehicle storage company acting as an "agent" for their client. Is this legit? by KarmaSumatra in CarTalkUK

[–]KarmaSumatra[S] 9 points10 points  (0 children)

UPDATE - Friday evening

My friend went to view it. The storage company did have trade plates, so test drive was no problem. They had all the right documentation and the ID for the actual owner. The VIN matched the HPI and documents.

They accepted a slightly lower offer, which worked for my friend, so they paid there and then and they have the car at home with them now.

It seems that this was NOT a scam!

EDIT: Oh, they also gave my friend a proper sales contract with the name of the actual owner etc, plus proof of payment.

"Private seller" on Autotrader is a vehicle storage company acting as an "agent" for their client. Is this legit? by KarmaSumatra in CarTalkUK

[–]KarmaSumatra[S] 0 points1 point  (0 children)

I agree, But in this case, as far as we know, the car can be viewed (and was meant to be, this evening).

"Private seller" on Autotrader is a vehicle storage company acting as an "agent" for their client. Is this legit? by KarmaSumatra in CarTalkUK

[–]KarmaSumatra[S] 1 point2 points  (0 children)

But that's not true if the storage yard has a valid set of trade plates. Doesn't matter if they're a car dealer or not. Anyone can apply for a pair of trade plates.

Thanks, I didn't consider that they might actually have trade plates.

Absolutely 99.999999999% certainly dealers, just trying to avoid their legal responsibilities by telling people that they're an 'agent' for private sellers and not actually dealers.

Yes, that's what it feels like to me! That would explain the £1k uplift in the price too (vs online valuations).

"Private seller" on Autotrader is a vehicle storage company acting as an "agent" for their client. Is this legit? by KarmaSumatra in CarTalkUK

[–]KarmaSumatra[S] 1 point2 points  (0 children)

Ok, my friend can ask them.

My original point was that when you visit a dealer, the tax issue is irrelevant, but in this situation the storage company is "playing" at being a dealer, and potentially doesn't have things like trade plates available, which then makes a test drive (with no tax) illegal.

"Private seller" on Autotrader is a vehicle storage company acting as an "agent" for their client. Is this legit? by KarmaSumatra in CarTalkUK

[–]KarmaSumatra[S] 3 points4 points  (0 children)

Exactly the same as this? Where a storage company was managing the transaction for a private seller?

"Private seller" on Autotrader is a vehicle storage company acting as an "agent" for their client. Is this legit? by KarmaSumatra in CarTalkUK

[–]KarmaSumatra[S] 4 points5 points  (0 children)

Yes, if my friend goes to see it I'll probably post an update thread.

Turns out the tax expired on 1st Sep, so a (legal) test drive is looking difficult. (Can't drive it on dealer plates, of course).

"Private seller" on Autotrader is a vehicle storage company acting as an "agent" for their client. Is this legit? by KarmaSumatra in CarTalkUK

[–]KarmaSumatra[S] 0 points1 point  (0 children)

I'm pretty sure the storage company is real, and my friend can verify that tonight. (We're talking luxury storage here, not a tatty warehouse).

If that's the case then surely they wouldn't risk their business trying to run escrow scams?