Table of contents:
Category: Development
-
The specified type member is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported
This morning I was writing an Entity Framework query where I was selecting an object from a model called Invoice to a table called NetsuiteErrorLog. This previously used to be an actual relationship in my EDMX; however, I needed to do some refactoring and remove the direct foreign key from Invoice to NetsuiteErrorLog. When I did this I needed to add a new partial property that mimicked this relationship. When I did that and tried to perform my query I received the generic error:
The specified type member ‘NetsuiteErrorLog’ is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported -
Preview an image before it is uploaded
This is something I haven’t really thought of before, typically when I implement a file upload for an image the preview happens after. However, there is actually a really simple way to get a preview of it before the actual upload happens to the server. Let’s take a look at an example.
-
Sort array of objects by any property value using Javascript
Javascript contains a built-in array method to sort simple arrays. But I rarely am using simple JavaScript arrays, typically the elements inside my array a complex objects with many different properties. A simple example is a person that perhaps contains a first name, last name, and age. I can see myself wanting to sort by any one of those properties. So how can I sort a JavaScript array that contains complex objects and better yet, not hard-coded and dynamically by any property of my object.
-
How to randomize (shuffle) a JavaScript array
I have rarely wanted to randomize an array with Javascript; however, whenever I do I forget how to do it. Today that day changes, I’m going to write it down to both help my memory as well as have an easy place to find it in the future. Alright, let’s look at a simple solution to randomizing or shuffling a Javascript array.