CodeGear are letting some people blog about features in the next release of Delphi (Highlander) before it has even been released. How cool is that? A lot less secrecy, what a great move!
Sooooo. How about I spill some beans about ECO IV? Maybe I can find a thing or two to mention 🙂 I’ll just throw together something unplanned, so expect a weird mixture of stuff in no logical order whatsoever!
Well, first of all, you’re going to get a whole load of source code. I mean *lots* of it!
There’s a new service called the ICacheContentService. Let’s say you know for a fact that there is an object in the DB with the ECO_ID 1234 and it is a Customer. Instead of loading that object into the cache with an OclPS evaluation you can simply use this service to register it in the cache. I’ve found this really useful in an app I am writing where I use SQL to find customers matching a certain sales criteria. I then create an IObjectList of these customers by injecting their ID’s into the cache.
There are some generics in there. The generated code is smaller as a result because you don’t need a seconary “List” class for each class in your model. PersonListAdapter, CustomerListAdapeter etc. In addition to this it is easier to move from the Element world to the Business Object world. You can do stuff like this
MyElement.GetAsObject<Customer>.Name := ‘Hello’;
for currentCustomer in SomeElement.GetAsCollection<Customer> do
You can hibernate EcoSpaces. Can you deactivate an EcoSpace to a stream, a kind of snapshot. You can then later activate an EcoSpace from a stream, restoring the original state of the hibernated EcoSpace. This is useful when you want to shut down an application and then restart it where you left off. Maybe you could use it to “keep changes” made on the client without having to save them, and then later update the database. One certain use for this feature I see would be for storing EcoSpaces in a session where ASP.NET is using a DB as the session state so that multiple machines can serve the pages (a farm). I’ve done this using MonoRail rather than ASP.NET.
You can write ECO VCL.NET apps. Okay, it’s not a big secret or anything, but I can tell you how good it is! I haven’t played with TDataSet components in years now, but it all came rushing back to me as I played with components such as TExpressionHandle and TReferenceHandle, both descendants of TDataSet. Hooking up a TDBGrid to an ECO expression handle was so strange at first. It seemed like I was hooking up to a TQuery, that is until I started executing methods on the current row, and invoking state machine transitions. Then I felt at home again 🙂
ASP.NET DataSource. ASP.NET stuff is so much more simple now. You have an EcoSpaceManager component on the web page that provides an instance of an EcoSpace. Then you have an EcoDataSource component which you can bind GUI controls to that are capable not only of showing the data of the selected ECO objects but also update it too without a single line of code. This approach is so much more simple than using all of those ECO handles on the form and having to manually update the form data into the objects.
ASP.NET Providers. You know ’em, the user, roles, settings etc that come with ASP.NET 2. Well, ECO supports a whole load of those too!
More frequent updates. You wont see this one in the box, this is one that ships afterwards. In the past ECO updates could only be shipped as part of a Delphi update. Well, things have changed. The ECO team (www.capableobjects.com) can now determine their own release schedules.
OCL enhancements. The OCL implementation used has now been extended so that it mirrors the .NET framework more. So you can do stuff like this (in OCL action language)
DatePosted := DateTime.Now.Date.AddDays(1)
BlackFish support. What else do I need to say?
Mapping enhancements. This one might not be a big feature that you’d write on a box, but it saves so much time! Remember in ECO III when you had to write a persistence mapper for every ENUM type in your model? No more! The mapper classes are now provided with type information when converting between DB/Model values so it is easy to write a single generic mapper class to work with any type (enums for example). In fact, you can now just set the PMapper of any ENUM to GenericEnumAsInteger and your enum property will be mapped to an INT column in your DB. What a time saver this one has proven to be!
Nullable types. You can now model your class attributes as Nullable<Integer> etc. So the following code…
Self.AsIObject.Properties.GetByLoopbackIndex(Eco_LoopbackIndices.DatePosted).AsObject := nil;
you can now do this
DatePosted := default(Nullable<datetime>);
Well, that’s it for now. If I think of anything else I’ll let you know. It’s hard to remember what’s new when you’ve been playing with it for so long!
Disclaimer: The code in this blog might not compile after shipping. Not because it is subject to change and other such legal stuff, but because I am typing from memory 🙂