Je možné, že jste nestihli “Entity Framework” přednášku na Gopas TechEdu a dokonce ani Entity Framework 4.1 – Code First o chvíli později. Ale to vůbec nevadí, protože máte další šanci. Tentokrát v rámci WUGu v Praze.
Zajímá-li vás co je nového v Entity Frameworku (aktuálně verze 4.1), nezapomeňte si poznamenat termín 25.7.2011 v Praze v “akvárku”.
Registrace na wug.cz.
There’s a lot of new stuff coming with the Entity Framework June 2011 CTP – enums and spatial types and … you can find it all around blogosphere. And for sure, I’ll cover my finding as I’ll dive into it. But there’s one, one could call it very minor, improvement, that was in, my opinion, pain in the ass.
Previously, the designer settings, like positions of lines for associations, sizes of entities and even zoom level were stored directly in EDMX file. Hence possibly creating changes in it even if you only read it. But the new CTP solves it. The designer’s content is now in a separate file. So if you’re about to commit to VCS you can much better see what was really changed – whether then model itself or only the designer (and you can ignore designer changes if you want).
Nice isn’t it? Pity that this “bug” made it to the first release.
I was reading Twitter yesterday and spotted a tweet from Shawn Wildermuth about his pain about using coalesce operator (
??) in C# and doing immediately something with result.
I had same problem maybe a year back, when I was dealing heavily with XML and LINQ to XML (but it doesn’t matter). I created for myself a little extension method to help me solve writing lines like:
Something x = (a == null ? "FooBar" : a.FooBar);
public static TResult ObjectCoalesce<T, TResult>(this T o, Func<T, TResult> operation, TResult @default)
where T : class
if (o == null)
And simple usage:
Something x = a.ObjectCoalesce(y => y.FooBar, "FooBar");
When it’s nested in some calls, it really helped me to make my code shorter. You can also play (I did) with idea of having the default parameter as delegate so it will be evaluated only if needed. In some cases it could make a huge difference (i.e. side-effects).