« first day (3340 days earlier)      last day (1591 days later) » 

1:59 AM
@CopperKettle that doesn't make sense. You can't declare a member through method. That must be done in the class definition (where you wrote all the other members). If you could declare members inside methods, it would mean that some members would only exist after you execute that method, which is a bit odd. Or at least that is my understanding
 
mr5
2:15 AM
3 replies in a row
 
 
2 hours later…
4:09 AM
Thank you!
 
 
1 hour later…
5:15 AM
 
 
1 hour later…
Hi
Can anyone correct this code ?
 
 
2 hours later…
8:09 AM
morning.
@karan Here's tip: since no-one here is working for you, no-one will "correct your code". You can ask about specific errors you're getting and people will probably try to help, but "can anyone correct this code" is "can anyone do this work for me", which will not get you anywhere.
 
 
1 hour later…
9:13 AM
Hmpf. My controller routes work in unit tests (using the ASP.NET Core TestServer) but not when running under IIS Express.
 
9:54 AM
Switched from IIS Express to Kestrel. Works now. shrug
 
Asp.net core is great and all, but the shit you have to go through to get it to work is ridiculous
Same with netcore up to 2.2, where applications don't even get an exe which is just stupif
Even now though, I think the "exe" they get is just a copy of dotnet with another name, and the actual application is still in <applicaitonname>.dll
 
not a copy of dotnet.exe (that would be wasteful), but a very thin bootstrapping launcher around the DLL.
Which, when you think about it, is exactly what regular .NET EXEs are, except that the launcher code is embedded in the EXE. .NET EXEs are DLLs.
 
I thought dotnet was pretty light anyway
 
yeah, but you don't really need to be able to do myApp.exe --versions and all that crap.
 
Yeah I mean sure, but application IMO looks more "legit" if there's some actual weight to the exe
 
10:08 AM
Yeah, but up until .NET Core 3, the target audience for .NET Core apps wasn't really people getting an app and executing it. It was oriented towards server apps, web apps, where you don't go around running EXEs anyway.
3.0 is now a lot more desktop-focused with WPF and WinForms support, so it makes sense to align that "package as EXE" feature with that version.
 
True I suppose. I just hated having to dotnet run shit
 
 
4 hours later…
2:00 PM
Now this? This? This is ugly.
private readonly Dictionary<string, Dictionary<string, Dictionary<string, Dictionary<string, JObject>>>> _configurationHierarchy
            = new Dictionary<string, Dictionary<string, Dictionary<string, Dictionary<string, JObject>>>>();
I wonder what's the best way to make it less ugly.
1. Instead of having a 4-level-deep nested dictionary, have one dictionary, with a compound key comprised of all four keys.
Pros: one dictionary, easy to read, just as easy to retrieve a specific item.
Cons: hard to navigate, can't retrieve a set of values at a specific level.
2. Create custom classes for each level of the tree. So I now have a single `Dictionary<string, Organization>`, when `Organization` is simply a wrapper around (or an alias for?) a three-level-deep dictionary.
Pros: Clearer code, easy to retrieve single keys and also whole branches, can navigate.
Cons: More classes could mean more entities to keep track of in your mind, harder to understand?
 
Dictionary<(string, string, string), JObject>?
 
3. Instead of dictionaries, use some sort of hierarchical tree data structure.
Pros: Intuitive, using the data structure that models the actual entity.
Cons: No standard structure exits in the framework, need to find a nuget package for it. Less clear because less standard. Also, maybe, not O(1) access? No biggie.
 
2 is just "I wonder if people would understand why I split this to so many classes"
 
@misha130 That's option #1.
 
yes
I also didnt find a nuget for trees as far as I know, always made my own
 
2:08 PM
@AvnerShahar-Kashtan try SLA
 
I would vhoodr opyion 2
holy shit
 
basically, you have a 4 layered json tree (where the bottom layer's values would be json objects)
 
I would choose option 2
 
I would also vhoodr a good opyion
:P
 
My config goes about 5 levels deep, but using the classes makes it ezpz
 
2:10 PM
@Wietlol The bottom layer's values already are JSON objects.
By design.
 
opyion 4, use a special class to represent the 4 layered tree
make a few methods to access objects by n keys
 
Best option: Deserialise the tree to classes and embrace the simplicity
Can't fuck up by making typos in the keys then either
 
optionally, make an index accessor as alias for those methods
 
@CaptainObvious The keys are user provided anyway.
 
Because if you did it would crop up at compile time instead
ohh
 
2:12 PM
The first level is divided by TenantId, since this is a multi-tenant app and we need to keep data separated (although we might enforce the tenant data separation at a higher level and keep only 3 levels here)
 
Wait waht
 
basically, make a class to encapsulate the 4 layered tree... then use that class
 
Oh okay but then within each tenant the keys are fixed?
 
I think the keys are names the users can choose
like Dictionary<String, Room> { {"C#", csharpRoom} }
 
That wouldn't be a very good config though
 
2:14 PM
@CaptainObvious No. This is a configuration service that can store arbitrary configuration for different services inside the overall application. So to get a single value, we need to filter by TenantId (that's the first dictionary), then get the configuration for a single entity in our app by unique ID (that's the second). For that entity, we store configuration grouped by the configuration source (third) and the config key itself (fourth). The value is an arbitrary JSON document.
 
I mean sure, he could deserialise to Dictionary<string, TenantConfig>
 
if it wasnt... I suspect Avner of already using domain model classes
 
So there's no fixed schema at all then?
 
ids are strings? or ints? or guids?
 
@CaptainObvious This is a generic service. Our overall app has several microservice (let's call them DMS, TMS and ReSim). The config service doesn't know what the app's configurations are. Only the apps know that. So when DMS stores its config, it's stored under /tenantX/entityY/DMS/ConfigEntry1
 
2:15 PM
(not that it matters, but just for fun :D )
 
ids are strings.
 
Well all I can say is godspeed to you, I would not want to work that one out
 
@CaptainObvious Each microservice has its own schema, but the config service doesn't know or enforce it.
What the config service does know to do is merge configurations in different hierarchies. (That's a different hierarchy than this tree).
So for instance if I have an entity called /org1/dept2/team4, I might have a configuration setting assigned both for /org1/dept2/team4 itself, but also on /org1/dept2. When calculating the effective configuration for an entity, I need to take into account the parents as well.
If a value is set locally on a node, it will override a parent setting, but if it's not, it should inherit the parent value. And then, of course, there are more complications as well.
 
that is basically my idea
then you can do _configuration[tenantId][organizationId]
so you keep the same usage
but you basically get aliases for each level
rather than n nested dictionaries
 
Yeah, that's basically option #2 with syntactic sugar. It's a good option.
 
 
5 hours later…
7:15 PM
Hi everyone, I am just trying to learn .net core. I understand that there is an additional step from .net mvc where I have to create interface classes and add them to a service. Is there a way to scaffold/automate the creation of interfaces?
 
 
3 hours later…
9:53 PM
creating interfaces based on their implementing classes is a bad idea
it often contradicts inversion of dependencies
cherry picking what should be in those interfaces, based on your domain is something that is difficult to automate
although, IDEs sometimes offer the option to produce such an interface
 
10:22 PM
For some reason, a massive amount of the codebase at my work has an interface for every class, including classes that will obviously not be subclassed because they contain ad-hoc business logic. It's not a good pattern.
 
10:48 PM
sounds like a team lead rule
 

« first day (3340 days earlier)      last day (1591 days later) »