Jiry_XD
Explore posts from serversHow to prevent nulls using this approach for Object Initializers?
Some code used a constructor but I made a new class and only wanted to change the class name by the code. Therefore I added the name constructor. To still be able to use object initializers I added the second empty constructor.
15 replies
How to prevent nulls using this approach for Object Initializers?
Another related question, in EF Core I can do:
This is in Customer.cs entity.
I guess EmailAddress is then not getting stored to the db because it is not mapped. I don't need it mapped I just need to store it as a string.
What would be a clean way to do this?
15 replies
Test setters indirectly via constructor or test them directly?
What I could do is do a constructor for the test class that does the setup for the tests and then test the setters individually, I think it will look a lot cleaner if you look above the initializer is quite large, what do you think?
32 replies