2016-11-08 You will get System.ComponentModel.InvalidAsynchronousStateException (The destination thread no longer exists.) if a UI component gets disposed or the UI thread EXITs while a different thread is in the middle of invoking a change on the same UI component. This usually happens when a user closes a window (form) that has been updated by aContinue reading “Solved: The destination thread no longer exists exception – C#”
Author Archives: Menol
Using multiple versions of Entity Framework in the same solution
2016/07/20 Using multiple versions of Entity framework by different projects within the same solution. I had to develop a pilot project to use Entity framework (EF) 6.0 inside the solution that already has other projects that refers to EF 4.4. While debugging I received this error: Could not load file or assembly ‘EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’Continue reading “Using multiple versions of Entity Framework in the same solution”
SQL Server data types explained with .net data types
2016/07/19 Source / Reference : Msdn Member name Description BigInt Int64. A 64-bit signed integer. Binary Array of type Byte. A fixed-length stream of binary data ranging between 1 and 8,000 bytes. Bit Boolean. An unsigned numeric value that can be 0, 1, or null. Char String. A fixed-length stream of non-Unicode characters ranging betweenContinue reading “SQL Server data types explained with .net data types”
Quick reference for different SQL Joins
source: Visual Representation of SQL Joins from codeproject.com
SQL to Generate C# Properties from SQL Table Columns
2016/07/15 Below SQL will generate C# properties for all columns in a table in SQL server. Notes: You will have to fix datatypes that are not interchangeable between SQL and C#. You will also have to polish property names if you follow a different naming convention for column names. The query below automatically renames someContinue reading “SQL to Generate C# Properties from SQL Table Columns”
C# Reflection Code to Search Objects for Fields Properties and Methods and Get Values
2016-07-06 Code below will search for a given named property, field, or method inside a given object. It will search in below order: Properties Fields Methods It will continue to search until it finds a match that holds or returns (for methods) a non-null value. E.g. If you searched for “Name” and if there is a propertyContinue reading “C# Reflection Code to Search Objects for Fields Properties and Methods and Get Values”
When (or not) to Hyphenate Compound Adjectives
2016-07-06 Use hyphen only when the compound adjective comes before the noun. e.g. 1 – The candidate provided an up-to-date curriculum vitae. 2 – The curriculum vitae provided by the candidate was not up to date. References: dailywritingtips.com/adverbs-and-hyphens english.stackexchange.com
C# extension method to check if a string matches any string in given list
2016-06-16
Trigger window.resize event via javascript
2016-06-15 Use below code to trigger window.resize event. This can be helpful to refresh some libraries like Chartist.js when a panel or a div the control is contained in is expanded. P.S. The above method isn’t supported by Internet explorer (failed on IE 11), therefore use below method for wider browser support.
Preserving milliseconds when passing dates around front end
2016-06-08 Instead of passing the datetime pass the datetime.Ticks which is a (long) numeric value so the complete datetime value will be preserved. Then convert ticks back to datetime in the server (controller action method).