To help compliment the release notes for EntitySpaces 2007 v1.1021.0 we decided to create this post. We have now implemented more than half of the functionality planned for this release, which is the last major release for ES2007 (ES2008 is the next major release). We feel this is a very strong beta especially for Windows.Forms developers. Our hierarchical binding and extra column support really compliments the new "join" syntax. Also, the Compact Framework data binding is no longer disabled, it's fully functional again in this beta.
Let's jump right in.
Take a look at this design time snapshot which contains three grids on a Windows.Forms page. The first grid is the "old" DataGrid which supports hierarchical data binding, the second is the DataGridView which does not support hierarchical binding, while the third grid is the DevX grid which of course supports deep frying a whole turkey if that's what you need it to do.
On the above form we dropped an EntitySpaces "EmployeeCollection" along with a binding source. The binding source has its DataSource set to the "employeeCollection1" and all three grids are then bound to the binding source. Take a look at the form as it appears during runtime.
So what's the big deal here? Well, let's take a look the query that retrieves the data.
We're not using a join here to bring back the extra columns, however, the effect is the same. What is cool about this is that you can bring back all kinds of crazy columns and they will be present and available for runtime data binding. Notice that I bring back two extra columns not in my Employees table. The first is the FullName column which is a calculated column created via our expression support (the + operator concatenates strings in this case). The second column is merely the LastName column aliased to "LastNameRenamed".
Now, if you look at the runtime snapshot of the grids above you'll notice that you can see both the FullName and LastNameRenamed columns. Notice that the middle grid (the DataGridView) doesn't show the LastNameRenamed column. That's because it is not setup to perform auto-layout and displays only those columns that were available at design time. Yet, it shows the FullName column? We'll explain all that soon. But before we recount that, our enhanced binding functionality ensures that all columns brought back via a query, a stored procedure, whatever, are available during runtime data binding, and you can still bind directly to your EntitySpaces collections.
Take a look at our class definition.
Notice the FakeColumn and FullName properties. The FakeColumn property is really nothing special, we've just added a custom property in our Custom class and backed it with a local string property. It doesn't come from the underlying DataTable. However, notice in the GetLocalBindingProperties method, which we've overridden, that we add our FakeColumn to the esPropertyDescriptor list. That is what allows the FakeColumn property to appear in our grids, and it is even available during design time (true for all columns returned by GetLocalBindingProperties). Notice that our FullName property is backed by data in the underlying DataTable (indicated by the fact that we use GetColumn to get at the data). It is also added during GetLocalBindingProperties. This is not necessary, we only did this because we wanted FullName to be available during design time. We could have created a view of course that returned FullName and generated an EmployeeView class from that. However, we wanted to fully explain the enhanced functionality. So, we add FullName to our GetLocalBindingProperties only so we can see FullName during design time binding. Remember, all columns in the underlying DataTable are available via runtime binding. Note also that the old CreateExtendedProperties() method is no longer supported.
So that explains why we see both FakeColumn and FullName in our grids, but what about LastNameRenamed?
If you look at the above design time property editor for our DevX grid, you will see the core columns from the Employee table in the red box. You can also see both colFakeColumn and colFullName which were retrieved automatically (thanks to GetLocalBindingProperties ). However, notice the <LastNameRenamed> column mapping. This was manually added by clicking the "Add" button and providing "LastNameRenamed" as the FieldName and Caption. EntitySpaces will serve up all your extra columns to whatever control you're binding to at runtime automatically. All you need to do is add the mapping to the control and it will display. This is why our new join support becomes particularly useful.
That's quite a bit to digest. One thing we have also done is to make our GetColumn and SetColumn methods fault tolerant. GetColumn will never throw an exception. If the column doesn't exist then null/Nothing is returned. SetColumn will have no effect, if the column doesn't exist.
Also, one final tidbit, for those of you waiting for hierarchical XML serialization, you can try this if you want to (however, do not start writing coding assuming this is how it will work). If you want to test hierarchical XML serialization, go into one of your hierarchical properties and remove the XmlIgnore attribute. You should be able to serialize and de-serialize hierarchical XML data. Remember, this is unsupported as of this beta as we haven't thought this through yet. In a few days we will follow up with another blog post and explain what else is in our final ES2007 release. We can say however it is mostly XML serialization, esDataSource improvements including hierarchical support, and killer new dumb proxies that can operate on the client side without the need for EntitySpaces, yet do everything our full proxies do now. Yep, this is going to be a killer release.
From mobile devices to large scale enterprise solutions in need of serious transaction support, EntitySpaces can meet your needs. Whether you’re writing an ASP.NET application with medium trust requirements, or a Windows.Forms application, the EntitySpaces architecture is there for you. EntitySpaces is provider independent, which means that you can run the same binary code against any of the supported databases. EntitySpaces is available in both C# and VB.NET. EntitySpaces uses no reflection, no XML files, and sports a tiny foot print of less than 200k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.
The EntitySpaces Team
--
EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net