Anyone working on .Net application with MySql 5.7 and EF in Db First Approach would have come across what is an officially confirmed bug. This bug rises when you attempt to generate/update your Entity Model after changes to the Database. "Unable to generate the model because of the following exception: 'System.Data.StrongTypingException: The value for column … Continue reading Workaround for MySql 5.7 EF DbFirst Issue
An easier way to parse for folders, which do not contain files with a specified extension.
CA2200 : Rethrow to preserve stack details. That's one recommendation that as a developer you might have seen when running Code Analysis on your solution. So what does it mean ? What does the guilty code looks like and what is the correct way to throw exceptions. Lets start with incorrect code first. Considering following … Continue reading Rethrow Exception
Mocking objects is integral part of Unit Testing. The nucleus of Mocking is Dependency Injection, which allows us to inject Mock object into the code. But what happens when programmer has used the "Using" keyword ? For Example, This makes it difficult to mock DbCommand. The solution lies in deploying Factory Pattern to create our CustomDbCommand. For … Continue reading Mocking IDispossible with “Using”
When developing domain classes in Entity Framework using Code First Approach, the default code conventions creates a primary key of a property named "ID" or <ClassName>ID. But if you wanted to use another property as your primary key , you can use DataAnnotations and decorate the property using "Key" attribute. What is more interesting is … Continue reading Composite Primary Key using Data Annotations
Again one of those things which looks so simple, but could drive one mad during debugging. Much before Optional Parameters came in, C# developers used to depend on Method Overloading for mimicking Optional Parameters. Consider a scenario where both exists, what would be the output ? The output would be : The reason behind this … Continue reading Evil Code 0002 Optional Parameter Vs Method Overloading
Code-Execute-Debug-Code-Execute-Debug.. This seems to be never ending cycle for any developer. Considerable amount of time of this cycle is spend in Debug phase, wherein user steps through breakpoints and traverse the objects and their properties. Thankfully, Microsoft has ensured that primitive types always shows the value, instead of any less-meaningful information. But what happens when … Continue reading Customized Debugger Tooltip