Monthly Archives: February 2010

Heading to San Francisco for the ESDC Conference and the East Bay .NET User Group

Tomorrow I am planning to do something that has caused my husband to laugh uncontrollably. I’m going to get out of bed at 4am. Yes it’s true! That’s because I have a 6:30am flight that will take me first to O’Hare airport and then to San Francisco.

Why am I leaving beautiful Vermont just when the lovely ski-able snow  has returned?

Ill be attending and speaking at the Enterprise Software Development Conference March 1-3 in San Mateo and then co-presenting at the East Bay .NET User Group with my friend (and one of the smartest people I’ve ever met, only because I haven’t met her two progeny who she says are smarter), Kathleen Dollard. Kathleen is presenting at ESDC as well.

ESDC is focused on agile development and I’ll be doing one talk on Agile Entity Framework 4 and a talk on using Entity Framework 4 with WCF. Kathleen will be presenting talks on the new Managed Extensibility Framework, aka MEF.

At the user group meeting, I’ll spend the pre-pizza half hour of the meeting showing off some fo the new features in the Entity Data Model designer in Visual Studio 2010. After the pizza, I’ll do an abbreviated version of the Agile EF4 focusing on a first look at the POCO support in EF and then Kathleen will be doing an intro talk on MEF.

It seems that the weather in SF is not much better than Vermont. It’s in the 40’s and 50’s, overcast and rainy. SO much for pretending that this is a vacation to sunny California. The tsunami warning should have passed by the time we arrive.

I”m looking forward to the conference as I’ll get a chance to meet some software legends like Kent Beck (maybe), see friends I haven’t seen in a while and finally return Kathleen’s Sigg bottle that she left behind at DevTeach in Vancouver last June and someone gave it to me because I live so close (vermont…colorado?). I actually spent a lot of time in November with Kathleen at another conference but had forgotten the bottle. It’s now on my kitchen counter waiting to go in my bag. I plan to fill that space on the way home with some Mrs. See’s chocolates. 🙂

Vermont IT Jobs: Database Developer/Admin at Gardener’s Supply

Join the team at Gardener’s Supply Company! We work hard AND offer a fun place to work with summer bocce games, BBQs, ping-pong tournaments, employee garden plots and much more! We also offer strong cultural values, competitive wages and outstanding benefits (including a tremendous discount on plants & product!).

Database Developer/Administrator:  Our IT team is looking for an individual that has a solid understanding of software development concepts and methodologies, relational database design, object oriented programming and N-Tier architecture.  You will be working in an environment that values industry recognized best practices to build and deploy secure, extensible, scalable and maintainable applications. You will be expected to work with other members of the IT team and different business areas to translate requirements into smart solutions using the Microsoft’s technology stack (Dynamics AX, .Net, SQL Server, SharePoint, Exchange, and IIS). The team will be counting on you to perform the database administration tasks for our SQL and Oracle servers to keep them running at peak performance.

We are an employee-owned company and America’s leading catalog & web-based gardening company! Interested? Please send your cover letter & resume to Gardener’s Supply Company, 128 Intervale Rd., Burlington, VT 05401 or to jobs@gardeners.com.

Vermont IT Jobs: Some more .NET Developer Jobs, Drupal and FoxPro, too, in Seven Days

This week’s Seven Days listed a few more .NET developer jobs and one for a Drupal dev. One company I hadn’t even heard of before so happy to discover them.

1. Here’s one I blogged about recently at an wonderful (I’ve worked with them) insurance company in Middlebury, Co-Operative Insurance

 .NET Development

2. Here’s one for a Sr. .NET Developer at Aurora North Software. I hope to meet these guys at an upcoming Vermont.NET meeting someday.

Senior Apps Engineer

3. Here’s the Drupal job at the very wonderful Eating Well Magazine in Charlotte

mid-level Drupal Developer

4. There is one in the paper that is not on 7Days website yet but I’ve verified that it is still available. It’s a short-term part time job at UVM doing ASP.NET development with VB . This is for the Vermont Center for Children, Youth & Families.

Look on page C-13 of the 2/17- 2/24 issue of Seven Days or leave a comment here and I’ll send you details.
Here’s a linkk to it’s listing on Vermont Job Link, but this requires logging in to see it.
https://www.vermontjoblink.com/ada/skillmatch/jobseeker_sm/jbs_gapanalysis_dsp.cfm?joborder_id=75116&rand=615208

5. Last one is the part time, short term FoxPro job at UVM that I blogged about earlier this week, at the Breast Cancer Research Center

Computer Programmer

6. Bonus – not in Seven Days but I found it on UVM’s site:

This one is working on software for people doing brain research at UVM. How cool is that? Details at https://www.uvmjobs.com, search for Requisition # 032952

 

Crystal Reports and Visual Studio 2010

If like me, you have a “can’t live with it, can’t live without it” relationship with Crystal Reports and have made a significant investment in reporting with their tools, you might be digging around the VS2010 RC looking for Crystal.

CR has been embedded into Visual Basic and Visual Studio for many versions. My experience goes back as far as Visual Basic 4, but in fact it started in 1993 with VB 2!

But it’s not in VS2010 RC. Well, kinda not in there.

Crystal Report is included in the project item templates:

cra

But when you select it, something odd happens. Rather than a designer, you will get this window:

crb

So it’s still available as a free extension to VS, just not built in. It’s odd that Crystal isn’t listed in the Extensions gallery that you can access through the VS2010 Extension Manager (on the Tools menu) or online at www.visualstudiogallery.com.

There’s an extensive blog post on the SAP website about Crystal Reports for Visual Studio 2010 which also lists new features, including a WPF report viewer.

I haven’t tried any of them out yet. What I’m most interested in is the design time experience with Entity Framework graphs. In VS2008, neither CR nor MS Reports recognizes navigation properties. A quick look at MS Reports (rdlc) in VS2010 suggests that this hasn’t changed. I’ll have to dig further at some point.

EF4 Breaking Change: EF4 inner joins affect eager loading many to many

Hooray! Turns out it was a bug ("unintended breaking change) and it’s getting fixed for RTM! 🙂 [see Connect submission and Microsoft’s response] Great catch George!

This is an edge case that I had not noticed, but was brought to my attention this morning in an email from Dave Russell who pointed me to this forum thread: EF4 Include method returns different results than EF1 Include

I had to test it myself because that’s the way I am.

Here is a model with the same set up : a many-to-many relationship between Person & Brewery defined using a join entity (FavoriteBrewery) and Brewery has a one-to-many relationship with Beer.

Putting a Stake in the Ground with .NET 3.5

This is the .NET 3.5 version of the model with no foreign keys.

ef1_manytomany

If I query for all people

var list = context.People.ToList();

I get back 137 people.

If I query for all people who have any FavoriteBreweries:

list = context.People.Where(p => p.FavoriteBreweries.Any()).ToList();

I see there are only 3 people who have favorite breweries

Now let’s start eager loading.

list = context.People.Include("FavoriteBreweries").ToList();

This gives me all 137 people, with those favorite breweries attached to 3 of the people. (I checked by querying the ObjectStateManager for entries that are FavoriteBrewery types.)

Next, I eager load the Brewery objects along with those FavoriteBrewery join entities.

list = context.People.Include("FavoriteBreweries.Brewery").ToList();

I still  have 3 FavoriteBreweries join entities. (There are only two breweries in my sample database.)

Person 1 — FB — Brewery1

Person 2 — FB — Brewery2

Person 5 — FB — Brewery1

Now I ask for the beers that are made by the breweries

list = context.People.Include("FavoriteBreweries.Brewery.Beers").ToList();

In the lame little sample database, Brewery1 has 2 beers and Brewery2 has 0 beers.

I still get the same # of Favorite Breweries

Person 1 — FB — Brewery1 …Beer Count=2

Person 2 — FB — Brewery2 …Beer Count =0

Person 5 — FB — Brewery1 … Beer Count=2

Testing the same loading in .NET 4

In .NET 4, there has been a LOT of work done on the query generation. .NET 3.5 used a LOT of outer joins which was really messy. Much of this has been replaced with inner joins. But the outer join allowed the previous query to bring back the Favorite Breweries and Breweries even when the Breweries had no beers.

Using  a new version of the model that now includes foreign keys:

ef4_manytomany

 

And running the same tests in .NET 4.0 where I”m getting the benefit of the new query processing, the query results change.

It is only when I eager load beers (where I know I have an empty collection for one of the breweries).

Here are the results:

Person 1 — FB — Brewery1 …Beer Count=2

Person 5 — FB — Brewery1 … Beer Count=2

The inner join prevented the database from discovering Brewery2.

I tested the same type of eager loading but this time using a many to many that does not include a join entity.

mmnojoin

The results for an eager load that grabbed People.Include(“StoreLocations.Registers”) did not pick up the Stores with no registers.

This is definitely different than what we have learned to expect from querying. I would only expect the stores to be filtered out if I had explicitly added logic into my query to only retrieve stores with registers.

It’s a breaking change that, because it’s an edge case, I don’t expect to be modified by RC so you need to be aware of it.

I’ll probably just point to this blog post from my book rather than walking through the whole thing again.

Thanks Dave for pointing out the forum and to George Fitch who started the forum thread: “good catch!”.

Where are the EF4 providers?

Thanks to Danny Simmons‘ comment below clarifying that the provides that support EF3.5 will still work for EF4 "just without new provider affecting features like model first."

As far as I can tell, and confirmed by Fabio Pandolfo (@fabiopand on twitter) who is also on the hunt, DevArt’s Oracle provider might be the only 3rd party provider that is currently somewhat supporting EF4, though they are publically claiming Beta 2 support, not VS2010RC.  If you read this thread on their forums, you’ll see why I qualify that with “somewhat”.

If you have any clues about the status of other EF providers and their support for EF4, leave a comment here.

Vermont IT Jobs: Part-time FoxPro development gig in Burlington through July

From Seven Days Classifieds:

Temporary position on breast cancer research project (http://www.uvm.edu/~vbcss). FoxPro for Windows knowledge and experience is required. Half to full-time through July. Strong teamwork skills needed. Flexible hours. Salary commensurate with skills and experience.

Send resume and cover letter to Dawn.Pelkey@uvm.edu.

The University of Vermont is an Equal Opportunity/Affirmative Action Employer. Applications from women and people from diverse racial, ethnic, and cultural backgrounds are encouraged.

Entity Framework Lazy Loading by Context or by Property?

When Entity Framework finally brought in support for Lazy Loading, there were still complaints. The lazy loading in EF4 is context based, not property based as defined by some of the other ORMs. (I’m not sure which ones or how many.)

I was thinking about this today and realized that EF does, in fact, support property level lazy loading.

There are three essential types of entities in EF4 –

  1. EntityObjects
  2. POCOs that lean on dynamic proxies at runtime
  3. POCOs that depend on EF’s snapshot notification

The POCOs that use dynamic proxies can do so only when every single property is marked virtual. Then they benefit from the same notification behavior at runtime as do EntityObjects and they benefit from lazy loading.

Simple POCOs that do not use dynamic proxies can still benefit from lazy loading. As long as the relationship property is marked virtual and additionally, properties that point to collections have to be a collection type that implements ICollection, the property will be loaded on demand (when the context’s lazy loading is enabled).

In this last case (the simple POCOs), you can pick and choose which of the relationship properties are able to lazy load. Then with the context set to LazyLoadingEnabled=true, lazy loading will occur, but only for the properties you have specified.

Now, I’m not sure how this compares to those other ORMs whose users criticized the context-level lazy loading, but it feels like it might be a lot closer then they realized. And I’m absolutely interested in finding out if I’m on the right track or completely off base (in which case I can only ask: “be gentle” 🙂 ).

Small Change in EF Loading Behavior from VS2008

In the process of updating my book, I have to recheck every statement and every line of code. A lot has changed. It’s as though I were writing the whole thing from scratch.

Here’s a small but notable change that I found.

In .NET 3.5 you cannot Load an EntityReference for an Added entity even when the entity has the critical piece of information — the EntityReference.EntityKey of the item to be loaded. It will fail with an exception.

In .NET 4, it works. You can set the foreign key property or the EntityReference.EntityKey and then load that related entity either explicitly or via lazy loading.

I’m pretty sure this is a result of the improvements made to the query generation. .NET 3.5 had a convoluted way of loading entity reference data. Now it’s more straightforward. However, I have only tested it with FKs.