rss feed

Eric S. Davis

Web Developer Cheat Sheets

Good post directing to a couple of good developer cheat sheet sites:

http://www.trentjones.net/index.php/2009/03/cs/

Thirty Free Image Resources on the Web

Can never have too many good free image resources…

http://websearch.about.com//od/bestwebsites/tp/free-images.htm

Entity Framework and Primary Key Inference

For whatever reason there may come a time when you want to add a database table to your Entity Framework data model that doesn’t have a primary key defined. Don’t ask me why you would want to do that, but maybe you didn’t design the database and maybe you don’t have the authority to change it. Trust me, it can happen.

When the model generation tool analyzes your database and generates the model you may see a warning message similar to the following:

The table/view ‘[TABLE NAME]‘ does not have a primary key defined. The key has been inferred and the definition was created as a read-only table/view.

Since there is no primary key assigned to this table, the model generation tool does its best to figure out what it thinks the key should be based upon the table definition and the data that is currently in the table. The bigger issue here is that there is no primary key constraint defined either. If there is no primary key constraint, you can’t guarantee that future data changes won’t violate the primary key definition that was inferred by the modeling tool. So, the entity set is created in a read-only mode; no record inserts, updates, or deletions will be allowed for this table.

If you are certain that there will never be a situation where data added to or updated in this particular table would violate the inferred key constraint, you can manually remove the read-only configuration in the model by executing the following steps:

  1. Close the model designer in Visual Studio if it is still open and re-open the .edmx file in an XML editor
  2. Find the edmx:StorageModels -> Schema -> Entity Container -> EntitySet element that refers to the table in question
  3. On the EntitySet element, rename the store:Schema attribute to Schema
  4. Remove the store:Name attribute altogether
  5. Remove the opening and closing DefiningQuery tags and everything in between them
  6. Save and close the .edmx file

You should now be able to make changes to your table data via the data context and entity classes.

Note: You will have to repeat these steps if you ever refresh your model from the database since your changes will be overwritten.

New Useful AJAX And JavaScript Techniques

Great article providing a number of links to AJAX & Javascript tutorials and technique demos.

http://www.smashingmagazine.com/2009/03/08/70-new-useful-ajax-and-javascript-techniques/

Using Vista Install Media to Perform a Complete Disk-to-Disk Copy

A co-worker recently brought this article to my attention. It’s a little-known trick to use the RoboCopy utility included on the Windows Vista installation media to perform a complete disk-to-disk copy between 2 hard disks – no need for Partition Magic or any other 3rd-party tool. Comes in really handy if you want to upgrade to a bigger hard disk without performing a “nuke & pave” reinstall of the OS.

http://geekswithblogs.net/lorint/archive/2006/12/07/100596.aspx

Thanks Trent! Good stuff.

Clear And Effective Communication In Web Design

Good article discussing some effective techniques and best practices for clear web site communication.

http://www.smashingmagazine.com/2009/02/03/clear-and-effective-communication-in-web-design/