Early thoughts on MEntity

Even though no details on MEntity have been revealed yet, here are my thoughts on MEntity and its place and purpose in the world of “Oslo”. This current thinking has been fed by the discussions Paul Gielens and I had with Don Box. Here goes.

A model and a DSL for the Entity Framework

Don mentioned that CSDL/MSL/SSDL (or the EDMX file format for that matter) is essentially the Entity Framework’s model. The “metadata” in these files can be perceived as the model driving any application using the Entity Framework. The EF runtime consume and directly execute the model data, making the EF Oslo model an executable model.

The Entity Framework team will presumably start working on a model for the conceptual, mapping and storage layers. They will use MSchema to formulate the model and have the schema for storing the model generated using the m.exe and mx.exe compilers. Using MGraph one can define the EF model data for a particular application using the EF. The schema and model data end up in the Oslo repository powered by Microsoft SQL Server.

To make defining the model data easier and more intuitive the EF team will almost certainly define a new Domain Specific Language (DSL) for the Entity Framework: MEntity. They will use MSchema MGrammar (thanks Dennis for spotting this mistake) to specify the MEntity language. The model for EF will be defined in MSchema. I have no clue just yet as to what it will look like. It can be expected though that MEntity will be much easier than the EDMX format if you want to forsake the EF designer in Visual Studio and go for textual modeling. Moreover, you can use Quadrant to inspect and manipulate the model data in the Oslo repository.

EF having a model might not be much on its own, but look at the larger picture. Your application will probably use more models for other technology stacks (WF, WCF, WPF, ASP.NET and so on) and might have an application-model. To me it seems valuable that EF will have the same model engine that the others use as well. You get to leverage your existing (well, by that time at least) Oslo knowledge and modeling techniques, and work with EF in a more declaratively fashion.

Adapting the EF runtime to Oslo

So, using the MEntity DSL any EF developer gets to define your EDM and its mappings using Oslo model data. The Entity Framework runtime will need to be able to read the Oslo model data from the SQL Server repository and use it to build up the Entity Data Model (EDM) and the mappings to the storage layer. When you first think of this it may seem a bit silly to have EF bootstrap of off a database. Give it some more thought and it is not so weird that the runtime should read data from a repository with a well-known schema before it can read other (entity) data from databases.

As an intermediate step to use Oslo without having to go through too much troubles implementing/changing the current runtime, one could use the native support that Oslo will have for a XAML representation of the model data. The WF and WCF runtimes will most likely do the same thing to avoid having to perform big changes in the beginning. Simply “read” the model data in XAML format from the repository and use that just as it is currently done in the runtimes. That would have been a really nice option for EF as well, … if they had used the XAML format for CSDL, MSDL and SSDL. (read my other (forthcoming post on this question to the EF team). I guess these are just implementation details that get worked out.

Oslo, EF and other databases

However, this does beg the question of how you can justify the Microsoft SQL Server repository for Oslo in situations where you would want to use EF to target non-Microsoft entity providers and databases. Is Oslo and consequently MEntity only suited for EF in a homogenous situation of SQL Server only?

Well, I’ll give it some more thought the next couple of weeks. Any comments, ideas or suggestions you might have are more than welcome.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s