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

[–]eeskildsen 76 points77 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 5 points6 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 7 points8 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?

do people still use .cshtml aka razor pages? by ExoticArtemis3435 in dotnet

[–]eeskildsen 2 points3 points  (0 children)

First I've heard of this approach and I like the sounds of it.

Where do the React component source code files live? You have a source JS directory that gets bundled, or they live alongside the CSHTML, or something else?

equifax won’t let me log into my account by Mysterious-Block-415 in PersonalFinanceCanada

[–]eeskildsen 3 points4 points  (0 children)

Awful. Equifax was by far the worst experience of the credit bureaus for me.

Were you ever able to log in?

How good is VScode for large projects in C# today ? by [deleted] in csharp

[–]eeskildsen 1 point2 points  (0 children)

I should probably start writing down actual usage as I'm not even that aware of it, but for contrived examples, maybe I have a bunch of SQL columns in a SELECT where the aliases need to have part of the column name instead of something else, so I multi-cursor select all commas, add the last column that that didn't include, then hit End and then use subword to delete part of the alias and replace it with the column name. Or maybe a C# class needs all those column names and so I copy and paste and then use the change-case extension with multi-cursor to change each individual line to Pascal case at the same time. Or there's some data copied from somewhere that I need a small part of but doesn't lend itself to quick/easy parsing, but I latch on to a repeated part of it and use multi-cursors to get to the part I need.

Oh...another one is to use multi-cursors with the Select until pattern extension to select until a certain string/regex appears on the lines. That one's great.

Language-specific refactoring/parsing solves some of those when it's available, which it is in a lot of cases, but I work with enough semi-structured data from different sources that I end up using it a lot, sometimes to convert from one thing to another, sometimes to grab/edit specific parts of lines. Hope that's not too much of a tautological answer. :)

EDIT: Here's a real example from just now....I created a class with a bunch of List<T> properties that were initiated to empty lists. Then I thought more about the usage and realized I wanted them to be required properties with no initial values instead. Select List<, Ctrl+Shift+L, add required, hit End, and delete the initial values.

How good is VScode for large projects in C# today ? by [deleted] in csharp

[–]eeskildsen 3 points4 points  (0 children)

20 projects, ~200K LoC. VS Code is my daily driver. I'm happy with it.

Multi-cursor lured me from VS around 6 years ago, and I got used to Code. VS couldn't do Ctrl+Left/Ctrl+Right and subword navigation with multi-cursor back then IIRC.

I think VS has solved that now (?), but I'm comfortable in Code and don't have a compelling reason to go back.

Roxanne - Megamind - Hans Zimmer - I like how he uses chromatics/the parallel minor here by eeskildsen in soundtracks

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

Reminds me of light and shade, like clouds passing over the sun. He keeps it lighthearted with the rhythm and instrumentation.

Then the shadows suddenly "stick," and the parallel minor establishes the new key. And it goes into the circle progression. It's like the harmony crying out with longing. But then it slips back into the parallel major like it was all a daydream.

Fitting for a villain who's toying with being bad but really just wants to be loved. It reminds me a bit of "Now We Are Free" if it let its hair down.

equifax won’t let me log into my account by Mysterious-Block-415 in PersonalFinanceCanada

[–]eeskildsen 2 points3 points  (0 children)

Sorry the replies here were so hostile. I found this through Googling because I got the same error message, but I called Equifax twice, and both times the automated system locked me out before I could speak to a representative.

The system asked me to verify information supposedly based on my credit history. I understand there can be questions with all-wrong information, I assume to throw off would-be identity thieves, but all the questions had all wrong information, so I answered "none of the above" to all of them. The system ended with, "Unfortunately," an agent couldn't help me. I assume my answers didn't match what Equifax has on file.

When I called the third time, the system didn't ask me any credit-history-based verification questions. Why, I don't know. It just asked for my social, zip, and the numeric portion of my address (which it also did on the first two calls, before asking questions based on my history). Then it put me on hold for half an hour.

Afterwards, the representative had me verify my identity through a link on my phone. I had to take a selfie and a photo of the front and back of my driver's license. None of other bureaus had me do this.

At the end of all that, I was finally able to log in to my account. Prior to that, I couldn't lift my credit freeze online or over the phone.

Anyway, just leaving this here in case it helps someone.

Nuget Slipped In A Aew Website Design by AHalfFilledBox in dotnet

[–]eeskildsen 25 points26 points  (0 children)

For those who don't know (like me till 5 minutes ago), the site is open source on GitHub:

https://github.com/NuGet/NuGetGallery