Tarkacode
Tarkacode
CC#
Created by Tarkacode on 3/5/2024 in #help
✅ My API returns 500 internal server error with the SQL exception text, why?
Ok, thank you very much! I will try to make my own middleware, I never made one, it is a good idea to try it myself
7 replies
CC#
Created by Tarkacode on 3/5/2024 in #help
✅ My API returns 500 internal server error with the SQL exception text, why?
Yes I run it in development! The only middleware related to dev env that I see is this :
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
Is this the middleware that add the dev exceptions? In any case, I guess I should not be bothered by these dev exceptions if it only appears in a dev environment?
7 replies
CC#
Created by Tarkacode on 2/9/2024 in #help
✅ How to properly set a default value as UtcNow with EF Core and PostgreSQL
Ok, I see. Really cool. Thank you!!!
9 replies
CC#
Created by Tarkacode on 2/9/2024 in #help
✅ How to properly set a default value as UtcNow with EF Core and PostgreSQL
Oh nice, I will try this too, thanksssss
9 replies
CC#
Created by Tarkacode on 2/9/2024 in #help
✅ How to properly set a default value as UtcNow with EF Core and PostgreSQL
I tought about it! but I didn't find any postgres function that gives the UtcNow. For example, the function now() gives you the datetime according to your server timezone unfortunately. What do you think would be the benefits of having my datetime generated on the DB Side? If i find something that works?
9 replies
CC#
Created by Tarkacode on 2/9/2024 in #help
✅ How to properly set a default value as UtcNow with EF Core and PostgreSQL
Super cool, thanks a lot!
9 replies
CC#
Created by Tarkacode on 12/30/2023 in #help
String : Immutable reference type
Ok, I see
37 replies
CC#
Created by Tarkacode on 12/30/2023 in #help
String : Immutable reference type
How can it be? I pass it as an argument and i don't declare a new variable in the method, and yet they are still not the same variable? Or is the parameter declaration considered as a variable declaration?
37 replies
CC#
Created by Tarkacode on 12/30/2023 in #help
String : Immutable reference type
Ok thank you 😄
37 replies
CC#
Created by Tarkacode on 12/30/2023 in #help
String : Immutable reference type
Its just a local variable?
37 replies
CC#
Created by Tarkacode on 12/30/2023 in #help
String : Immutable reference type
Oh yes, so its not even a class member then
37 replies
CC#
Created by Tarkacode on 12/30/2023 in #help
String : Immutable reference type
And it would work the same if it was a class member, right?
37 replies
CC#
Created by Tarkacode on 12/30/2023 in #help
String : Immutable reference type
Ok so its a top level statement variable
37 replies
CC#
Created by Tarkacode on 12/30/2023 in #help
String : Immutable reference type
But as you say it, it makes perfect sense now that it doesn't change
37 replies
CC#
Created by Tarkacode on 12/30/2023 in #help
String : Immutable reference type
Idk, I thought that because the variable "car" is a global variable, any change to that global variable would be saved since its a reference type
37 replies
CC#
Created by Tarkacode on 12/30/2023 in #help
String : Immutable reference type
I tought I would not learn anything new with the freecodecamp C# certification in partnership with Microsoft, but they proved me wrong fortunately
37 replies
CC#
Created by Tarkacode on 12/30/2023 in #help
String : Immutable reference type
It prints
Start : black
Medium : white
End : black
Start : black
Medium : white
End : black
37 replies
CC#
Created by Tarkacode on 12/30/2023 in #help
String : Immutable reference type
Car car = new();
Console.WriteLine("Start : " + car.Color);

SetColorToWhite(car);

Console.WriteLine("End : " + car.Color);

void SetColorToWhite(Car car)
{
car = new Car();
car.Color = "white";
Console.WriteLine("Medium : " + car.Color);
}

public class Car
{
public string Color { get; set; } = "black";
}
Car car = new();
Console.WriteLine("Start : " + car.Color);

SetColorToWhite(car);

Console.WriteLine("End : " + car.Color);

void SetColorToWhite(Car car)
{
car = new Car();
car.Color = "white";
Console.WriteLine("Medium : " + car.Color);
}

public class Car
{
public string Color { get; set; } = "black";
}
I didn't know that a code like this would not save the changes to Car ^^'
37 replies
CC#
Created by Tarkacode on 12/30/2023 in #help
String : Immutable reference type
Ok nice, I understand now, many thanks!
37 replies
CC#
Created by Tarkacode on 12/30/2023 in #help
String : Immutable reference type
Unfortunately i don't have C experience 😁
37 replies