Posts

Showing posts from July, 2011

Encapsulating Sets of Properties in Complex Types, convenient or not?

Image
With EF we can group properties into Complex Properties. For example I'm using audit information on all my entities, like CreatedOn, UpdatedOn, Deleted and Enabled and I grouped them into a ComplexType named Audit. A customer can have an InvoiceAddress and a DeliveryAddress of type Address(Street1, Street2, County, Town Postcode).




This is nice, but I encountered some problems with the updates.
As MSDN says "When any property is changed anywhere in the object graph of a complex type, the property of the parent type is marked as changed and all properties in the object graph of the complex type are updated when SaveChanges is called."
So if the UpdatedOn is changed only, the EF will "update" and CreatedOn, Enabled, Deleted properties when the SaveChanges is called. This means the update statement will update UpdatedOn column with the new value and the CreatedOn, Enabled and Deleted with the values present in the Object Graph:
Let's create first a customer

var cust…

Remotely Install EntityFramework 4.1 with psexec and gacutil

I updated an website to use EntityFramework 4.1 Update 1. While I had no problems installing it on my dev machine, on the production machine the installer wasn't able to install the EntityFramework.dll on GAC. The reason is simple, there is no SDK installed.

I can't RDC on the production server, but I have a hidden shared folder, named "adrian$".

To install EntityFramework on the production machine I needed psexec, able to start and run gacutil. As I said, gacutil was not installed, because there is no SDK, so I copied the .Net 4.0 version (from C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools) on my shared folder "adrian$\gacutil" together with gacutlrc.dll from 1033 folder.
Next thing to do was to copy the EntityFramework.dll. Summarized, the new remote files looks like:

\\server\adrian$\gacutil\1033\gacutlrc.dll
\\server\adrian$\gacutil\gacutil.exe
\\server\adrian$\gacutil\gacutil.exe.config

\\server\adrian$\EntityFramework.dll

And the psexec co…

IIS 7.5, HTTPS Bindings and ERR_CONNECTION_RESET

Having an website with HTTP and HTTPS bindings, running on my local IIS 7.5 server, I encountered this error with Chrome, Error 101 (net::ERR_CONNECTION_RESET) while trying to access it with HTTPS protocol. I checked the IIS and the bindings were fine, both protocols were set and self-signed certificate didn't expire yet.

Since the website it wasn't accessible on the HTTPS protocol and everything seems ok at the IIS level, I suspected there was something which it can be fixed with the netsh command.

The first thing to do was to list the SSL server certificate bindings:

netsh http show sslcert

As I expected, there was nothing shown. To "add a new SSL server certificate binding and corresponding client certificate policies for an IP address and port" (from help), netsh can be used with some basic parameters: ipport, certhash and appid.

The certhash value can be read either from ISS Manager (Manage server\Server Certificates, select a certificate, click View in the right …