Codepolice

Random posts from Ola in English. Mainly about programming and the web.

Entity Framework Scaffolding: The type is not mapped issue

This was a tricky one. I was just watching Scott Hanselmans session from MIX 11 “Microsofts Web Stack Of Love” and as always the guys it totally brilliant. It’s like stand up mixed with development. Anyway, he talked a bit about MVC Scaffolding and about how awesome it was. I fired up Visual Studio and installed MVCScaffolding via NuGet added some EF Models and boom! This was what i saw.

The type was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject.

Hmm, that was not what i expected. Turns out that i had not installed Entity Framework 4.1 completely. I found this post and i had the exact same problem. Just download Entity Framework from here and everything should work as excpected. Now back to the session!

MS SQL: Saving changes is not premitted if the table need to be re-created

This is a classic. Microsoft SQL Server 2008 introduced a feature that prevents you from changing a table in the designer if it need to be re-created. And whenever i get this i always forget where to turn this feature off. This time i recorded a 14 sec video that shows where this option is. Enjoy :)

Using external SMTP server to send mail via diffrent addresses in Gmail

There is an awesome feature in Gmail that makes it stand out from many other webmails and it’s that you can specify a external SMTP server so that you can send mail from other e-mails. I understand this is a advanced feature that not so many people use but it has an major flaw.

If you change your password on the account that you use to login to your external SMTP server your mails will not be sent. And that is of course fine but the scary part is that you wont get any form of error or notifications that this happened.  Hopefully Google will fix this soon and give us an error when it can’t login to the SMTP Server.

Issues when you upgrade WordPress plugins and core on ISS 7.5

I have had lots of issues with upgrading WordPress plugins and the core WordPress engine on my IIS 7.5 server. The problem has been that you try to upgrade the plugin, you get a fail notice AND the plugin is simply disabled and you loose permission to the folder where the plugin was located. Then you must wait for a couple of hours until you can reinstall the plugin.

When you Google this you find post after post suggestion you to add IUSR users and stuff and give them write permission and while you probably have to to that it was not what was causing this issue.

The problem is the WinCache plugin that IIS use to do some caching stuff with PHP. I finally found this thread that explains the issue and point you to a upgraded version of the PHP extension.

After installing that new DLL everything worked as expected for me at least.