A little while back I saw an email asking for someone familiar with Entity Framework to review a piece of Entity Framework tooling. I figured why not, since I had met some guys from ComponentOne at Dallas TechFest last year when they sponsored. It turned out to be ComponentOne Studio for Entity Framework.
Out of the Box – First Impressions
The tooling is fairly nice, but the real piece that hit me out of the box was the examples. It was like walking into to the kitchen and having dinner half way there for you. The samples turned out to be a great way to get started with the tools.
The samples give some detailed descriptions of what is contained and then pop you right into a Visual Studio solution to start hacking. As a code junky this was a big plus for me.
In the Solution – References… oh my
I am kind of picky on things, and a bunch of references is normally one of those things, so I have to ding the ComponentOne guys on this. I had to bring in 4 references to my WPF project to get things up and running . I know that for most this won’t matter at all, but is one base reference to much to ask for? (Ok, off my soap box now.) More realistically (and less soap box) the need for several references makes sense. Different platforms/technologies need different reference chains. If you just want the LiveLinq awesomeness you don’t need the whole framework which is nice. I guess I will have to accept that the world doesn’t fit into my nice soap box.
In the Code – Simple and powerful
Once I was in the code there were a couple of additions to my normal LINQ usage that piqued my interest: AsDynamic and AsLive. These two pieces seem to solve an issue that I have struggled with finding a good clean way of doing with little code.
I normally bind my grids and such to a ViewModel that holds observable collections under the hood and then take that and manually write the modifications to a queryable. This seemed to be redundant a lot of the time. That is where this came in for me. AsLive gives me an IObservableCollection directly from my lambda statement. I thought this was pretty sexy, but AsDynamic took it one step further by doing this on an anonymous projection. The only limiting factor here is it had to be used on the EntityCollection, or ICollection, which means we have to make sure to return ICollections. If we return EntityCollection it costs too much architecturally. There is one more, "HEY, that is cool feature hidden below."
Did you notice the ADO and XML extensions? IObservable from a DataTable or XDoc/XElement!? Nice.
Transactions, UI, and rollback – NO WAY, Seriously?!
This one blew my socks off! Check this out.
public OrderWindow(Order order, ClientTransaction transaction)
_transaction = transaction;
DataContext = transaction.ScopeDataContext(order);
var orderDetailsView = from od in order.Order_Details.AsLive()
select new OrderDetailsInfo
OrderID = od.OrderID,
ProductID = od.ProductID,
UnitPrice = od.UnitPrice,
Discount = od.Discount,
Quantity = od.Quantity
orderDetailsGrid.ItemsSource = orderDetailsView;
Yeah, that is pure win, with a side of awesome! [LL1] I have been working on a highly transacted application for the past 9 months and this would have saved SOOO much time. The only concern I have is that with this if you are also talking to something like WCF or another database you will need to setup DTC, but you would have had to do that any way for client transactions like this. This piece along with the integrated feel of Undo/Rollback makes the UI programming hurt less.
_transaction = _cache.CreateTransaction();
_transaction.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(transaction_PropertyChanged);
buttonUndo.IsEnabled = false;
switch (MessageBox.Show("Do you want to save changes?", "", MessageBoxButton.YesNoCancel, MessageBoxImage.Question))
Client Side Cache – Not sure yet
A lot of what I saw when using ComponentOne Studio for Entity Framework tools used what they tag as “Smart Client-side Caching”. This piece is great in concept and in practice, but seemed to get a bit hairy when you want to work outside of the normal caching paradigm. This was just a chunk more code to have to manage to get around the cache in a targeted manner (for example a refresh on a cached object without dumping cache).
Virtual Mode – The art of well implemented low hanging fruit
Virtual Mode was a treat. The implementation of low hanging fruit always pleases me, but this was better. I have had to implement paging and async scrolling all over the place in the recent months because our users want massive data and they want responsiveness. ComponentOne nailed this one. The Virtual Mode is a simple Boolean property that turns on an async fetch of data on scroll! No more having to implement async paging myself!
This was just … nice.
General Overview – There is a lot of great here
I may be biased by working in a rather complex WPF UI for the last 9 months, but this thing rocks. I am not a huge fan of control suites, which is why I avoided their controls and just dealt with looking at the code. They offer those, but I think the biggest gains are in the LiveLINQ libraries, and their WPF extensions. This could have saved man weeks for my current client. The UI integration was simple, straight forward, and it handled transactions beautifully. I have to say I went into this rather skeptical, but when I got into the code ComponentOne has taken away a lot of the redundant pain that comes from integrating Entity Framework and a UI.
The only downside that I had was that the Highway.Data Framework that I have been working on didn’t integrate well. I have to go back and look to see if I can make this integration a little easier, because I want both.
Enjoy the coding, and check out ComponentOne Studio for Entity Framework.
Disclosure of Material Connection: I received one or more of the products or services
mentioned above for free in the hope that I would mention it on my blog. Regardless, I
only recommend products or services I use personally and believe my readers will enjoy.
I am disclosing this in accordance with the Federal Trade Commission’s 16 CFR, Part 255:
“Guides Concerning the Use of Endorsements and Testimonials in Advertising”.
Updated – 7/30/2012 – Fixing a couple mistakes, like the product name *oops*