Category Archives: Data Access

EF Mapping Helper on Code Gallery

There’s a new very cool tool on MSDN Code Gallery from the EF Team called EF Mapping Helper.

What it does is allow you to select various mapping scenarios (eg. TPH Inheritance) and the helper will display a visual image of what the mapping does and the actual XML of the CSDL, SSDL and MSL so you can see what it looks like in the actual schema.

You can combine the mapping types to see how they all look together as well.

This is a huge benefit because sometimes it’s just hard to set these things up, therefore how can you see the impact. It’s a really great way to look at this – if you are not afraid to look at XML. 🙂 (Since the visual designer can’t do everything, it’s useful (to say the least) to know how to work in the XML.)

It will also give ideas of some of the cool things you can do with mapping in an EDM that you may not have thought about. EDM’s highest power is in it’s ability to really shape your conceptual layer in ways that you can’t do with traditional ORMs. But learning all of the different ways to customize a model can be daunting. So I’m really happy to see this tool!

Here’s a view of a TPH mapping (click on image for full size)

and a view of a model that contains a TPH and TPC (table per concrete type). It’s quite dizzying, so I’d recommend looking at individual mapping scenarios first.

IdeaBlade’s DevForce Entity Framework video is onlnie

IdeaBlade has a 45 minute webcast demonstrating their Entity Framework implementation. They have taken EF and plugged it into their pre-existing framework which already knows how to do a lot of the things that the EF APIs can’t do yet. They also have extended the design tools (even with a pluralizer sniff sniff). They have extended the EDMX by adding additional attributes (which apparently won’t prevent the model from being used elsewhere) and replace the objectContext with their own object manager.

I’m really impressed. Because they already had their framework that they could plug EF into, they are light years ahead of me, who is starting from scratch trying to figure out how to make EF do these things on it’s own – which in some cases is not an easy task.

Some of the things that DEF can do that I am struggling with are

  • Use objects across tiers
  • Use objects across tiers without needing EF on the client
  • Roll back changes to the object cache
  • Query the object cache without hitting the database.

There’s more, but it’s too depressing to keep listing. I’m just kidding about it being depressing. I’m actually very happy to see someone prove that the EDM and the Entity Framework can be used (even if it takes some tweaking) in real enterprise applications.

I’m also a little envious. It would have been fun to work on this project with all of the resources and existing IP they had at their disposal.

Check out the video.

Entity Framework full day pre-con workshop at DevConnections

I am in the terribly pathetic position of having to try to let people know about my workshop because it was inadvertantly ommitted from the printed brochure which has been inserted in the past few issues of MSDN Magazine and aspNetPRO magazine.

My workshop is listed on the website and the online schedule, but not in the printed brochure, so I think lots of people who may be interested, will not even be aware of it.

This is the start of the full Data Access track at DevConnections. We’ll have non-stop data access sessions for four straight days!

Here is a link to the Pre-Conference Workshop page.

SO here it is again:

VPR204: ADO.NET Entity Framework: From 0 to 60 (9:00am – 4:00pm)
Add’l Fee $399

Julia Lerman
This full day workshop will provide you with a full overview of the soon-to-be released ADO.NET Entity Framework, Microsoft’s new core data platform. In this workshop, you will learn what the Entity Framework is and how it fits into your application and enterprise architecture. We will begin with an introduction to the Entity Data model, how to build it, and how to implement it in its simplest form. Then you will learn how to take advantage of the true power of the Entity Data Model by creating customized mappings and implementing it in real-world multi-tier architectures. You will learn how to query Entity Data Models using LINQ to Entities, Entity SQL with Object Services, and stream data with Entity Client. The workshop will also explore some of the more complex features of object services as well as offer guidance as to when and where to you will want to use the Entity Data Model and which of its core querying methods is right for different scenarios.

I’ll be doing this workshop in at the Developer Summit in Stockholm on April 11th as well.

EF & LINQ to SQL queries against spatial data (not SQL Server 2008 though)

[thanks to Roger Jennings for the correction about spatial data]

Samir Bajaj, a developer on the Entity Framework team has begun his blog with a bang.

He describes a sample application (available on MSDN Code Gallery) that can switch  between LINQ to SQL or ENtity Framework, highlighting the differences between the two.

The application targets an business case that he is very familiar with  – searching  a database filled with drawings which are based on a collection of shapes. Samir has a background working for a CAD company and explains that it is a common task to search for drawings that contain particular shapes.

Thanks to SQL Server 2008’s new spatial data, this gets really interesting.

Added: While SQL Server 2008’s spatial data may have been an inspiration, it will not be not supported by LINQ to SQL or EF in the near future, so Samir is using his own techniques with SQL Server 2005.

Check out his blog post and then the app, called Sketchpad (requires SQL Server 2008 CTP)

SQL Server 2008: What about Developers? video

Rick Dyess from Solid Quality Learning recorded a quick (12 minute) talking-head video explaining the new features of SQL Server 2008 that would be of interest to developers. It’s called “What about Developers? SQL Server 2008 and the Development Environment”  As I haven’t been paying huge attention to SS2008, I definitely wanted to see this.

You may have heard about some new date types: e.g. a Date that you don’t constantly have to strip the time out of and a time that you don’t have to extract out of a DateTime field – thank heavens!

There’s also a file stream type that stores the stream in the file system but keeps a pointer in the database to it. We often do this manually. So now SQL Server will take care of the plumbing for you.

I hadn’t been aware of the hierarchical type which lets you keep track of hierarchies between objects. I have to actually see this in action to understand it better.

There is also a geospatial type that will probably make a lot of people happy. It’s over my head. 🙂

SQL Server 2008 takes care of a problem that I wasn’t even aware of. Rick explains that when you have a null in a column, it will take up the full space allocated to the column. That’s a lot of wasted space for containing “nothing”. SO that’s been fixed. Null will take up no space.

There are other features that he quickly reviews in the video such as improvements to Service Broker (e.g. it knows how to prioritize the services).

One thing I found confusing was the way he presented LINQ to SQL and Entity Framework (including EF’s object services). LINQ to SQL is a feature that is [extremely] useful for developers accessing a SQL Server Database. Entity Framework is a feature that is [extremely] useful for developers accessing any database which has an E.F. provider available. Rick presented these as “new features of SQL Server 2008” although I don’t really think he actually meant to suggest that these are features OF SQL Server 2008. But unfortunately, that’s how the message comes across. It’s not the end of the world, but a bit misleading (again, I believe wholly unintentional).There’s also “coming soon” book listed on Amazon with the confusing (to me) title of “Pro SQL Server 2008 Entity Framework”, from APress. But then again, Roger Jennings pointed out that the title of my own book “Programming Entity Framework” is odd given that Dave Sceppa’s book is called “Programming the Microsoft ADO.NET Entity Framework”. I know my title was created by O’Reilly to fit into the “Programming” series at O’Reilly, so perhaps the APress book is following some in-house pattern as well.

Anyway, the video from Rick was a very quick and helpful way for me to do a quick, high-level, catch-up.

IdeaBlade has implemented Entity Framework into their DevForce Framework

While many of us are still struggling to get our entity objects across tiers, keep change tracking in place, keep graphs together, DevForce seems to have figured it out.

They are now touting their new DEF (DevForce Entity Framework) which going into Beta 1 soon.

You can sign up for the beta and check out some of their resources here.

Me? I’ll still struggle. I want to  figure (and lavish the process of figuring) out how it works. Really, I don’t want to ski; I don’t want to hang out with my dogs or hubby; I certainly don’t EVER want to go on a vacation. Nope, no shortcuts for moi! 🙂

There’s more to tell, but I’m supposed to be prepping for my user group presentation that’s tonight.

What I’m happy about is that it’s that this can be done in a flexible, reusable way; even if it’s still a little (yes, I know that’s probably a bit of an understatement, as was that) hard right now.

DataDeveloper.NET – A resource for developers interested in Data Access

Ahh – but who needs data anyway, right?

Everybody! 🙂

There’s a new website in town filled with news from teh blogosphere, articles, tutorials and an extensive list of resources for doing Data Access.

It’s called DataDeveloper.NET and can be found at http://datadeveloper.net (leave out the www)

Yours truly has had fun writing bunches of Entity Framework tutorials.

There’s also a great article by Matthieu Mezil called Entity Data Mapping, Beyond the Basics.