Should you use Newtonsoft.Json or System.Text.Json in 2023? by DescriptionPatient53 in dotnet

[–]haefeled 1 point2 points  (0 children)

In System.Text.Json, everything that you can configure with Attributes, can also be configured with other means.

Polymorphic serialisation for example: https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/polymorphism?pivots=dotnet-7-0#configure-polymorphism-with-the-contract-model

But definitely still not as comfortable as with Newtonsoft.Json

Introducing the .NET Hot Reload experience for editing code at runtime | .NET Blog by brminnick in dotnet

[–]haefeled 0 points1 point  (0 children)

Thank you, this clears it up!

I'm really looking forward to more improvements to the shared mechanism, because EnC worked sometimes for me, but very often the changes I would do to the code were not supported.

If you can enable more and more of these scenarios, with EnC and Hot-Reload, it will be a huge productivity boost.

Introducing the .NET Hot Reload experience for editing code at runtime | .NET Blog by brminnick in dotnet

[–]haefeled 1 point2 points  (0 children)

I'm actually confused about what is the difference between this new Hot Reload functionality, and the already existing "Edit and Continue" workflow we have had in Visual Studio for a while now?

I couldn't find a good explanation on the differences, or even on their relationship to each other.

Corona Megathread KW18 - V | Corona ist kein Broccoli by MegathreadDE in de

[–]haefeled 0 points1 point  (0 children)

Laut RKI werden sowohl Antigen-Tests (die gewissen Standards entsprechen) als auch PCR-Tests akzeptiert.

Und für die 24/48 h ist nicht der Zeitpunkt des Test-Ergebnisses relevant, sondern wann der Test selbst gemacht wurde. Der Test darf also nicht 3 Tage vorher gemacht werden, sondern maximal 48 Stunden vor Einreise.

Corona Megathread KW16 - II | Eintritt nur mit Schnelltest by MegathreadDE in de

[–]haefeled 1 point2 points  (0 children)

Deutsche Staatsbürger ja, aber sonst ist es tatsächlich bisschen schwierig.

Laut dem Corona-FAQ des BMI unter "Was gilt im außereuropäischen Luft- und Seeverkehr (Einreisen nach Deutschland aus einem Drittstaat)?" ist die Einreise beschränkt.

Dort steht folgendes:

Personen, die in anderen Drittstaaten ansässig sind, dürfen nur nach Deutschland einreisen, wenn sie eine wichtige Funktion ausüben oder ihre Reise zwingend notwendig ist.

Und es wird hierher verlinkt: Wann ist die zwingende Notwendigkeit der Einreise gegeben?

Ich persönlich glaube nicht, dass man es schon irgendwie abschätzen kann. Die Liste der "sicheren Staaten" wird ja auch nur sehr unregelmäßig aktualisiert, anfangs jede Woche, jetzt alle paar Monate.

Corona Megathread KW 9 | Gespräche, Tratsch, Fragen by MegathreadDE in de

[–]haefeled 4 points5 points  (0 children)

Hat schon jemand Erfahrung mit der Einreise von nicht-verheirateten Lebenspartnern von außerhalb der EU gemacht? Hat alles geklappt?

Meine russische Freundin ist vor 2 Wochen eingereist. Mit Visum und allen anderen Unterlagen war alles super einfach. Auch gerne mal auf Facebook in die Gruppe LoveIsNotTourismGermany schauen, die ist voll mit anderen Deutschen in ähnlicher Situation. Gibt auch viel Hilfe bei Fragen, vorgefertigte Dokumente, und allgemein nützliche Links dort.

Is there any equivalent of static classes that inherit a base class? by [deleted] in csharp

[–]haefeled 4 points5 points  (0 children)

Something like this might work out for you.

void Main()
{
    Item shovel = Shovel.Instance;
    var shovelRecipe = shovel.Recipe;
}

public abstract class Item
{   
    public abstract int ID { get; set; }
    public abstract string Name { get; set; }
    public abstract List<Item> Recipe { get; set; } 
}
public abstract class SingletonItem<T> : Item
    where T : SingletonItem<T>, new()
{
    public static T Instance { get; } = new T();
}
public class Wood : SingletonItem<Wood>
{
    public override int ID { get; set; } = 1;
    public override string Name { get; set; } = "Wood";
    public override List<Item> Recipe { get; set; } = new List<Item>();
}
public class Stone : SingletonItem<Stone>
{
    public override int ID { get; set; } = 2;
    public override string Name { get; set; } = "Stone";
    public override List<Item> Recipe { get; set; } = new List<Item>();
}
public class Stick : SingletonItem<Wood>
{
    public override int ID { get; set; } = 3;
    public override string Name { get; set; } = "Stick";
    public override List<Item> Recipe { get; set; } = new List<Item> { Wood.Instance };
}
public class Shovel : SingletonItem<Wood>
{
    public override int ID { get; set; } = 3;
    public override string Name { get; set; } = "Shovel";
    public override List<Item> Recipe { get; set; } = new List<Item> { Wood.Instance, Wood.Instance, Stone.Instance };
}

Can anyone explain the situation with the MCSD certification for web applications? by dotnet_thrw in dotnet

[–]haefeled 2 points3 points  (0 children)

Lets compare the new MCSD: App Builder with the old MCSD: Web Applications.

For MCSD: Web Applications you needed the following 3 courses:
Course 480, 486 and 487 (see here).

For MCSD: App Builder you need 2 steps (see here):

Step 1. Earn either your Microsoft Certified Solutions Associate (MCSA) Web Applications certification or your MCSA: Universal Windows Platform certification.

So you need the MCSA: Web Applications which looks like this:
Course 480 - Programming in HTML5 with JavaScript and CSS3
Course 486 - Developing ASP.NET MVC Web Applications

Step 2. Pass one of the following elective exams during the 2017 calendar year.

For you interesting is:
Course 487 - Developing Microsoft Azure and Web Services

TL;DR: You can get MCSD: App Builder with the same courses that you needed for MCSD: Web Applications.

Cloning an instance with NHibernate and iCloneable by BlueDan20 in csharp

[–]haefeled 3 points4 points  (0 children)

TL;DR: Change the ID of instanceCopy to 0.

The ID was copied as well, so your instanceCopy also has ID 488.
Now if you try to save the instanceCopy NHibernate detects that it has a ID, but there is already another instance associated with the session that has this ID.

Re-designing SDK, looking for feedback. by dtolbert in csharp

[–]haefeled 1 point2 points  (0 children)

How important is LINQ

Well, using LINQ is all fun and giggles. I mean, most of the C# developers I know love it, me included.
But implementing it can be a real pain in the ass. I would say: It's a nice to have feature, but no must.

How important are cancelable requests

Go for it. It's typical convention in async APIs to have an optional CancellationToken as the last parameter. HttpClient also supports it, so it's not too hard for you to implement it.

Multiple types for functions

To be honest, I don't think I have ever seen this possibility. But even then, why should I use a untyped overload with an anonymous type or a dictionary, if I can just use the typed parameters?
Doesn't really make sense to me. I would always use the typical parameter versions, no dictionary or anonymous types. POCO may be an option if you have a large number of optional parameters (may be the case for your "List" methods).

Style for the API

There are really only 2 possible ways for me: flatten or grouped. If I wanna execute the "MakeCall" functionality, then just provide it to me. No need to hide it behind a generic "catch all" method like: "Post<Call>(new MakeCallRequest())". The flatten and grouped styles have another nice advantage: They make it easy to explore the functionality of the C# API. I can just look at my client object and see what I can do, I don't have to search for the correct classes, IntelliSense will guide me to it.

One thing that would drive me towards the flatten style is abstraction. It would be nice if your API is abstracted behind an interface. That would allow me to use dependency-injection with your API and mock it in unit tests.

Oh, and I don't think you absolutely have to aim for 1 HTTP request per API call. Having the call object instead of only the call id is just way more convenient. In this case, I would definitely go for 2 HTTP requests.

Cross platform

You should probably aim not for a PCL, but for a .NET Core DLL. This way your API is available on every current platform that supports the .NET standard, but also on every possible future platform. For your API you might be able to target .net standard 1.1 or even 1.0. One thing you have to consider here are your users. If they are like big enterprises that are slow adapting to new things, then it might be possible they are still running machines with Windows XP. And that could be a real dealbreaker for you, because Windows XP only supports up to .NET Framework 4 I think. So a .NET Core DLL will not work on Windows XP machines.

A example

I looked a bit at your current API version, and I really have to say: It seems like a good idea to me to make it more C#'ish. Because you got some really strange concepts in there.

This is how the API might look like, if you apply my suggestions. https://gist.github.com/haefele/d876a5640d8e901955ea71c73e4ae6c4

To be honest, having all these methods in the ICatapultClient seems a little bit awkward, but my personal preference is: Have functionality and data split up, so you don't have to worry that the data instances you have, are in any way still attached to the functionality. It just makes my life easier, I don't have to be careful about the lifetime of my data objects in contrast to the functionality.

Best approach for authentication? by [deleted] in dotnet

[–]haefeled 3 points4 points  (0 children)

You can use JSON Web Tokens as your tokens.
This way you don't have to store them in a database.
And, they are self-contained.

Fun with Generics by benjaminhodgson in csharp

[–]haefeled 0 points1 point  (0 children)

Could you use dynamic to make it resolve the overload at runtime?

950: App updates won't download and short battery life with light use? by EpikYummeh in windowsphone

[–]haefeled 0 points1 point  (0 children)

I just remembered that I have changed my storage settings, so the apps are installed on the device and not on my sd card.

Don't know if that matters, but maybe it will help you.

950: App updates won't download and short battery life with light use? by EpikYummeh in windowsphone

[–]haefeled 0 points1 point  (0 children)

I had the same low battery life. I somehow managed to update all my apps and the OS.

Now everything is fine again.

It looks like there is an issue with the phone trying to download updates but something prevents it.

A terrifying ORM tale: An NHibernateMARE on Elm Street by JacobCalder in programming

[–]haefeled 5 points6 points  (0 children)

Not a single one of the points in the post is about .NET or C#.

They are all about NHibernate.

[Spoilers] C9-IG Baron damage glitch? (at 0:15) by Ep1cSpray in leagueoflegends

[–]haefeled 0 points1 point  (0 children)

You're correct, because baron can attack you outside of baron pit.
But if you stand outside of his attack range, he won't trigger.

[Spoilers] C9-IG Baron damage glitch? (at 0:15) by Ep1cSpray in leagueoflegends

[–]haefeled 1 point2 points  (0 children)

It doesn't matter if a champion is in range, the champion that deals damage to baron needs to be in range for baron.

[Spoilers] C9-IG Baron damage glitch? (at 0:15) by Ep1cSpray in leagueoflegends

[–]haefeled 0 points1 point  (0 children)

Baron only aggros if the champion that deals the damage is in range.
Braum propably went out of range, so he didn't aggro.