In several previous postings I have whined about the fact that Entity Framework does not support the modelling of associations that are defined by an Interface rather than a Class, and explained why this capability is important. In my last posting on this subject (http://blog.nakedobjects.net/?p=60 ) I posited a workaround.
With the release of Naked Entities, which runs against Entity Framework v4, I’m pleased to say that we have implemented a much more elegant workaround. Still not perfect, and still a workaround, but much better. It draws on two capabilities:
- Complex Types. This allows the ‘two part foreign key’ (one column defining the Type of the associated object, and the other defining the ID of the instance) to be treated as a single object.
- A new, templated, class in our App Lib called InterfaceAssociation
This, combined with a new code snippet (shortuct: ‘intass’) means that you can implement one of these associations in a jiffy.
I’ve recorded the folliwing short video tutorial, to shows how this works: http://www.nakedobjects.net/video/interface_associations.shtml