Lounder
Lounder
CC#
Created by Lounder on 4/15/2024 in #help
ASP.NET Core - Database Model and ViewModel Validation
What is the point of writing Validation attributes outside of the EF Core Data Model (for example in the ViewModel), given that the checks are not only valid for the database, but are also triggered when a request is received?
18 replies
CC#
Created by Lounder on 3/25/2024 in #help
Can someone experienced explain this diagram in detail? ASP.NET Core
No description
3 replies
CC#
Created by Lounder on 12/12/2023 in #help
✅ EF Core navigational properties
This works fine (no navigational property to Business):
class Business
- ...
- Address Address { get; set; }

class Address
- ...
class Business
- ...
- Address Address { get; set; }

class Address
- ...
This causes an error:
class Business
- ...
- Address Address { get; set; }

class Address
- ...
- Business { get; set; }
class Business
- ...
- Address Address { get; set; }

class Address
- ...
- Business { get; set; }
InvalidOperationException: The value of 'Address.Id' is unknown when attempting to save changes. This is because the property is also part of a foreign key for which the principal entity in the relationship is not known
InvalidOperationException: The value of 'Address.Id' is unknown when attempting to save changes. This is because the property is also part of a foreign key for which the principal entity in the relationship is not known
Initialization code:
var address = new Address
{
Street = "SName",
City = "CName",
};

await dbContext.Addresses.AddAsync(address);
var address = new Address
{
Street = "SName",
City = "CName",
};

await dbContext.Addresses.AddAsync(address);
How can I make this work while also keeping Address' nav property to Business? Please @ me so I respond immediately
48 replies
CC#
Created by Lounder on 12/6/2023 in #help
✅ [EF Core] Why does my database entity have a one-directional FK Connection?
No description
7 replies
CC#
Created by Lounder on 12/19/2022 in #help
❔ I'm looking for a Visual Studio 2022 extension, which organizes my CSS
3 replies
CC#
Created by Lounder on 12/1/2022 in #help
❔ 'Can't find stylesheet to import.' using SASS with 'Web Compiler 2022+' extension in ASP.NET C MVC
2 replies
CC#
Created by Lounder on 11/3/2022 in #help
Why can't an interface property have a private set? [Answered]
string WrittenMessageLog { get; private set; }
5 replies
CC#
Created by Lounder on 10/23/2022 in #help
Simple Recursion [Answered]
How can I make a recursive method return false when one or more of the iterations have returned false but the top recursion has returned true?
-true
-true
-false // method should return false
-true
-true
-false // method should return false
Example with code:
static void Main(string[] args)
{
/*
8. Write a program in C# Sharp to check whether a given string is Palindrome or not using recursion. Go to the editor
Test Data :
Input a string : RADAR
Expected Output :
The string is Palindrome.
*/

Console.WriteLine(ReverseLetters("RADAR"));
}

private static bool ReverseLetters(string word)
{
if (word.Length > 1 && word[0] == word[word.Length - 1])
{
ReverseLetters(word.Substring(1, word.Length - 2));
return true;
}

return false;
}
static void Main(string[] args)
{
/*
8. Write a program in C# Sharp to check whether a given string is Palindrome or not using recursion. Go to the editor
Test Data :
Input a string : RADAR
Expected Output :
The string is Palindrome.
*/

Console.WriteLine(ReverseLetters("RADAR"));
}

private static bool ReverseLetters(string word)
{
if (word.Length > 1 && word[0] == word[word.Length - 1])
{
ReverseLetters(word.Substring(1, word.Length - 2));
return true;
}

return false;
}
5 replies
CC#
Created by Lounder on 8/18/2022 in #help
Is it possible to publish a WPF Application into a single file with the font inside of the EXE?
Is it possible to publish a WPF Application into a single file with the font inside of the EXE?
6 replies
CC#
Created by Lounder on 8/17/2022 in #help
Class making my program run as a background process after I close it [Answered]
https://paste.myst.rs/7o8qz5vk After I close my program through RMB>Close window it continues running in the background unless I close it through the task manager. I have found out that this class causes this
3 replies
CC#
Created by Lounder on 8/16/2022 in #help
Is it possible to run code only when a hover event occurs in my application? [Answered]
3 replies
CC#
Created by Lounder on 8/16/2022 in #help
WPF UIElement.IsHitVisible help needed
Hello, In WPF IsHitTestVisible="False" instead of only ignoring mouse clicks, it also ignores MouseEnter events. I want mouse clicks to pass through and OnMouseEnter events to be triggered
2 replies
CC#
Created by Lounder on 8/15/2022 in #help
Help with Linq
25 replies
CC#
Created by Lounder on 8/13/2022 in #help
Background Opacity in WinFroms
I'm trying to create a simple two-layered click-through program in Windows Forms which has a semi-transparent background and a non-transparent label
7 replies