Tuesday, 11 August 2015

Entity Framework SQL Generated Scripts Speed Gotcha

One day I was working with tables with non-unique primary keys and was able to use the Visual Studio Entity Model EDMX editor to generate the classes for me. I know in my gut-feeling that there could be something wrong with I am doing since when you are using Entity Framework your table should have a unique key identifier. Anyway I ignored this thought and proceeded - everything works well in terms of adding and using the generated classes however I noticed that the query (with a subquery on it) was taking really slow. If I re-encode the "equivalent" SQL query manually it run fast as it should be but if I run the TSQL query that EF generated behind-the-scene it was terribly slow.
Somehow the TSQL code that EF generated was not optimized at all - maybe because it doesn't have a unique identifier.

So what I did is I just didn't use EF for that project because I can't touch or add unique identifier on those tables that I need to use.

Monday, 11 May 2015

Proxy Authentication error when accessing web service using Visual Studio

To configure a Visual Studio project to use your IE / Chrome proxy authenctication settings include these lines in your web.config.
-----------------------------------

<system.net> 
<defaultProxy useDefaultCredentials="true" /> 
</system.net>

Thursday, 22 January 2015

Installing your Multi-device hybrid app project into a generic android device without existing driver to be found

I had this generic android 4.1 tablet device from work (a very cheap one) and I need to try and install my multi-device cordova app on this tablet but unfortunately there is no USB device driver available anywhere including the manufacturers website. I can't deploy my app without installing the USB driver first. So what I did is I followed an advice from this link - http://stackoverflow.com/questions/17509422/android-device-is-not-connected-to-usb-for-debugging-android-studio/22887262#22887262 and added the device ids of the tablet into the file called "android_winusb.inf" at C:\Program Files\Android\android-sdk\extras\google\usb_driver\. The entries I've added look like this:

;Pioneer Dreambook 7
%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4E22&REV_0231&MI_01

%SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4E22&MI_01

This works well with my generic tablet and I was able to install my app.

By the way you can view your device driver id by going to the "device manager" and looking for the "Unknown Device" with warning sign or an exclamation point. Right click on it and select 'Properties' and go to the 'Details' tab. Then under the 'Property' drop down menu, select hardware IDs.