Tuesday, May 15, 2012

Using ODAC with EF4 via WCF

Oracle Data Access Components (ODAC) 11.2 Release 4 (11.2.0.3.0) with Oracle Developer Tools for Visual Studio includes support for Entity Framework and LINQ. Implementation is simple, however when I called the query from a WCF service I got the error:

System.ArgumentException was unhandled by user code
  Message=The specified store provider cannot be found in the configuration, or is not valid.
  Source=System.Data.Entity
  StackTrace:
       at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
       at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
       at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)
       ...
  InnerException: System.ArgumentException
       Message=Unable to find the requested .Net Framework Data Provider.  It may not be installed.

A bit of research discovered that 32-Bit Applications are disabled by default in the IIS Application Pool. As soon as I changed Enable 32-Bit Applications to True everything worked fine.


Tuesday, May 8, 2012

Testing the Untestable with VS2012 Fakes

One of the new features included with Visual Studio 2012 is the Fakes Framework which offers the ability to detour code at runtime and isolate functionality for true unit testing, regardless of whether the code was written with testing in mind.

I began speaking on Fakes back when it was a beta product from Microsoft Research called Moles. While the core functionality remains the same, Microsoft has streamlined the implementation and now calls the detour mechanism a shim rather than a mole.

If you have attended this or another of my talks at a user group or conference, please take a moment to share your feedback on SpeakerRate.

The PowerPoint is available on SlideShare and below are links to the code demonstrated in the presentation.

Demos
Y2K Checker (simple introduction)
DateTime Audit (avoiding non-deterministic tests)
File Reader (shimming file system access)
Repository (stubbing interfaces)

Resources
Visual Studio 2011
Fakes MSDN Documentation