Monday, August 27, 2007 - Posts

Entity Framework - Object Services Level. Transactions.

How do transactions play with the Entity Framework? As a starting point, if I do something like; static void Main(string[] args) { using (NorthwindContext ctx = new NorthwindContext("Name=NorthwindEntities")) { foreach (Shippers Read More

Entity Framework - Object Services Level. Concurrency.

If we're going to be updating or deleting records in the database then we probably care about concurrency. What happens if we've got code like this;static void Main(string[] args) { using (NorthwindContext ctx = new NorthwindContext("Name=NorthwindEntities")) Read More

Entity Framework - Object Services Level. Deleting and ObjectStateManager.

Following the general theme of the last couple of posts (here and here), I thought I'd carry on and experiment with deleting. static void Main(string[] args) { using (NorthwindContext ctx = new NorthwindContext("Name=NorthwindEntities")) Read More

Filed Under: , ,

Entity Framework - Object Services Level. Updating and ObjectStateManager.

Following on from the previous post I wanted to apply a similar approach with updating data. If I go and grab the first Shippers record from my store; using (NorthwindContext ctx = new NorthwindContext("Name=NorthwindEntities")) { Read More

Filed Under: , ,

Entity Framework - Object Services Level. Inserting and ObjectStateManager.

I'll try and exercise that ObjectStateManager a little by inserting some data (and keeping it all very simple by just playing with the Shippers table). Starting with this; static void Main(string[] args) { using (NorthwindContext ctx = Read More

Filed Under: , ,

Entity Framework - Object Services Level. The ObjectStateManager.

When you look at an ObjectContext (or something derived from it) in the Entity Framework you'll spot that it has a property on it called ObjectStateManager which is of type ObjectStateManager. This type is vital to making object services work beyond just Read More

Entity Framework - Object Services Level. Executing Stored Procedures for Query - Multiple Resultsets

Following up on that previous post where I managed to execute a stored procedure and get an EntitySet of Customers back from Northwind, I figured that the next thing to try would be a stored procedure that returns multiple result-sets. However, I Read More

Entity Framework - Object Services Level. Executing Stored Procedures for Query.

I thought I'd write a simple stored procedure and add it to Northwind;create procedure dbo.GetCustomersByCountry ( @country nvarchar(30) ) as set nocount on select c.* from dbo.Customers as c where c.country = @country   And Read More

Filed Under: , ,

Entity Framework - Object Services Level. Deferred Loading.

The results of this query; using (ObjectContext ctx = new ObjectContext("Name=NorthwindEntities")) { ObjectQuery<Customers> query = ctx.CreateQuery<Customers>( "select value c from NorthwindContext.Customers as c"); Read More

Filed Under: , ,

Entity Framework - Object Services Level. Generated Code in (e.g.) Northwind.ObjectLayer.cs

When you use edmgen.exe with /mode:FullGeneration or /mode:EntityClassGeneration you get a file emitted with a bunch of generated code in it. In particular, that generated code contains a class derived from ObjectContext (such as NorthwindContext) and Read More

Filed Under: , ,

Entity Framework - Object Services Level. Querying with Custom .NET Types

In the previous post I said that when we are using ObjectQuery<T> we are actually querying the "O-Space" or object-space and that ability to query is being driven by metadata that describes how to turn the O-Space into the conceptual or C-Space Read More

Filed Under: , ,

Entity Framework - Object Services Level. Querying with ObjectQuery<T>

We can define a query as in; using (ObjectContext ctx = new ObjectContext("Name=NorthwindEntities")) { ObjectQuery<Customers> query = ctx.CreateQuery<Customers>( "select c from NorthwindContext.Customers as Read More

Filed Under: , ,

Entity Framework - Object Services Level. Querying with ObjectContext and ObjectQuery<T>

I've written a few bits and pieces about EntitySQL and how you can use that from the perspective of just crufting up an EntityCommand, setting the command text and then going ahead and executing it to get a IDataReader and then enumerating that. However, Read More

Filed Under: , ,

Entity Framework - Entity Provider Level. Entity SQL - Finishing Up for Now

Returning back to that list that I talked about in a previous post, we had ANYELEMENT,CREATEREF, DEREF, IS OF, KEY, MULTISET, NAVIGATE, OFTYPE, OVERLAPS, Projection (including here as I've not yet figured out what it is :-)), REF, ROW , SELECT (including Read More

Filed Under: , ,

Entity Framework - Entity Provider Level. Entity SQL - OVERLAPS and SET.

Returning back to that list that I talked about in a previous post, we had ANYELEMENT,CREATEREF, DEREF, IS OF, KEY, MULTISET, NAVIGATE, OFTYPE, OVERLAPS, Projection (including here as I've not yet figured out what it is :-)), REF, ROW , SELECT (including Read More

Filed Under: , ,

Entity Framework - Entity Provider Level. Entity SQL - IS OF, TREAT, OFTYPE

Returning back to that list that I talked about in a previous post, we had; ANYELEMENT,CREATEREF, DEREF, IS OF, KEY, MULTISET, NAVIGATE, OFTYPE, OVERLAPS, Projection (including here as I've not yet figured out what it is :-)), REF, ROW , SELECT (including Read More

Filed Under: , ,

Entity Framework - Tooling. Simple Inheritance in the Designer

Going back to that previous post about playing with the Shippers table, I thought I'd see how much easier it was to produce a little inheritance hierarchy in the designer. I started off by altering my Shippers table as before; alter table shippers Read More

Filed Under: , ,

Entity Framework - Entity Provider Level. First Experiment with Inheritance

In order to look at the next keywords that I wanted to look at (IS OF, OFTYPE, TREAT) I need to introduce some kind of inheritance. I modified my Shippers table in Northwind to try and model inheritance using the table-per-hierarchy model (it's not the Read More

Entity Framework - Entity Provider Level. Entity SQL - USING.

Returning back to that list that I talked about in a previous post, we had ANYELEMENT,CREATEREF, DEREF, IS OF, KEY, MULTISET, NAVIGATE, OFTYPE, OVERLAPS, Projection (including here as I've not yet figured out what it is :-)), REF, ROW , SELECT (including Read More

Filed Under: , ,

Entity Framework - Entity Provider Level. Entity SQL - NAVIGATE

Returning back to that list that I talked about in a previous post, we had ANYELEMENT,CREATEREF, DEREF, IS OF, KEY, MULTISET, NAVIGATE, OFTYPE, OVERLAPS, Projection (including here as I've not yet figured out what it is :-)), REF, ROW , SELECT (including Read More

Filed Under: , ,

Entity Framework - Entity Provider Level. Entity SQL - KEY.

Returning back to that list that I talked about in a previous post we had ANYELEMENT,CREATEREF, DEREF, IS OF, KEY, MULTISET, NAVIGATE, OFTYPE, OVERLAPS, Projection (including here as I've not yet figured out what it is :-)), REF, ROW , SELECT (including Read More

Entity Framework - Entity Provider Level. Entity SQL - ROW, MULTISET.

Returning back to that list that I talked about in a previous post, we had ANYELEMENT,CREATEREF, DEREF, IS OF, KEY, MULTISET, NAVIGATE, OFTYPE, OVERLAPS, Projection (including here as I've not yet figured out what it is :-)), REF, ROW , SELECT (including Read More

Filed Under: , ,

Entity Framework - Entity Provider Level. Entity SQL - REF, CREATEREF and DEREF.

Returning back to that list that I talked about in a previous post we had ANYELEMENT,CREATEREF, DEREF, IS OF, KEY, MULTISET, NAVIGATE, OFTYPE, OVERLAPS, Projection (including here as I've not yet figured out what it is :-)), REF, ROW , SELECT (including Read More

Filed Under: , ,

Entity Framework - Entity Provider Level. Entity SQL - ANYELEMENT

Returning back to that list that I talked about in a previous post, we had; ANYELEMENT,CREATEREF, DEREF, IS OF, KEY, MULTISET, NAVIGATE, OFTYPE, OVERLAPS, Projection (including here as I've not yet figured out what it is :-)), REF, ROW , SELECT (including Read More

Filed Under: , ,

Entity Framework - EntityProvider Level. Entity SQL Keywords, Operators and So On.

Following on from a previous post and looking at the reference for Entity SQL, there's a lot that's familiar. Quickly copying the keywords out of the help file there are unary and binary operators such as; - (Negative) - (Subtract) != (Not Read More

Filed Under: , ,

Entity Framework - Entity Provider Level. Simple Querying Application (eSQL PlayPen)

Wanting to play with eSQL a little made me want to find a generic way of executing a query and viewing the results so I knocked together a Windows Forms application that would do that. Note, this was only really the results of a few minutes of playing Read More

Filed Under: , ,

EntityFramework - EntityProvider Level. Where is EntityAdapter?

If you're poking through the Entity Framework at the level below objects where you just want to execute queries and get a resultset back then you might spot that, whilst you can find EntityConnection, EntityCommand, EntityDataReader I don't think you'll Read More

Entity Framework - Entity Provider Level. First Querying of Northwind Model.

Having managed to get to SSDL, CSDL and MSDL files for my Northwind database it's perhaps time to do something with them. Note that this is still just using the default 1:1 mapping that the toolset has given me. I took the three files that the edmgen.exe Read More

Filed Under: , ,

Entity Framework - Tooling. EDM Designer & SQL 2008.

A small word of warning - if you're playing with the Entity Framework and the designer support inside of Visual Studio 2008 Beta 2 then I think it's probably easier to install SQL 2005 rather than SQL 2008 because, from experience, you Read More

Entity Framework - Designer. Generating an EDMX file from Northwind in Visual Studio.

Similar to the previous post, there's a mechanism inside of Visual Studio for generating a model without having to drop out to the command line and use edmgen.exe to do it. Inside, of my VS project I can do "Add New Item" and select "ADO.NET Entity Model"; Read More

Entity Framework - Tooling. EdmGen.exe - Generating SSDL, CSDL, MSL from Northwind.

As a "Hello World" thing to do, I went ahead and built a new console application in Visual Studio 2008 and then added references to the Entity Framework (System.Data.Entity.dll from the GAC). I then went off to build myself a model, I didn't want to type Read More

Entity Framework - Metadata Files. MSL Schema

If you're keen to get a firm grasp on what the three "files" that drive the Entity Framework look like then you'll perhaps find no more definitive place than in the resources of the assembly; System.Data.Entity.dll if you open it up with Reflector then Read More

Entity Framework - Metadata Files. CSDL Schema

If you're keen to get a firm grasp on what the three "files" that drive the Entity Framework look like then you'll perhaps find no more definitive place than in the resources of the assembly; System.Data.Entity.dll if you open it up with Reflector then Read More

Entity Framework - Metadata Files. SSDL Schema.

If you're keen to get a firm grasp on what the three "files" that drive the Entity Framework look like then you'll perhaps find no more definitive place than in the resources of the assembly; System.Data.Entity.dll if you open it up with Reflector then Read More

Entity Framework - Installation. System.Data.Entity.dll

I installed the new version of the Entity Framework. The Framework looks to install a couple of assemblies - System.Data.Entity.dll and System.Data.Entity.Design.dll. System.Data.Entity.dll is the more interesting bit (to me :-)) as it looks to contain Read More

Entity Framework - Overview Video

With the release of new bits for the Entity Framework I thought I'd have a try at making a relatively short video providing an overview. The video is linked from the picture below; For those of you brave enough to give it a viewing I'd strongly Read More

Filed Under: , ,

ADO.NET Entity Framework Beta 2 &amp; August Tools CTP

I happened to be browsing the MSDN download centre and noticed that new bits have been added to the MSDN download centre for the ADO.NET Entity Framework. It looks like the runtime download is here; http://www.microsoft.com/downloads/details.aspx?FamilyID=F1ADC5D1-A42E-40A6-A68C-A42EE11186F7&displaylang=en Read More