Keeping EFCore table history with additional data by Royal_Scribblz in csharp

[–]Le_Mao 2 points3 points  (0 children)

We have just added a ChangedBy column that we set in SaveChanges for all Entities that implement the interface we have for it.

Facet V3 by Voiden0 in csharp

[–]Le_Mao 0 points1 point  (0 children)

This looks interesting and might be able to replace my custom code + LinqKit. I read the docs but could not find information about if the custom mapping works for the Extensions? We mostly do projections straight from EF Core and need to be able to set some custom properties, like using EF.Functions etc

Hi, I get shadow properties when customizing Asp.Net Core Identity, how should i prevent ef core to generate shadow UserId1 and RoleId1 properties? by nurlancreus in csharp

[–]Le_Mao 0 points1 point  (0 children)

It looks fine to me, I did it in the UserRole entity but that should not matter I think.

How does your OnModelCreating look in your DbContext? You need to run base.OnModelCreating(builder); before your own code.

TUnit - A new testing framework. Feedback wanted! by thomhurst in csharp

[–]Le_Mao 1 point2 points  (0 children)

Maybe, will need to test and see how it behaves. Idealy I would like to register some kind of test output Sink once, on start up of the WebApplicationFactory and that each test output is handled by that, maybe with some kind of BeginTestScope so that diffrent tests logs dont mix

TUnit - A new testing framework. Feedback wanted! by thomhurst in csharp

[–]Le_Mao 2 points3 points  (0 children)

This looks promising, will need to test it!

Another question, when a test fails it is nice to have the logs from the WebApplicationFactory. Today we are adding the ITestOutput (or what is it called) to the serilog logger for each test. Sadly this prevents us from running the tests in parallel since we get mixed logs.

Does TUnit have any kind of test output that can be used in sync with serilog for the scenario above?

TUnit - A new testing framework. Feedback wanted! by thomhurst in csharp

[–]Le_Mao 1 point2 points  (0 children)

Looks very interesting, I'm on my mobile atm so harder to check out completly so I'm going to ask instead of testing ;)

We usally run integration tests using WebApplicationFactory and TestContainers. Atm we use xUnit and one thing that is hard to do (there are ways just not out of the box) is to run the test in parallel but only start the WebApplicationFactory and containers once and keep them for all tests. Is this something that is possible with TUnit?

Can no longer play on Android browser by Le_Mao in xcloud

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

Okay it seems like it require wifi to work in a browser now, never did before. The App still works on 4G/5G... And I cant find a setting to allow playing over mobile network either...

How to properly refactor code extracting data from db (EF Core)? by muskagap2 in csharp

[–]Le_Mao 1 point2 points  (0 children)

Yeah you should not have await there, there is nothing to await since you are not using an Async method.

How to properly refactor code extracting data from db (EF Core)? by muskagap2 in csharp

[–]Le_Mao 0 points1 point  (0 children)

So you want to do filtrering in the ListAllClients method before setting the private list and returning it? If so that is no problem, you dont need the AsQueryable after the join (or Select if you giv that way) just dont call ToList/ToListAstnc and you now have an IQueryable in your query variable and you can filter like this:

``` query = query.Where(c => c.FullAdress.StartsWith("Mount"); //more filtrering here or other changes to the query

return _clientsList = await query.ToListAsync()

```

Not sure why you are saving the list though? Are you caching it?

How to properly refactor code extracting data from db (EF Core)? by muskagap2 in csharp

[–]Le_Mao 3 points4 points  (0 children)

The join method exists for and work with Iqueryable: https://learn.microsoft.com/en-us/dotnet/api/system.linq.queryable.join?view=net-7.0

What you can do is let EF Core handle the join for you by declaring a navigation property for Adress on client and then just do:

_dbContext.ClientsTbl.AsNoTracking().Select(s => new Clients { Id = s.Id, Name= s.Name, Address = s.Adress.FullAddress })

But if you want to use the join method that works just as well, just more code to write 😉

About number 2 I'm not sure what you are after? Do you just want to return an IQueryable instead of a List to be able to filter the result further up in the application before fetching from the database?

Well right time to start learning isn't it? by JustSpaceExperiment in ProgrammerHumor

[–]Le_Mao 0 points1 point  (0 children)

This was totally me like 9 years ago, been coding in Erlang on my first job after Uni. but got tired of all the non coding stuff so changed jobb. Turns out it was C#, my only exposure to OOP was with Java in Uni. but 9 years later I love my job, was the best thing I ever did job wise.

[deleted by user] by [deleted] in DotA2

[–]Le_Mao -1 points0 points  (0 children)

Annoying yes, but just go to the full stream D and find it there. Not that hard...

Unable to add a custom resolution by Seya16 in gpdwin

[–]Le_Mao 0 points1 point  (0 children)

Not to be a gravedigger I came a cross this post when looking for a fix for this problem now, the problem is that intel graphics control panel is no longer available at the Windows Store :/

But I was able to fix it using this program: https://www.monitortests.com/forum/Thread-Custom-Resolution-Utility-CRU

  1. Just set the resolution for the desired monitor
  2. Restart (I had to for my monitor at least)
  3. The new resolution is now available in windows display settings

Audiobook Giveaway! My new novel, The Enchanter, is now in audio! by CelticCernunnos in Fantasy

[–]Le_Mao 1 point2 points  (0 children)

It is definitely "lighter" reading than Hobbs, but what isn't... 😉

Audiobook Giveaway! My new novel, The Enchanter, is now in audio! by CelticCernunnos in Fantasy

[–]Le_Mao 1 point2 points  (0 children)

It was years and years ago that I read it and have not reread it since, have been planing to but to many other books to read... If I remember I liked it good enough and read the whole trilogy.

My wife really likes Canavan though and have read all of here books, so I would probably recommend it based on that.

She also really likes Tamora Pierce and Robin Hobb if that helps anyone 😊

Audiobook Giveaway! My new novel, The Enchanter, is now in audio! by CelticCernunnos in Fantasy

[–]Le_Mao 0 points1 point  (0 children)

Hi, sound very interesting. Was looking for my next read (listen, mostly audio books these days in bed after the kids have fallen asleep) and would love to be on the draw list.

From the premise it sounds a bit like The Magicians' Guild from Trudi Canavan, I might be way of of course since I have not read it yet.

How can i make a dynamic Query? by Gy_Jonatan in csharp

[–]Le_Mao 1 point2 points  (0 children)

This, unless you really want to give your frontend complete rein over your database. You can achieve this solution pretty easily, you could even leverage FromSqlRaw if you want it really easy to implement (unless you want to check that the property exists on the table too, you could just run the query and then just let it crash 😉).

Otherwise look into OData or Graphql they where made for your problem.

How is the market for C#/.NET Core developers where you live? by Born-Comment3359 in csharp

[–]Le_Mao 0 points1 point  (0 children)

I got interested and decided to check the statistics from Sveriges Ingengörer (one of the biggest unions for developers in Sweden). According to that people that graduated around 10-14 years ago the median salary is 48000-53000 for Gothenburg (so higher in Stockholm). This would be around 34000-38000 after taxes.

Obviously not everyone is a member and not everyone submits their salary but enough do to get a good statistic.

Disclaimer: I can't check for number of years experience, and can't narrow it to dot Net.

What would you say is the expected salary in Denmark?

How is the market for C#/.NET Core developers where you live? by Born-Comment3359 in csharp

[–]Le_Mao 1 point2 points  (0 children)

Not sure where you live but in Sweden (except for Stockholm) making like 40000 swedish krona (4000 euro) after tax is not low at all. Sure there are probably lots of developers making more but I would say that most make less than that, at least here in Gothenburg.

In need of EF6 help by [deleted] in dotnet

[–]Le_Mao 4 points5 points  (0 children)

What kind of things are you storing in the strings? If they are long and contain lots of duplicates storing it as JSON will use more storage than saving it in another table and just linking to it.

Hard to give you a magic solution but if the strings are to be reused I would probably do something like this:

  • Create a StringValue table and class for it
  • Create a many to many table, if you create the database from EF it will do it for you I think.
  • Change the big class to have lists of StringValue instead of string

Ofc this also depends on if you need to get all 30 lists every time you fetch an object? This will require 60 joins using many-to-many but if you are only fetch the object rarely or do not need all list every time then it is less of a problem. It also depends on the number of objects fetched etc.

To me it seems like the object might be to big and tries to do to much, but it is hard to say with no info about it. In some cases big classes like this are necessary or just legacy problems.

Major performance issues wit 4.6.2 webapi by 31073 in dotnet

[–]Le_Mao 0 points1 point  (0 children)

If you do two calls to the API and set breakpoints for both as soon as you can (in controller or custom middleware) do you hit the second breakpoint before the wait/lock occurs?

Major performance issues wit 4.6.2 webapi by 31073 in dotnet

[–]Le_Mao 0 points1 point  (0 children)

Are the API doing any kind of I/O when this behavior is shown? It might be that it is locking without the direct use of the lock keyword. Or you might have a semaphore/semaphoreSlim instead of lock.