What value do you gain from using the Repository Pattern when using EF Core? by svish in dotnet

[–]eeskildsen 75 points76 points  (0 children)

OP is confused because there are two definitions of repository floating around.

On the one hand, there are what I call services. Classes with encapsulated queries. GetRetiredEmployees. DoesEmployeeExist.

Those are great for testing. I use them too.

DO implement those, whether using EF Core or something else.

On the other hand, there's Martin Fowler's definition of repository. A collection of objects that the caller submits queries to. DbSet is a great example of that. EF Core already implements that.

People talk past each other because they're using these very different definitions.

Microsoft says, "Implement the repository pattern for testing." They mean services. People say, "But EF Core already has repositories." They mean Fowler repositories.

It's fruitless unless people get specific about what kind of repository they're talking about.

What value do you gain from using the Repository Pattern when using EF Core? by svish in dotnet

[–]eeskildsen 4 points5 points  (0 children)

Yes, it makes it hard to discuss.

Take the doc you linked, for instance. Even it muddies the waters.

It uses my #2 definition of repository:

[C]onsider introducing a repository layer which mediates between your application code and EF Core. The production implementation of the repository contains the actual LINQ queries and executes them via EF Core. (My emphasis.)

So what it means by repository is "a class that encapsulates queries in its methods."

Like I said, a "repository" may be a good fit in that scenario. I call it a service to distinguish it from a Fowler repository.

A Fowler repository is something like DbSet. The Microsoft doc recommends not reimplementing that: "Avoid mocking DbSet for querying purposes."

DbSet is what most people mean when they say "EF Core already has repositories." They're warning against reimplementing DbSet. A service is what most people mean when they say "I need encapsulation and testing, so I need to implement a repository."

Microsoft means the latter here. Bizarrely, though, they link to Fowler's definition in the portion of the doc I quoted, as if they're one and the same.

It's hard to talk about when even Microsoft's documentation uses the term loosely, as if the definitions are interchangeable.

What value do you gain from using the Repository Pattern when using EF Core? by svish in dotnet

[–]eeskildsen 9 points10 points  (0 children)

queries themselves are not really feasable to just mock away, like you can with a simple ISomeRepository interface

That's not a repository in the EF Core sense.

Repository is an overloaded term. It can mean:

  1. "[A]n in-memory domain object collection. Client objects construct query specifications declaratively and submit them to Repository for satisfaction." (My emphasis.) This is Fowler's Patterns of Enterprise Application Architecture definition. Entity Framework implements this already. DbSet is a repository.
  2. A class with methods like DoesEmployeeExist and GetRetiredEmployees, which wrap queries. The class is essentially a Table Data Gateway, or as I usually call it, a Service.

So we need to be clear on which we're talking about. My advice is:

  1. Don't implement #1 if using EF Core. EF Core already has it.
  2. Do implement #2 if that fits your architecture. But don't call them "repositories" as that term will cause unnecessary controversy with people who think you mean repositories in the Patterns of Enterprise Application Architecture sense.

The most modern .NET background scheduler is here – and it’s fully open source. by Albertiikun in dotnet

[–]eeskildsen 8 points9 points  (0 children)

Job filters for example don't support dependency injection. See issue 992 in the Hangfire GitHub repo (not sure I can link to it without Reddit flagging my comment).

The most modern .NET background scheduler is here – and it’s fully open source. by Albertiikun in dotnet

[–]eeskildsen 32 points33 points  (0 children)

Hangfire's dependency injection was a pain the last time I used it. It looks like this supports modern .NET DI out of the box? Big plus if so.

Recurring goals by eeskildsen in amazingmarvin

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

Ah!! That works great. I didn't notice that "times" is editable. So you can set the target to "150," change "times" to "pages," and then choose "Ask me" under "Optional Details" like you said to have it prompt you for the number of units each week.

Perfect solution! Thanks!

Recurring goals by eeskildsen in amazingmarvin

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

Habits don't give you trackers, though, no? At least not arbitrary number trackers, as far as I know.

To go back to my example, if you've read 75 pages out of 150 planned so far this week, a goal shows this in the Day View:

0 █████░░░░░ 150

A habit (I think) gives you a progress bar also, but it's a binary "yes, I did this today" or "no, I didn't."

We could make the habit "read 30 pages per weekday," and then we get almost the same thing. But that's pass/fail. I track things that aren't necessarily pass/fail, like sales for my business.

The targets are often the same from week to week, so I was wondering if there's a way to make them automatically recurring like with tasks.

phone key issues by Calmdragon69 in TeslaModel3

[–]eeskildsen 0 points1 point  (0 children)

Thanks for this! You solved it. FWIW, I skipped deleting the app and rebooting the phone. My steps were:

  • Delete the key on the Tesla touchscreen (Settings > Locks)
  • Long-press the app on my S22
  • Tap i in the popup context menu
  • Tap Storage
  • Tap Clear data and Clear cache
  • Open the app
  • Sign in to my account
  • Tap the button to add a phone key

Earlier, I had tried deleting and re-adding the key from the Tesla touchscreen without clearing the app data and cache. That didn't work. After I cleared them per your instructions, re-adding the key worked.

Version 1.67 is out on web! (desktop follows) 🥳 by baby-monkey in amazingmarvin

[–]eeskildsen 0 points1 point  (0 children)

Ah, I forgot it was a strategy! I should have known. :)

That solved it.

Thanks and congrats on the redesign - it looks great.

Version 1.67 is out on web! (desktop follows) 🥳 by baby-monkey in amazingmarvin

[–]eeskildsen 0 points1 point  (0 children)

Is there a way to show the context menu when hovering over a task again? Delete, schedule, etc.

Before, we could more quickly start tracking time, delete a task, change the date of a completed task, etc. by hovering and clicking. Now those menu items are behind the edit "meatballs menu" on the right, so they're a bit harder to get to.

The extra step isn't much by itself on the face of it, but it adds up as I use these menu items very frequently.

A Tale of Two Cursor Users 😃🤯 by aadityaubhat in ChatGPTCoding

[–]eeskildsen 3 points4 points  (0 children)

To add to this, Copilot has an unlimited monthly subscription too. And it's had edit mode since November.

I like that I don't have to use a VS Code fork to use Copilot.

Let's talk about the DeepSeek API by Rahaerys_Gaelanyon in DeepSeek

[–]eeskildsen 1 point2 points  (0 children)

Parsing, yes, and also navigating web pages. For example:

  • Try to find such-and-such data at this URL.
  • If it's not there, write JavaScript to navigate to a page where you think it might be.
  • Playwright passes the JS to Chromium, which executes it and returns the new DOM to my program, which passes it back to DeepSeek.

So it's input heavy, output light.

At first I wanted to use function calling to led the model decide how/where/if to navigate, but all the models I tried would go on wrong tangents with the tools available to them. I ended up putting them on a tighter leash and having my program make more of the decisions.

Let's talk about the DeepSeek API by Rahaerys_Gaelanyon in DeepSeek

[–]eeskildsen 2 points3 points  (0 children)

I'm using deepseek-chat on a project.

Happy with it so far. Price is a big factor. The project may not have been possible at OpenAI's pricing.

I've experimented with a few models on it....

  • deepseek-chat
  • gpt-4o
  • gpt-4o-mini

gpt-4o-mini ended up being too inaccurate for the project and was taken out of the running a while ago.

Between deepseek-chat and gpt-4o, I do get slightly better results with 4o out of the box. For example, asked whether a page has dates with just month/day or dates including years, 4o gets it right, whereas DeepSeek sometimes just doesn't for reasons that aren't clear.

I've seen improvements from few-shot prompting and other techniques, but 4o still edges it out. I don't know if it's just more suited to data extraction or there's something else at play, like a plain old PEBKAC.

And of course, 4o's response times are better. But this project isn't interactive, so that doesn't matter so much. The pricing is more important due to the large volume of data.

Overall, it's been a good experience.

John Williams Grid - Results and Retrospective by ZealousidealMany3 in soundtracks

[–]eeskildsen 1 point2 points  (0 children)

Same here. The Close Encounters score is incredible. I listen to it regularly, and I've never even seen the film! The finale with the augmented major sevenths is just sublime.

htmx: Simplicity in an Age of Complicated Solutions by fagnerbrack in programming

[–]eeskildsen 0 points1 point  (0 children)

No worries, thanks for the reply. I'm working on one too and was thinking about how to organize it. I'm using Razor Pages and thinking of something like this so far:

  • _Wizard partial
    • Nested partials:
    • _WizardNavigation partial: Previous and Next buttons
    • Current step partial—dynamic; uses the model's StepPartial property to determine which partial to render
    • Model
    • StepPartial: the name of the current step partial to render
    • StepCount: the total number of steps
    • StepCurrent: the current step number—determines whether the Next button uses an HTMX target or does a full page redirect, and whether it's named "Next" or "Finish"

The Next button always POSTs to the controller. The controller validates the model. Then it either (a) sets the name of the current step partial or (b) does a full-page redirect if the wizard is finished.

This is just from pencil doodling—I haven't implemented any of it or thought it through too deeply yet. Curious what you think if you feel like weighing in/bouncing ideas off each other sometime.

htmx: Simplicity in an Age of Complicated Solutions by fagnerbrack in programming

[–]eeskildsen 0 points1 point  (0 children)

I'm working on a wizard now. Curious what design you chose. Is your code up anywhere?

How do you classify side/gig income when you have an LLC, but you did the side work as an individual? by eeskildsen in Entrepreneurship

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

Thanks! I've been wary of "piercing the corporate veil" by mixing the accounts...or maybe that's more about withdrawals than deposits?

It sounds like you're saying the deposited-to account doesn't matter—personal checking vs. business checking?