Category Archives: Uncategorized

Entity Framework Issues

I’ve come across two issues with the Entity Framework, one that effects any language and one just for VB.NET

It’s quite simple, the Entity Framework generates edmx files, however that Inherits Global.System.Data.Objects.DataClasses.EntityObject, which means when you create your Partial class you can not Inherit from your own base class.

The second issue is related to VB.NET, as if you are intending to use Dependence Injection or IoC you need to have an Interface defined and to implement an Interface in VB.NET you must add Implements after each Property and Method, which you can not do as the framework generates it’s own code.

I’ve attached both C# and VB.NET examples, none of which compile

Entity Framework Issues.zip (42.58 kb)

HTTP Sniffer

Why can I never seem to remember the name of software I have used before?  Perhaps that is one reason why I try to keep my blog up to date, as I use it as a brain dump of tasks I have been working on, so when my memory fails me I can also revert to my Blog and perform a search or look at the archive and find what I as working on say 2 years ago.  I know softare moves on, but I always find some software no matter how old it is, just can’t be beaten.

One piece of software that I always go back to is Fiddler, HTTP Debugging Proxy which logs all HTTP traffic between your computer and the Internet. Fiddler allows you to inspect all HTTP Traffic, set breakpoints, and “fiddle” with incoming or outgoing data. Fiddler includes a powerful event-based scripting subsystem, and can be extended using any .NET language.

Of course if you are using Visual Studio and the in built web server, which works without going through the Proxy, at it is running locally.

IE7 and the .NET Framework are hardcoded not to send requests for Localhost through any proxies, and as a proxy, Fiddler will not receive such traffic.  Here is a snippet from fiddler web site which works very well.

The workaround is to use your machine name as the hostname instead of Localhost or 127.0.0.1. So, for instance, rather than hitting http://localhost:8081/mytestpage/, instead visit http://machinename:8081/mytestpage/. 

…Or, if you’re using Fiddler v2.1.8 or later, just use http://ipv4.fiddler to hit localhost on the IPv4 adapter, or use http://ipv6.fiddler to hit localhost on the IPv6 adapter.  This works especially well with the Visual Studio test webserver (codename: Cassini) because the test server only listens on the IPv4 loopback adapter.

Lastly, you could Customize your Rules file like so:

static function OnBeforeRequest(oSession:Fiddler.Session){

  if (oSession.HostnameIs(“MYAPP”)) { oSession.host = “127.0.0.1:8081”; }

}

…and then just hit http://myapp, which will act as an alias for 127.0.0.1:8081.

My Weather station

I’ve been playing with my Weather station, Watson W-8681, since Christmas Day, and I love it.

It came in a small box, all tidy and wanting to be built on Christmas day

Taking it all out of the box, you get the rain water measurer, wind direction, software CD, temp and wireless sensor and a cover to protect it, wind speed and all the fixing clamps needed.

The LCD display is very clear, and it is wireless, which means I can place it anywhere in the house and still know what is happening outside.  A single click anywhere on the LCD display lights up the panel for easy viewing.

Once the instruments are all assembled, it looks like a real weather station.

Software need to run the weather station, and pick up the data, which then stores all the data in EasyWeather.dat file

Easy Weather v4.ZIP (1.36 mb)

To enable upload to the Internet I used Cumulus software which take the EasyWeather.dat file and processes it, uploading html file via FTP and it also allow you to upload the data to Weather Underground, to allow others to see your results

CumulusSetup.exe (2.10 mb)

I have all my data being sent to the village web site 

All in all I am very pleased with the Weather Station.  The software is very retro and could do with being update, perhaps to WPF or Silverlight, but I don’t have the time at the moment to embark on a new project.

Creating an Entity Connection for the Entity Framework

When you start to play with the Entity Framework you will soon come up with the need to store your connection in a common place.  To do this you will need to with provide the connection string to the Entity Object Context or provide the Entity Connection.  I prefer to us the Entity Connection as you can explicity define each section of the connection.

C#

VB.NET

and if you need to pass in the UserID and Password

For some more help on setting this up check out Ricka on Dynamic Data