Davaaron
Why do i need to pass in the generics here?
If i cannot get this done I already have some ideas in mind 😄
transition to a big static class "GitCommands" that has all those methods... or maybe i will create a lot of domain objects (Repository, Branch, Commit, Tag, etc.) that has the logic built-in (CreateBranch, AddLocalChanges, ResetCommit, etc.)
7 replies
Why do i need to pass in the generics here?
Sorry for the late response. Yes, it is. Well I thought it could infer it because I write
Author author = ...
, of course it cannot when I write var author = ...
.
My final design idea was to have a lot of git command classes that takes a specific input parameter and produces an output, so i could use it like
Author author = await gitCommandHandler.ExecuteAsync(new GitGetAuthorCommandInput())
or
await gitCommandHandler.ExecuteAsync(new GitSetAuthorCommandInput{ Name = "ChangedName" });
7 replies
EF Entity 'required' property
How do you setup the "required" on your models? With the "keyword identifier" like
public required string Name { get; set; }
or like a data annotation [Required]
? I'd try the latter one, because the required keyword tells the compiler that the properties need to be set in order to initialize the value, a readonly non-nullable value that needs be set before the object leaves the constructor.
However, having ".IsRequired" in the configuration isn't a bad thing though, this way you have all the configurations in one place.
I hate to jump around between configurations and models in suchs projects. More convenient to have everything configured the same way.
Good luck!9 replies
Switching to C# and curious if there's anything I could improve on in this very basic math script.
What's your level of programming? You could take this to the next level ... I would consider the SOLID principles as well as other principles. That means I would try separate the responsibilities the best way I could.. try to put together what's common and only specify what's different, finding a good "mechanism" to be opened for alterations ... for example
20 replies
Switching to C# and curious if there's anything I could improve on in this very basic math script.
Depends what you want to do...
However, I would assign the results of the methods to variables.
You could also create an Enum for the "CalculationMethods".
20 replies
❔ WPF - Use command of viewmodel instead of item on click
The error is:
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Davaaron.BankOverview.ViewModels.Dialogs.NotificationDialogViewModel', AncestorLevel='1''. BindingExpression:Path=CloseDialogCommand; DataItem=null; target element is 'Button' (Name=''); target property is 'Command' (type 'ICommand')
11 replies
❔ E2E Test - Start MVC project
I followed the IntegrationTest docs, as there was no E2E docs. I already tried the WebApplicationFactory but with the same results. The issue might be in my understanding of how it works, as it does not startup the whole MVC project, but I thought it would.
We use Playwright in C# with XUnit. Unfortunately, there is no real documentation about that.
Our idea was that the test could do start/shutdown the whole MVC project, so we dont have to start and shutdown the MVC project separately before and after all tests.
23 replies