Page Options
You are here : Home
...and the Geek shall inherit the Earth Blog... Minimize
Author: Lance Larsen Created: 11/4/2008 1:10 PM
...and the Geek shall inherit the Earth...

I’m a big fan of EF (Entity Framework), specifically loving EF4 in Visual Studio 2010 RC – and wanted to share some tips that I’ve learned working with EF1/EF4 along the way.

In EF, you generally either do LINQ to Entities, or LINQ to ObjectQuery – both have their advantages and disadvantages. 

Specifically advantages that I use are for LINQ to Entites is that you can use lamda expression formatting for strong typed retrieval – not so for LINQ to ObjectQuery (see below). 

But LINQ to ObjectQuery has it’s advantages as well – the one big advantage that I take advantage of in my coding patterns is the fact that I can call the .Include() method after the initial query – thus I can “Eager” load tables based on some condition.  Will show more on late .Include() calls in future blog posts.

I believe that this is non-obvious, and I’ve never seen anyone else doing this before – but works very well for the approach I take, and wanted to share in case you need to use LINQ to ObjectQuery and distain not being able to use strong typed query formatting < as I do > in LINQ to Entities.  :)

   1: //----------------------------------------------------------------------
   2: // Example LINQ to ObjectQuery - note not using strong type where clause
   3: //----------------------------------------------------------------------
   4: ObjectQuery<RepositoryFile> selectQuery1 = 
   5:     this.DataContext.RepositoryFiles.Where("item.FileName = 'Word.doc'");
   6:  
   7: //----------------------------------------------------------------------
   8: // Example of LINQ to Entities - note we DO strong type the where clause
   9: //----------------------------------------------------------------------
  10: IQueryable<RepositoryFile> selectQuery2 = 
  11:     this.DataContext.RepositoryFiles.Where(item => item.FileName == "Word.doc");
  12:  
  13: //----------------------------------------------------------------------
  14: // Example of LINQ to ObjectQuery but using LINQ to Entities strong 
  15: //  typed syntax, but then casting it back to ObjectQuery
  16: //----------------------------------------------------------------------
  17: ObjectQuery<RepositoryFile> selectQuery3 = 
  18:     (ObjectQuery<RepositoryFile>) this.DataContext.RepositoryFiles
  19:     .Where(item => item.FileName == "Word.doc");

image

355MB/s of goodness are on on their way…

So, in an effort to boost my development laptops overall speed (it’s not bad but it’s not an i7 <g>) – I decided address my drive speed bottleneck and to look at picking up an SSD (Solid State Drive).

Started doing my research, and found that most the reviews were from 2009.  So in an effort to get the latest and greatest, searched for CES 2010 and SSD and came up with awesome reviews for the Crucial RealSSD C300.

But alas, it was not out (been checking their site daily-ish) – until today!

So, now it has been ordered, should be here by the end of the week… :)  Will review it when I get it.

image_thumb2As president of the Madison .NET User Group (MADdotNET) I’m very pleased to bring Chad Albrecht in to present on “Succeeding With Agile & TFS 2010” for our March 3rd presentation meeting – I’m a big fan of the Agile development process, and combining those with all the great new features in TFS 2010 – this should be awesome! 

Twitter: http://twitter.com/chadalbrecht
Blog: http://blog.chadalbrecht.com

Have you ever found yourself getting latest from a team project, and someone else “accidentally” checked in code that doesn’t compile?  Well – none of us are perfect – but – sure we all find this quite annoying. 

So imagemy first instinct is to right click on the file in “Solution Explorer” and back out the file to a previous version – but the file is buried deep in the file hierarchy.

So, instead of hovering over the file name tab in the main window, then following that path in Solution Explorer – found the following option in Visual Studio.

Go to Tools –> Options –> Projects and Solutions and click the “Track Active Item in Solution Explorer”.

Nice…  Try it out.

30e4aeb5-f7cd-4db2-857f-0385dcf366c3 I’ve seen several presentations on XAML before, and my take away perception from the brief overviews was that XAML was an excellent markup language for visual layouts to be used in both WPF and Silverlight applications. 

True or False? 

Well, it’s Both – while it IS a great way to layout controls – but it’s really a whole lot more.

What I truly didn’t realize was that XAML is essentially a Serialization of the code – thus you can do almost everything you can do in code – directly in XAML.  And that’s a powerful and non-obvious revelation.

Karl Shifflett and Jamie Rodriguez had a fantastic 2-Day training session… Highly encourage others to take any opportunity to see these guys.

In fact my brain hurts from information overload…! :)

Here are some useful WPF Links brought up during training:

Demo Code & Slide Deck – lots and lots of fantastic code and information – will need to dive deeper.

XAML Power Toys – VERY COOL! Tools to quickly put XAML code together.

WPF Example: Cipher Text – Not only a good example of WPF, but a useful application for securing information – thinking of switching to using it.

WPF Example: Southridge Realty – Wow, really amazing MVVM application for demo Realty company.

WPF Example: Collapsible ListBox – Great example showing the power or XAML with no additional code behind.

WPF Binding Cheat Sheet – There’s no intellisense for bindings – so this helps.

image If you’re not getting enough geek-to-geek face time at our MADdotNET meetings – there’s another software dev group in Madison – not specifically .NET – check out: http://softwaredev.meetup.com/113/

Our next Madison .NET User Group ( www.MADdotNET.com ) ALL.NET meeting will be on Wednesday June 17th. 

  • Looking forward to Steve Evans continuing micro-presentation series on Architecture Patterns.
  • We will also be spending a significant amount of time going through our Azure user group project – BetaMash.

    Have you ever wanted to beta test the latest software?  Are you a designer looking to show off your designs on the newest websites and applications?  Are you a developer looking for serious testers and designers to solidify your creations?

    BetaMash gives Developers, Designers & Testers a social network in which they can gain a reputation for excellence, translating that work into marketable skills and experience - and working on the newest applications around.

  • New members are always welcome to the ALL.NET meetings!
  • Certainly encourage everyone to come with questions about topics they are working on or wanting to work on, as you have an extremely talented group of developers / architects to which to ask your questions.
  • Bring your Laptops! ( if you have one ) :)

imageAttending a full day training on ASP.NET MVC by Jeffery Palermo ( Twitter @jeffreypalermo )

“With the new version of ASP.NET developers can easily leverage the Model-View-Controller pattern in ASP.NET applications. Pulling logic away from the UI and the views has been difficult for a long time. The Model-View-Presenter pattern helps a little bit, but the fact that the view has to delegate to the presenter makes the UI pattern difficult to work with.”

Wrote the opensource http://codecampserver.com/ in MVC

Really good speaker – great energy and engaged the audience.

image Having an MSDN event here in Madison, WI – I’m definitely going, and I know I’ll be seeing a lot of familiar faces.

Sign up for the Event!

Print  
Lance
LinkedIn Facebook Windows LIVE Twitter
Blog Code Minimize
Development Links Minimize
Interests Minimize
Personal / Family Minimize
Search Blog Minimize
Twitters Minimize

Print  

Copyright 2008 by Lance Larsen ( A.I. Labs )
Privacy StatementTerms Of Use