Monthly Archives: October 2011

XAML Irritation

Can anyone explain the following: <Style TargetType=”{x:Type Button}” BasedOn=”{StaticResource FontStyle}”> <Setter Property=”Template”> <Setter.Value> <!– wont work without respecifying the TargetType…?–> <ControlTemplate TargetType=”{x:Type Button}”> <Border Background=”{TemplateBinding Property=Background}”> <ContentPresenter/> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> As in – why does the TargetType have … Continue reading

Posted in Uncategorized, WPF | Tagged , , | Leave a comment

Sum and Count in EF

It bugs me that I need to play around with casting in linq expressions just to make aggregate functions safe. For example: decimal? total = storeDb.Carts .Where(cart => cart.CartId == ShoppingCartId) .Select(c => (decimal ?)c.Count * c.Album.Price) .Sum(); See that … Continue reading

Posted in EF | Tagged , , , | Leave a comment