August 2010 Blog Posts

Entity Framework and Show & Tell .NET community event in Swenug Skåne in Malmo, Sweden

If you are nearby or live here don’t be square! First NUG event in Skåne, Sweden for the fall is one with two agenda entries; Entity Framework and Show & Tell raffle. Dag König from Microsoft DPE Sweden will join us to give the latest info Entity Framework. We will have a raffle on who will get to present their latest cool/interesting/noteworthy thing from .NET development with a prize raffled among the participants. Join Swenug and sigh up for the event here: http://www.swenug.se/events/skaane-entity-framework-show Sponsor is Jayway. Cheers, M. Technorati Tags: Swenug,NUG,Entity Framework

Lazy<T> with implicit cast to T can give you some pretty code

Adding an implicit cast functionality to Lazy<T> can give you an option to writing null checkers in your delayed instantiation properties. The problem Today in our project a colleague was cussing over the fact that he kept writing the same block of code over and over again when null checking a property with a backing field. Given the class Foo: private Foo oldFooProp; public Foo OldFooProp { get { if (oldFooProp == null) { ...

Handling Lazy + Metadata instances in Managed Extensibility Framework (MEF)

Have you ever wanted to dynamically choose from many potential implementations of some code? Would you like to have the power of metadata filtering and lazy instantiation of the selected implementation? Here is how to do just that using Managed Extensibility Framework (MEF) and also a neat trick to handle your implementation/metadata pairs that I recently put to good use. Code samples and optimizations follow so don’t worry; I won’t remain all theoretical in this post. (MEF is part of .NET Framework 4.0 but is available also on CodePlex for other releases – MEF Community Site.) Up front I...