Page Options
You are here : Home
...and the Geek shall inherit the Earth Blog... Minimize
Author: Lance Larsen Created: 11/4/2008 3:58 PM
Microsoft .NET Development

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_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.

image 

Now, when architecting this solution, have to take many factors into consideration:

1) First and foremost, time is of the essence ( literally ) – as many of the organs have as small as a 6 HOUR window of opportunity from surgical “procurement” to transplantation.

2) The UWHealth ITS ( Info Technology Systems ) team generally consists of non-.NET developers who are tasked to maintain and customize purchased products developed from a wide variety of other companies.

This project is a new type of endeavor for the department as a whole – ie. in house ASP.NET development.

So while the development staff and project management team are top notch and extremely knowledgeable about the what the application will need to do – they are relatively new to developing critical ASP.NET core applications.

And most importantly in my decisions, they will need to be able to maintain the developed ASP.NET application once the application is past the development stages.

So…

1) For now, choose to go with an n-tiered implementation (obviously ) -- and based on the experience level of the folks that are going to support it after I depart, going with classic WebForms, not MVC.  

As to MVC, I'm not necessarily sold on the benefits of MVC over WebForms myself yet either – spent time playing with the MVC RC1 from Microsoft that allows for easy setup of MVC – and that works great!, but aside from making TDD a little easier - not sure moving away from WebForms will happen any time soon for most projects.

2) Right now looking at how I want to implement my DAL, looking at Linq to Entity as I haven't used that before and it appears to be the direction Microsoft is going, as opposed to Linq to SQL, etc.


Just started a new gig Monday before last – hired on as an independent contractor for a Senior .NET Architect position at UWHealth here in Madison, WI for a 6 to 12 month project. 

Tasked to build an OPO ( Organ Procurement Organization ) application that we’ve named DonorLink. 

DonorLink will be used anytime someone who is an “Organ Donor” ( ie. someone who has the “red dot” on their driver’s license ) passes away in the hospital.  Then DonorLink becomes a pivotal asset in the coordination of managing the process of getting the “procured” organs – everything from a heart, lungs, eyes, kidney, tissues of all sorts, etc – from the donor to a recipient who is waiting on an organ transplant to prolong their life.  Can’t get much more important than that.

Very pleased that they reached out to bring my experience and expertise to Architect their ASP.NET application as well as potentially mobile and other application in the future.

Will keep blogging on the Architecture process – and looking for feedback from my .NET peers.

imageWent down to the MDC (Microsoft Development Conference) in Chicago,  Came down early to meet up with some of our Microsoft contacts.  Great opportunity to network - and line up speakers of the Madison .NET User Group (www.maddotnet.com).

Asked by Larry Clarkin (who did a great job of running the speakers, etc.) to assist with the Community track, so we put some time aside to speak about the .NET User Group as well as the other technologies that were being discussed throughout the day.

imageSpent time investigating Azure (www.azure.com) - Microsoft's cloud computing implementation.  This is Microsoft's way to compete with Amazon, etc with virtual server "Cloud" application hosting -- but they're taking a spin on it by leveraging the existing .NET developer's skill base and tightly integrating it into their development tools.  Azure is currently in CTP (Community Technical Preview) - look forward to spending more time on this and identifying when and where it would benefit my clients.

Also, very excited after looking at the upcoming release of Visual Studio 2010.  Some of the features that look to be exceptional are the QA features - giving the developer not only a VIDEO of any exceptions as they occur on the tester's machine, but also give the developers the ability to debug into the very code - and hit the exact exception - to see why the error occurred.  No more wasting time chasing down errors that are difficult to reproduce...

Also VS2010 has some nice Regression / Unit testing enhancements - including the concept of a "Gated Checkin" - wherein the team can set it up that prior to any code check-in, all code is updated, and built to validate that there will no longer be any broken builds.

Finished up with getting the low down on the latest ASP.NET 4.0 features that are in planning to be rolled out.  Check out -- www.codeplex.com/aspnet -- for more details on those.

Thanks to all the folks at Microsoft, very nice one-day event.

CardSwipe I do a lot of development for mobile devices. 

Specifically, I needed to integrate a mag-stripe reader that fits into the CF slot of a PocketPC into a SmartDevice C# compact framework application that I am in the process of creating. 

The overall goal is to allow a credit card ( but could be any card with a mag-strip ) to be swiped directly on the mobile device and have that data integrated into the application.

Took advantage of the SerialPort class in .NET, and spun off an example application illustrating that to share with anyone else needing similar architecture.

Download: The "CardSwipe" example code ( Visual Studio 2008 )

Read More »

524e2afb-638a-4dc8-99bd-0fdc4d19613a

Registered for the local Microsoft Professional Developers Conference (PDC) taking place in Chicago on Jan 13th. 

Always good to be exposed to the newest offerings from Microsoft, and then we can dive deeper into them at our Madison .Net User group meetings.

Registration is reasonable at $99 - and they will be speaking about Azure Services Platform, Windows 7, .NET, Silverlight, Surface, Parallel Programming, Live Mesh, and more.

Will Twitter about it...

A case study that details the .Net development education program that I co-lead at First-Data...

7caf8ee3-b97b-4174-a07c-820a9fb68827adobePDF_sm "The success of First Data’s implementation springs directly from the vision and commitment of three key individuals. ... Lance Larsen (Senior Application Architect) worked with McCarthy to guide the implementation across multiple software teams and locations."

Always rewarding to see something into which one put so much effort, work out so well.

"This case study explores how First Data Corp invested in the success of their software teams by adopting a hands-on approach to .NET developer training. They immersed their developers in a 100% practice based .NET learning environment."

Download: Case Study

"As we continue to see uncertain economic conditions around us, I would like to take this opportunity to highlight the value of a local .NET community during difficult times. Across North America and around the world, groups of people gather in person and online to share their knowledge and engage in conversations relating to software. ...and focus on a variety of aspects related to working with Microsoft .NET technologies."

"...These groups and their associated communities of software professionals represent a tremendous resource and provide some of the best training opportunities that exist today. The presentations that take place in monthly user group meetings are a great opportunity to learn more about the constant flow of new technologies we are faced with today and continue learning how to better utilize the existing tools and technologies that we have today."

"If you're a company or recruiting firm looking for some talented .NET skills, check out your local groups as well. These are the people putting in the extra effort to pay attention to technology and grow their skills."

"Getting involved in your local user group, either attending events, and/or volunteering to help or present is a great way to get involved, make new contacts, and help expand your skills and expertise."

Completely agree with the above quote from Rob Zelt - President, INETA NorAm ( rob.zelt@ineta.org )

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