Wednesday, September 01, 2010

esvideo

Sometimes you’re so busy designing, coding, testing, and supporting a product that you don’t take the time to stop and appreciate what you have actually accomplished. A customer of ours asked us to create a video overview of our Silverlight functionality and in doing so we had to step back and say “wow”, this is pretty cool. It truly is easy to use EntitySpaces to create a Silverlight application as you will see.

This video shows the various pieces of an EntitySpaces application for Silverlight:

1) The EntitySpaces architecture itself.

2) The WCF Service to retrieve the data.

3) Some kind of row level, column level tracking on the Silverlight side of things (our proxies).

The good news is that EntitySpaces provides all three of these for you and more as you will soon see. The real beauty in this video is how the EntitySpaces server and client proxies are used to serialize data back and forth across the wire all the while tracking row level and column level dirty state. Also, the creation of the WCF service itself which utilizes the EntitySpaces architecture and allows you to take full advantage of the EntitySpaces DynamicQuery API under Silverlight is awesome. In fact, it’s hard to tell that you’re not on the server side because our client proxies look and feel just like the full EntitySpaces architecture.

Well, enough talk. Click on the image above and check out the video, it’s kind of large so give it a minute to download, but it’s worth it. Pay close attention to how few lines of code we actually wrote by hand to create our Silverlight demo, and how simple those lines of code actually are. There’s already a lot to learn when you start working with Silverlight, why not make it easy on yourself and use EntitySpaces? Our Trial version is fully functional and comes with everything you see in this video, including the demo in C# or VB.NET.

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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 300k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Wednesday, September 01, 2010 8:25:41 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Sunday, August 29, 2010

This release of EntitySpaces adds two new databases, adds Silverlight 4 support (we already supported Silverlight 3), provides some excellent proxy improvements, and finally it provides a few well placed customer requested tweaks. EntitySpaces 2010.1.0830.0 is available to customers for download now. Our trial version will be upgraded by Tuesday night, perhaps sooner.

It is recommended that you regenerate your “Generated” classes and any proxies you may be using. Also, we recommend that you re-generate any WCF Services that you may be using that were generated by EntitySpaces in order to realize the improvements mentioned below.

Two New Databases

  • Microsoft SQL Azure is now supported. Just choose “SQL Azure” in the “Driver” dropdown on the settings tab and generate your architecture as you would normally. You still use our normal EntitySpaces.SqlClientProvider.dll provider when running your SQL Azure application.
  • Microsoft SQL Server Compact 4.0 is now supported. We already support 3.x and we now we also support the 4.0 Technology Preview release. The SQL CE 4.0 CTP can be found HERE. This version of the SQL Server Compact Edition passes more of our unit tests than did the 3.x version. For instance, 4.0 supports paging. Also, we have upgraded our SQL CE 3.x driver to 3.5.1.0.

    To connect to the SQL CE 4.x driver use this in your connection string (only needed when generating code):

    Data Source=C:\SomeDatabase.sdf;Version="4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91";

Proxy Improvements

  • We now provide both Silverlight 3.0 and 4.0 Assemblies (please notice the folder structure change in your Runtimes folder for the Silverlight assemblies).
  • Added Collection.LoadAll() methods to the generated WCF Services (See our WCF Template).
  • Added IsDirty() to both the single entity and collection proxy stub classes.
  • Fixed a minor bug in the Collection.Save() method in the Proxy classes. The deleted entities were being brought back in the return collection from Save(), this has been fixed. This was not reported by a user, we found this in our testing.

Other Improvements and Fixes

  • There was an issue with calling Find() on a binding source. This has been fixed.
  • Added HasFilter on the Collection class and added a “get” on the Filter property.
  • Collection.AddNew() was made virtual so that it can be overridden.
  • There was an issue with our collections not working in Windows Forms design mode, this has been fixed.
  • Reworked our C# and VB.NET Windows.Forms samples.
  • Reworked our WCF Demo so that it now uses an ES generated WCF Service.

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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 300k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Sunday, August 29, 2010 10:22:44 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Wednesday, August 25, 2010

Although the ORMBattle.NET charts have not been updated yet we thought we would share the results with you. The stats shown below are the stats that they will use to update the charts on their site (they use the 1000 item tests). We think we did pretty well. The numbers shown below are from the ORMBattle.NET site.

First let’s talk about where EntitySpaces did really well.

BLT = BLToolkit
EF  = Microsoft Entity Framework
ES  = EntitySpaces
DO  = DataObjects.Net
LC  = LinqConnect
LS2 = LINQ to SQL
NH  = NHibernate
OA  = OpenAccess

SS = SubSonic

Our “Single Operation” Tests

Let’s first take a a look at the Single Operation CRUD performance tests. These are single entity updates. So, the first set of numbers highlighted in blue are our numbers and we scored very high. These numbers are very important because they represent 1000 entities being created, building the dynamic SQL to do the update/insert/delete, a wire trip to the database, and returning any modified fields such as identity columns. In other words, the full meal deal.

It is obvious from these numbers EntitySpaces can do this very efficiently. Our “Multiple Operation” tests are discussed below.


ormbattle


Our “Multiple Operation” Tests

We didn’t score as high here as we would have liked. It’s important to note that when saving a collection (a collection merely contains single entities) we use the exact same logic as when we save a single entity. So you must be thinking since we scored so well in the “Single Operation” tests why then aren’t we at the top of the “Multiple Operations” tests? Well, one of the nice things about EntitySpaces is that it truly only updates only those columns which are dirty. This means we created unique SQL for every single row (1000 of them in this case) when in reality we only needed to build the SQL one time since the test uses a for loop and changes the exact same columns for each row. However, even with this extra functionality we handily out performed the Microsoft Entity Framework, LINQ to SQL, and SubSonic. We are not sure if the other architectures updated only the modified columns or all columns, we suspect they update them all, but it really wont matter soon as you will see.

We have long known we could optimize here and that is exactly our plan. All we must to do is examine the ModifiedColumns collection of the previous row to see if we can reuse the same SQL statement. Once we do that our numbers will shoot up dramatically (and you will of course benefit). In fact, we expect to be at or near the top in that category as well on our next run. These changes are simple to make. Once we make these changes we will publish before and after numbers using the exact same code from the ORMBattle.NET site and publish those here so you can see the improvements, and we expect those to be dramatic. Once ORMBattle.NET does another round of testing these new numbers will be published there as well.

Native Query and Native Materialize Tests

We also scored very well in the Native Query test which uses our DynamicQuery API and we scored near the top in the Native Materialize test which does a LoadAll() on a collection and then merely does a foreach loop through each entity (this tests materializing each row). You can see how fast we are in those two tests and loading a large collection is extremely fast in EntitySpaces.

LINQ Tests

Note that there are no “n/a” entries for EntitySpaces. This is kind of interesting since most of our customers use our DynamicQuery API and not LINQ. However, we do support LINQ when the ADO.NET provider we are using supports it. This is true for 4 or 5 of the database systems we support.

Next Steps

Other than the “Multiple Operation” tests we have one other issue to fix, and that is when a massive collection “delete all” operation is performed. Our MarkAllAsDeleted() moves all of the deleted entities into a deleted list one by one. We can do this in one big operation instantly so that we’ll be fixed as well. We know we will drastically increase our collection save logic and we’ll post those numbers (before and after soon). First though, we need to get this weekend’s release out with our SQL Azure support.

After we make our next round of performance changes we expect EntitySpaces to be at or near the top in almost every category, and we’re already well on our way. This performance work will happen immediately after this weekends release, so stay tuned. Our entry into ORMBattle.NET fray is going to benefit you the customer because it’s something that we take very seriously. We are happy with round one, but round two is going to put us in a very good position.

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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 300k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Wednesday, August 25, 2010 10:06:49 PM (Eastern Standard Time, UTC-05:00)  #    Comments [3]
 Saturday, August 21, 2010
SQL-Azure

Our SQL Azure support now successfully passes our NUnit test suite. It is our plan to release our SQL Azure support on Monday, August 30th. There are also other Cloud databases we are looking at.

There is a new choice in the “Settings” tab in the driver combo-box called “SQL Azure”, you just select it, connect, and generate your EntitySpaces architecture as you would normally.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Saturday, August 21, 2010 1:24:14 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Monday, August 16, 2010

This release is recommended if your application is a Windows.Forms application. We fixed a bug that happened when the user pressed the “escape” key while editing in a grid. If you are upgrading from our 2010.1.0802.0 release there is no need to regenerate your classes.

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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 300k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Monday, August 16, 2010 4:58:56 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Friday, August 13, 2010

The Microsoft SQL Server 2008 FILESTREAM type can be a bit tricky to figure out. Hopefully this post will help those interested in using it. The first thing you need to do is enable FILESTREAM in your SQL Server 2008 instance. The instructions can be found HERE.

Our next step was to create our SQL table for testing.

CREATE TABLE [dbo].[FileStreamEmployees]
(
    [EmployeeId] [int] NOT NULL,
    [Photo] [varbinary](max) FILESTREAM  NULL,
    [RowGuid] [uniqueidentifier] ROWGUIDCOL  NOT NULL
)

Notice that we have our Photo column set as our FILESTREAM column (shown above).

Our next step was of course to create our “Gnerated” and “Custom” classes. These classes are generated for you in seconds, see this video if you are new to EntitySpaces.

One of the tricks when working with SqlFileStream (which is located in the System.Data.SqlTypes namespace) is that it requires a transaction. So, what we did was make a tiny little class called esSqlFileStream that would hold onto both the esTransactionScope instance and the SqlFileStream instance. Let’s look at how all this works.

First, we created a sample record to play with.

// Create a sample record just for the demo
FileStreamEmployees emp = new FileStreamEmployees();
emp.EmployeeId = 1;
emp.Photo = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
emp.Save();

Now, let’s execute some code and see if we can read back the Photo column using streaming and not the entity itself.

//---------------------------------
// Let's test reading
//---------------------------------
esSqlFileStream stream = FileStreamEmployees.GetFileStream(1, FileAccess.Read);

int length = (int)stream.Length;
byte[] data = new byte[length + 1];

// Fill our data buffer
stream.Read(data, 0, length);
stream.Dispose();

Notice that we call a static method on our FileStreamEmployees entity named GetFileStream(). We added that to our Custom class. We’ll take a look at that method in just a moment. Also, we could have used the using() syntax on the esSqlFileStream object but we wanted to demonstrate how you could create an esSqlFileStream object and then pass it around to other methods if need be. This is why we needed to manually call Dispose on it in the sample above. 

Now, let’s execute some code and see if we can write to the Photo column using streaming (and without calling Save on the entity).

//---------------------------------
// Let's test writing
//---------------------------------
esSqlFileStream stream = FileStreamEmployees.GetFileStream(1, FileAccess.Write);

data = new byte[] { 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15 };
stream.Write(data, 0, data.Length);
stream.Dispose();

Pretty simple looking really. There is one very important thing to note here. As long as you’re holding onto an esSqlFileStream there is a transaction open. So, you want to get in and out as fast as you can just as you would whenever you are holding a transaction open. Now, let’s take a look at our static GetFileStream() method which is located in our FileStreamEmployees Custom class.

using System;
using System.IO;
using System.Data.SqlTypes;

using EntitySpaces.Core;
using EntitySpaces.Interfaces;
using EntitySpaces.DynamicQuery;

namespace BusinessObjects
{

    // This is in our “Custom Class”
    public partial class FileStreamEmployees : esFileStreamEmployees
    {
        static public esSqlFileStream GetFileStream(int id, FileAccess access)
        {
            esSqlFileStream fileStream = new esSqlFileStream();

            FileStreamEmployeesQuery q = new FileStreamEmployeesQuery();
            q.Select("<Photo.PathName() as [Path]>", "<GET_FILESTREAM_TRANSACTION_CONTEXT() as [Context]>");
            q.Where(q.EmployeeId == id);

            FileStreamEmployees fsEmp = new FileStreamEmployees();
            fsEmp.Load(q);

            fileStream.Create((string)fsEmp.GetColumn("Path"),
                (byte[])fsEmp.GetColumn("Context"), access, FileOptions.SequentialScan, 0);

            return fileStream;
        }
    }
}

Notice that we use the “Raw SQL” feature to inject this very SQL Server specific code into our Select() statement. Remember that EntitySpaces is database independent and we try to avoid polluting the core with DBMS specific functions. Typically, you use very little or no “Raw SQL” in EntitySpaces. However, this mechanism is a really nice escape hatch when needed. Basically, the method above fetches the path to our Photo blob and uses the esTransactionScope transaction which is created in the constructor of the esSqlFileStream class.

Finally, let’s look at the esSqlFileStream class.

using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.IO;
using System.Linq;
using System.Text;

using EntitySpaces.Interfaces;

namespace BusinessObjects
{
    public class esSqlFileStream : IDisposable
    {
        public esSqlFileStream()
        {
            scope = new esTransactionScope();
        }

        public void Create(string path, byte[] transactionContext, FileAccess access, FileOptions options, long allocationSize)
        {
           stream = new SqlFileStream(path, transactionContext, access, options, 0);
        }

        public int Read(byte[] buffer, int offset, int count)
        {
            return stream.Read(buffer, offset, count);
        }

        public void Write(byte[] buffer, int offset, int count)
        {
            stream.Write(buffer, offset, count);
        }

        public long Length
        {
            get
            {
                return stream != null ? stream.Length : 0;
            }
        }

        public void Dispose()
        {
            stream.Close();
            stream.Dispose();
            scope.Complete();
        }

        private esTransactionScope scope;
        private SqlFileStream stream;
    }
}

Notice that there is no error handling in this sample code. We wanted to keep this simple so it could be easily understood. Basically, the esSqlFileStream class wraps the SqlFileStream and holds onto the esTransactionScope during its lifetime. You only need to remember to call Dispose() or use it within a using() statement.

This really isn’t a class that we’ll include in the EntitySpaces architecture. This post is merely to show one way to potentially work with SqlFileStream objects in your application, if you plan to use them. Comments are welcome …

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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 300k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Friday, August 13, 2010 9:25:29 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Sunday, August 08, 2010

We updated our Getting Started Video (which is also on our download page). The video uses EntitySpaces 2010 and Visual Studio 2010 and shows how within seven minutes you’re ready to run your first EntitySpaces application.

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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 300k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Sunday, August 08, 2010 4:40:53 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Sunday, August 01, 2010

This is a minor release, there is no need to upgrade unless you need one of the fixes below. The fixes are as follows:

The Trial version for 2010.1.0802.0 will be posted late Sunday night, you will know it has been posted when the Trial Download page has the proper version on it.

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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 300k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Sunday, August 01, 2010 12:55:23 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Sunday, July 25, 2010

This is a minor release, there is no need to upgrade unless you need one of the fixes below. The fixes are as follows:

  • The WCF Client Side Proxy Patch is included (it was not included with 2010.1.0720.0)
  • The namespace "Proxies" was hard coded in the client proxy template, this was fixed.
  • The “char” modified column count error has been fixed.
  • The case sensitive bug when returning columns with a different case than defined in the actual table error has been fixed.

The Trial version is still 2010.1.0720.0

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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 300k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Sunday, July 25, 2010 10:39:06 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Monday, July 05, 2010

This release does not provide any changes to the EntitySpaces architecture. The architecture is still versioned 2010.1.0628.0. However, we did have some changes to tools and we needed to cut this maintenance release for that reason. It is not necessary to regenerate your code if you are upgrading from 2010.1.0628.0. Finally, unless you need one of the changes listed below there is no need to upgrade.

The changes are as follows:

  • The WCF Templates now handle views properly
  • There was a bug on some machines that would not allow them to run offline, this has been fixed.

Also …

Proxy Server/Firewall Support for Licensing

proxyserver

You can supply your companies proxy information in order to validate you license. The proxy server connection settings are encrypted in the settings file and not laying around in plain text.

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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 300k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Monday, July 05, 2010 8:36:36 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Sunday, June 27, 2010

We are pleased to announce the release of EntitySpaces 2010. EntitySpaces 2009 and 2010 run side by side just fine, so you can have them both installed. The official release is version 2010.1.0628.0 and is available for purchase now (or download by existing customers).

Features and Changes

  • Added support for .NET 4.0 and dropped support for .NET 2.0
  • Visual Studio AddIn runs in VS2005/VS2008/VS2010.
  • Added support for SQLite.
  • Improvements to our proxies (row and column level dirty state tracking) for even better Silverlight and WCF support.
  • Proxies support extended columns (brought back by dynamic queries) and even allow binding under Silverlight and WPF.
  • Ships with a template that can generate your WCF Templates which support EntitySpaces out of the box.
  • Project files are now path relative.
  • Enhanced debugging features.
  • Cross Catalog/Schema DynamicQuery support.
  • Re-architected such that our entities and collections no longer contain DataTable’s and DataRow’s for data storage.
  • Our collections now implement IList<T>
  • You can now filter and sort collections with IQueryable using sophisticated LINQ expressions.
  • Many other changes and fixes.
  • EntitySpaces 2010 now requires a license key, all existing customers should have their key(s) on their “my licenses” page.
    See this post for more details: click here …

The release notes can be found Here …

Sample Applications Provider

  • Windows Forms (C#/VB)
  • Silverlight (C#/VB)
  • esDataSource (C#/VB), this is our custom data source control
  • Compact Framework (C#)
  • WCF Sample (C#)

Preview Videos

During development we published some preview videos that you might want to watch for more details.

EntitySpaces 2010 Sneak Preview (I)
EntitySpaces 2010 Sneak Preview (II)
EntitySpaces 2010 Sneak Preview (III)
EntitySpaces 2010 Sneak Preview (IV)

Databases Supported

  • Microsoft SQL Server / SQL CE
  • Microsoft Access
  • Oracle
  • MySQL
  • VistaDB
  • PostgreSQL
  • Sybase SQL Anywhere
  • SQLite


Please note that the source code is not yet available for download, for those customers with download rights to the source it will be available soon, we just need to update the installer.

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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 300k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Sunday, June 27, 2010 9:55:23 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Friday, June 25, 2010
This is not an EntitySpaces Sponsored Contest.

ms_mysql_2010_mainbanner

Migrate MySQL to SQL Server Contest

$5000 grand prize! $1000 runner-up prizes.

Submit your newly migrated or cross platform application that now supports not only MySQL but also Microsoft SQL Server or SQL Azure and be eligible to win $5000 and take advantage of Microsoft Partner Network benefits.

Being compatible with SQL Server can help:

  • Increase revenue opportunities for your business
  • Provide built in Business Intelligence capabilities at your fingertips
  • Lower development costs
  • Give you a seamless path to the cloud

See http://www.codeproject.com/Competitions/417/Migrate-to-MySQL-to-SQL-Server-Contest.aspx


We received an alert about this contest in our email. Of course, cross database applications are a breeze with EntitySpaces. In fact, our NUnit test suite uses the same physical binary to run again all of our supported Databases. We’d love to see an EntitySpaces application win this contest. The deadline is June 30th, 2010 so act quickly if you’re interested.

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Friday, June 25, 2010 5:38:25 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Thursday, June 10, 2010

We are often asked about enterprise licensing and we are glad to be able to offer two new enterprise licensing options. These options won’t be available until after we ship EntitySpaces 2010 which is tentatively scheduled for June 21st. However, the trial version is available now. The trial is our EntitySpaces 2010 beta and it’s very stable. All customers have access to the EntitySpaces 2010 beta as well via our downloads section. So you can get started now with the trial version. The trial is fully functional and you can purchase an Enterprise License once we ship if you are interested in an enterprise license. Otherwise you can purchase today as usual if you are not interested in an enterprise license. For larger shops, the Enterprise Licensing options are very attractive.

Enterprise Level 1 - $2,999.00

15 licenses + Source to the EntitySpaces Architecture assemblies

Enterprise Level 2 - $4,999.00

50 Licenses + Source to the EntitySpaces Architecture assemblies


Advantages of an Enterprise License

Shown below is our pricing structure with the proper discounts if you were to purchase in bulk without the advantage of one of our new Enterprise licensing options. The individual pricing shown below still exists and is valid. Keep in mind that the source code (currently not available for sale until the new Enterprise licenses go online) was $499.00. So, in the past, if you wanted to purchase the equivalent of our Enterprise Level 1 license you would have had to pay $3,588.00 + 499.00 for the source. However, once we ship EntitySpaces 2010 you can purchase the same value for only $2,999.00.

Price Quantiy Discount Total
299 1 0.00% $299.00
299 2 10.00% $538.20
299 3 10.00% $807.30
299 4 10.00% $1,076.40
299 5 20.00% $1,196.00
299 6 20.00% $1,435.20
299 7 20.00% $1,674.40
299 8 20.00% $1,913.60
299 9 20.00% $2,152.80
299 10 20.00% $2,392.00
299 11 20.00% $2,631.20
299 12 20.00% $2,870.40
299 13 20.00% $3,109.60
299 14 20.00% $3,348.80
299 15 20.00% $3,588.00
299 16 20.00% $3,827.20
299 17 20.00% $4,066.40
299 18 20.00% $4,305.60
299 19 20.00% $4,544.80
299 20 20.00% $4,784.00

The Source code will no longer be for sale as individual purchase, it will only be available to Enterprise License holders. If you currently have a source code license you will still be able to download the source code. However, your renewal will be at the new Enterprise Licensing model price once your current license expires.

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Thursday, June 10, 2010 9:55:20 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Monday, May 31, 2010

The fixes and changes are as follows:

  • The ListChanged event handling was improved.
  • The WebAdmin Grid templates were fixed and the GridLoader projects are now included (they are not on the menu yet and can be found in the samples folder).
  • Getting started document was updated with ES2010 screen shots.
  • Many fixes in the VB.NET templates (fixes in FindByPrimaryKey/LoadByPrimaryKey).

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Monday, May 31, 2010 5:44:52 PM (Eastern Standard Time, UTC-05:00)  #    Comments [1]
 Tuesday, May 25, 2010

No Registration Required … Simply click HERE to download your copy today …

Product Features

Databases Supported

  • Microsoft SQL Server / SQL CE
  • Microsoft Access
  • Oracle
  • MySQL
  • VistaDB
  • PostgreSQL
  • Sybase SQL Anywhere
  • SQLite

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Tuesday, May 25, 2010 9:32:02 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Monday, May 24, 2010

All customers may now download and install the EntitySpaces 2010 beta. If you are currently running an Early Adopter release we recommend that you upgrade to the beta release. You can download it under the "Products" menu under "Downloads". You can run ES2009 and ES2010 side by side, they do not interfere with each other. There are release notes on the "EntitySpaces 2010" menu after installation and there are a few breaking changes if you are moving from ES2009 to ES2010. If no problems are reported we plan to release this as our current Trial version.

The release notes for moving from ES2009 to ES2010 can be found HERE. They can also be found on your “EntitySpaces 2010” Windows menu after installation.

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Sunday, May 23, 2010 11:49:31 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Wednesday, April 14, 2010

ES2010_VS2010

This is a snapshot of EntitySpaces 2010 running inside of Visual Studio 2010, of course it runs inside of VS2008 and VS2005 as well.

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Tuesday, April 13, 2010 11:26:14 PM (Eastern Standard Time, UTC-05:00)  #    Comments [1]
 Thursday, March 11, 2010

The dates are as follows:

March 29th - Early Adopter Program

The early adopter release will be available to a limited set of EntitySpaces customers who have a real need for some of the new or enhanced EntitySpaces 2010 features (such as Silverlight, WCF, Smart Proxies, SQLite, JSON serialization). We are looking for customers who desire to upgrade to ES2010 now and continue developing through to release. Prime candidates are new customers working on projects that haven’t shipped yet who can easily upgrade and begin working with ES2010. If you are interested in participating in our Early Adopter Program please send an email to earlyadopter@entityspaces.net with your EntitySpaces user id and how you plan to use EntitySpaces 2010. Not everyone who sends an email will be chosen to participate. Again, we are looking for users who are really going to use this version for development. We are seeking about 20 users to participate and they will be hand picked based on the email we receive explaining how ES2010 will be used. For example, we are interested in Windows Forms, ASP.NET, Silverlight, and so on, in other words, a good cross section of development. Current forum participation will also help in being chosen (active users).

Keep in mind that EntitySpaces 2010 will not support .NET 2.0, it’s .NET 3.5 and forward. We are unsure at this point if .NET 4.0 assemblies will be included in the Early Adopter Program.

April 19th  – Public Beta (customers only)

We are planning on only one beta. This beta will be available to all customers. We realize that the beta window looks short here but this release will have passed all of our unit tests and will have been pretty heavily used by those participating in the Early Adopter Program.

April 29th – Official Release

This is our official release. The EntitySpaces 2010 Trial version will also be available as well for the general public.

 

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Thursday, March 11, 2010 11:54:38 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Monday, March 08, 2010
screenshot

We hope to announce a release date for EntitySpaces 2010 very soon.

We now handle schemas better and allow you to have the same table or view name in multiple schemas. You can see the Address table selected twice (in different schemas) in the Custom Template to the right. They will both create an Address.cs file so you would need to generate each schema into a different folder, but it’s great that this all works now.

We working our way through the wish list and we have switched to the Tarma Installer which we really like.

 

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Monday, March 08, 2010 8:27:55 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Wednesday, March 03, 2010

We get a lot of questions about JSON serialization so we thought we would do a blog post on it. This code was executed using EntitySpaces 2010 but it should work the same for EntitySpaces 2009. We used the the NET 3.5 JSON serializer "DataContractJsonSerializer" located in the “System.Runtime.Serialization.Json” namespace which is in the “System.ServiceModel.Web” assembly.

Let’s take a look at a easy sample.

Employees emp = new Employees();
emp.Query.es.Top = 1;
emp.Query.Select
(
    emp.Query.EmployeeID, emp.Query.FirstName,  emp.Query.LastName, emp.Query.HireDate,
    (emp.Query.LastName + ", " + emp.Query.FirstName).As("Fullname")
);
emp.Query.Load();

// Modify the first name ...
emp.FirstName = "Freddy";

// Serialize it using our EmployeesProxyStub
DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(EmployeesProxyStub));
MemoryStream ms = new MemoryStream();
ser.WriteObject(ms, (EmployeesProxyStub)emp); // Cast it (we have a built in cast operator)

string json = Encoding.Default.GetString(ms.ToArray());
ms.Close();

// Convert it back into an object
MemoryStream ms = new MemoryStream(Encoding.Unicode.GetBytes(json));

ser = new DataContractJsonSerializer(typeof(EmployeesProxyStub));
EmployeesProxyStub empProxy = ser.ReadObject(ms) as EmployeesProxyStub;
ms.Close();

Employees emp2 = empProxy.Entity;  // Now we have a reconstituted object

This is what the Empoyee object looks like when serialized in JSON …

{"EmployeeID":1,"LastName":"Burns","FirstName":"Freddy","HireDate":"\/Date(704692800000-0400)\/",
"esRowState":"Modified","ModifiedColumns":["FirstName"],"ExtraColumns":[{"Key":"Fullname","Value":"Burns, Fred"}]}

It also deserializes just fine. You can do the same thing with our Collections, you just would just use the EmployeesCollectionProxyStub and the EmployeesCollection classes.

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Wednesday, March 03, 2010 9:29:24 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Tuesday, March 02, 2010

Warning: A feeling of euphoric power coupled with feelings of invincibility have been noted by the EntitySpaces Development Team when using EntitySpaces 2010. This will be especially true for those customers using Silverlight and WCF together. The interaction between these technologies and EntitySpaces 2010 could prove to be more than some customers can handle. Please check with your IT staff to make sure this combination is safe for you.

Also, the performance increase in EntitySpaces 2010 is significant, customers are urged to throttle back and work their dosage up slowly to maximum as to not overwhelm their DBMS systems.

Finally, in more extreme cases developers have been seen ‘strutting’ down hallways trash talking wildly about how their product is going to destroy their competition. Other signs may include finishing tasks way ahead of schedule, begging team leads incessantly for more work to do, and working seven, dare we say, six hour days, and spending more time with their families.

If you recognize any of these symptoms don’t be alarmed, instead be sure to pat the developer on the back and say to them “Job well done”. If your competition is getting ahead and your company is still struggling you might try to find out if there development team is all hopped up on EntitySpaces. If they’re winning bid after bid and you’re losing out to them there is a good chance this is the case. The good news is you too have the same access to EntitySpaces, no prescription required.

Please, use EntitySpaces 2010 responsibly.

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Tuesday, March 02, 2010 11:10:38 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Saturday, February 27, 2010
kick it on DotNetKicks.com     Shout it

We are very pleased to be able to show you some of the awesome power coming in EntitySpaces 2010. We think ES2010 provides unmatched power when it comes to working with Silverlight and WCF services. Not only do our smart proxies track row state but they also track column dirty state. You can now bring back extra columns that are fetched via joins (or derived columns) to the client . Probably one of the most awesome feature is the ability to bind to these extra columns under Silverlight. As far as we know we are the only architecture that allows you to do this. You can actually bind to properties for which you have no property accessors, think of it as ITypedList for Silverlight if you will.

video

PART ONE

This first video is key to understanding our WCF Serialization capabilities. We think you will be impressed. The XML is shown each step along the way from server to client and back again. We use our own wrapper for the DataContract serializer to make things easy to demo. We think once you see this you will begin to understand what we have accomplished. Don’t skip this video, it is key to able to understanding Part Two.

video

PART TWO

This second video shows everything in Part One working in a real WCF / Silverlight application. We even bind to the extra column brought back via our Dynamic Query. And this column is not a property in our strongly typed entity. However, be forewarned, we don’t show the mechanics behind this for competitive reasons, once we ship ES2010 it will be made known.

 EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Saturday, February 27, 2010 3:52:18 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Sunday, February 14, 2010

All of the templates are converted now, including the C#, the VB.NET, and the the templates that generate stored procedures (they are also much easier to read). The following list of EntitySpaces Data Providers have been converted over to the new faster ES2010 approach.

  • EntitySpaces.MSAccessProvider
  • EntitySpaces.MySqlClientProvider
  • EntitySpaces.Npgsql2Provider
  • EntitySpaces.NpgsqlProvider
  • EntitySpaces.OracleClientProvider
  • EntitySpaces.SqlClientProvider
  • EntitySpaces.SqlServerCeProvider
  • EntitySpaces.SybaseSqlAnywhereProvider
  • EntitySpaces.VistaDB4Provider
  • EntitySpaces.VistaDBProvider

The EntitySpaces core libraries running with the SqlClientProvider provider are passing almost all unit tests (the ones failing we expect to fail). All providers of course will be run through the entire suite of unit tests. The EntitySpaces code generation project files are now “path relative”. We need to convert the Compact Framework providers over and create the new SQLite provider as well (We already have the metadata for SQLite and can generate fine against SQLite). We also need to make sure ES2009 and ES2010 can run side by side.

Finally, we are switching installers, most likely we will be using the Tarma installer.

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Sunday, February 14, 2010 10:18:17 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Saturday, January 23, 2010

First, before we begin this blog post we wanted to let you know that we have re-enabled the commenting feature on our blog. Secondly, EntitySpaces 2009 already supports these SQL Server2008 data types but it returns them as type “string”. EntitySpaces 2010 allows you to handle them natively.

EntitySpaces has very powerful provider independence support so we have to be careful when implementing “extended” types for a given database engine. For instance, our NUnit test suite is a single binary that runs against all of our supported databases. The only thing we change when targeting a different database engine is the connection string, we don’t have to recompile or regenerate the code for each database because the databases all have essentially the same schema. So the question is, how do we handle non standard types offered by various database vendors? By non standard types we mean types that do not map to a .NET System Type such as System.Int32. We have the solution all worked out and EntitySpaces 2010 will allow us to support non-standard types offered by various database vendors. For instance, Microsoft SQL Server 2008 supports these types which require a separate assembly to work with.

Native SQL Type

.NET Type

geography SqlGeography
geometry SqlGeometry
hierarchyid SqlHierarchyId


The .NET types such as SqlGeography are contained in the Microsoft.SqlServer.Type assembly. Obviously we cannot link this library into or core EntitySpaces assemblies as this would require all EntitySpaces customers to have this assembly present even if they were only using Oracle. The good news is we have a solution for this. Here are the language mappings from the ES2010 esLanguages.xml file for the new SQL Server 2008 data types (currently, in ES2009 these map to type “string”, but now we map them to the real extended type).

<Type From="geography" To="SqlGeography" NonSystemType="true"/>
<Type From="geometry" To="SqlGeometry" NonSystemType="true"/>
<Type From="hierarchyid" To="SqlHierarchyId" NonSystemType="true"/>       

Notice that these are marked as NonSystemTypes = “true”, that is to say they cannot be mapped to a standard .NET type such as a “System.Int32” and so on …

During the code generation process we use this flag to generate the properties using the GetSystemObject/SetSystemObject methods as shown below.

virtual public SqlGeography TheGeography
{
    get
    {
        return (SqlGeography)base.GetSystemObject(MasterTypesMetadata.ColumnNames.TheGeography);
    }
    set
    {
        if(base.SetSystemObject(MasterTypesMetadata.ColumnNames.TheGeography, value));
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(MasterTypesMetadata.PropertyNames.TheGeography));
            }
        }
    }
}   

Notice how we simply use GetSystemObject/SetSystemObject and then cast to the specific type. This is done in your generated classes and not in our core assemblies. The property shown below is a standard column that maps to a system type (an integer column) and thus uses GetSystemInt32/SetSystemInt32 and requires no cast.

virtual public System.Int32? TheInt
{
    get
    {
        return base.GetSystemInt32(MasterTypesMetadata.ColumnNames.TheInt);
    }
    set
    {
        if(base.SetSystemInt32(MasterTypesMetadata.ColumnNames.TheInt, value))
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(MasterTypesMetadata.PropertyNames.TheInt));
            }
        }
    }
}   

Since we cannot have a GetSystemSqlGeometry() in our core assemblies without linking to special database provider assembly this works out nicely. It doesn’t effect non Microsoft folks at all.

An Example

Take a look at this rather sophisticated example. Here we create a complex shape and store it to the database. We have created a table in SQL Server 2008 called “MasterTypes” that we are using for testing all possible types.

SqlGeometryBuilder gb = new SqlGeometryBuilder();

// Set the Spatial Reference ID to 1
gb.SetSrid(1);
// Start the collection
gb.BeginGeometry(OpenGisGeometryType.MultiPolygon);
// Start the first element in this collection
gb.BeginGeometry(OpenGisGeometryType.Polygon);
// Define the first element (figure)
gb.BeginFigure(-77.054700,38.872957);
gb.AddLine(-77.057962, 38.872620);
gb.AddLine(-77.058547, 38.870079);
gb.AddLine(-77.055592, 38.868840);
gb.AddLine(-77.053217, 38.870656);
gb.AddLine(-77.054700, 38.872957);
// End the first element (figure)
gb.EndFigure();
// Define the second figure
gb.BeginFigure(-77.056972, 38.870639);
gb.AddLine(-77.055851, 38.870219);
gb.AddLine(-77.054875, 38.870864);
gb.AddLine(-77.055452, 38.871804);
gb.AddLine(-77.056784, 38.871655);
gb.AddLine(-77.056972, 38.870639);
gb.EndFigure();
// End the first polygon
gb.EndGeometry();

// Define the second polygon
gb.BeginGeometry(OpenGisGeometryType.Polygon);
gb.BeginFigure(-77.056408, 38.875290);
gb.AddLine(-77.056947, 38.875224);
gb.AddLine(-77.057466, 38.873598);
gb.AddLine(-77.057273, 38.872737);
gb.AddLine(-77.055335, 38.873020);
gb.AddLine(-77.055499, 38.874058);
gb.AddLine(-77.056408, 38.875290);
gb.EndFigure();
gb.EndGeometry();
// End (close) the collection

gb.EndGeometry();

MasterTypes m = new MasterTypes();
m.TheGeometry = gb.ConstructedGeometry;
m.Save();

This code works prefectly and saves complex shape to the database. Of course, you can read it back and access the "TheGeometry” property (we named the database column ‘TheGeometry’).

The screen shot below is what it looks like in the debugger when we inspect our “TheGeometry” property after reading it back from the database.

TheGeometry

One thing we have decided on is whether we should always make these extended types as nullable types, the answer will probably be yes.

We are also looking at supporting the SqlFileStream functionality but that is a little more complex. This approach should allow us to support non-standard data types for other database systems as well.

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Saturday, January 23, 2010 11:21:00 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Monday, January 11, 2010
video

In this video we take a quick look at enhancements to Extended Properties (custom properties you add manually to your entities) and the ability to Clone both collections and single entities. The clones are shallow clones, that is to say, they do not clone the entire hierarchical model.

To watch the video click HERE or on the image on the left …

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Monday, January 11, 2010 7:45:46 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Sunday, January 03, 2010
video

Click the link above to watch the video …

This is another quick progress video on EntitySpaces 2010. In this video we show off our esEntityCollectionView<> class which in ES2009 relied on ADO.NET DataViews. However, these are now entirely our own creation and far superior. Remember, we do not use ADO.NET under the hood anymore (see Part I here if you missed it). However, our data providers which read and write to the database of course.

Also, we show off some very cool new debugging features that will really help you when debugging your EntitySpaces applications. And finally, with the use of implicit type casting operators, working with the proxy stub classes has become basically, well, transparent.

For instance, this is now possible … (and more)

public EmployeesCollectionProxyStub GetEmployees(string serializedQuery)
{
    EmployeesCollection coll = new EmployeesCollection ();
    coll.LoadAll();

    return coll;  // But where's the creation of the proxy stub collection?
}

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Sunday, January 03, 2010 8:16:37 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Saturday, December 26, 2009

videoWe are furiously working on our ES2010 Prototype which is quickly turning into the “real deal”. The first thing we wanted to address was performance and have squeezed out a ton more horsepower, the performance is excellent. Secondly, we wanted to enhance our collections by implementing IList<T> which we have done. There is no longer a need to convert our collection classes to List<T> collections to gain access to it’s powerful API. Our collections and List<T> are essentially one and the same.

This means you have a whole new set of functionality at your disposal (using the newer .NET syntax) on our collections, including filtering, which is shown in the (hastily put together) video, you can view the video by clicking on the image on the left.

Here’s the way you can filter a collection in ES2010. The “coll” variable is an EntitySpaces collection object.

coll.Filter = coll.AsQueryable().Where(d => d.FirstName.EndsWith("2")).OrderByDescending(d => d.FirstName); 

In this case we are filtering an EntitiySpaces collection so that it only shows only FirstName’s that end with the number “2” and we also sort them in descending order by FirstName as well.

You can also now perform operations like this (shown below) on your collections, granted this example doesn’t make much sense but it does show the functionality.

int? max = coll.Max(ent => ent.EmployeeID); // Find the highest EmployeeID

We are working very hard and preserving the API too. One of the main changes is that we now no longer use DataTables/DataRows under the hood as a storage mechanism, however you really shouldn’t notice that. Our Custom Property support will now be attribute based and extremely simple to use. Serialization is going to even better (and it’s already fantastic in ES2009). Binary serialization will now be tiny now that we no longer use DataTable’s and we will be adding full JSON serialization support as well. There is just so much more to come and we can’t wait to show you more.

Forgive this hastily put together video, we will be doing a series of these video’s so keep your eyes on the blog.

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Saturday, December 26, 2009 8:15:59 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Saturday, December 12, 2009

This is our final release for ES2009, the version number is 2009.2.1214.0. The Developer version and Source Version are available now. The trial version is now available as well. Watch for an announcement on our twitter account if you are waiting on the new Trial version.

Release Notes:

  • The DynamicQuery API “Between” bug has been fixed.
  • The VB.NET Hierarchical Model Equals vs IsNot bug has been fixed.
  • All SQL CE providers now correctly support the SQL TOP syntax.
  • There was a bug that would sometimes occur in the Microsoft SQL Contains clause. This has been fixed.
  • We tweaked the IDataErorrInfo so that it shouldn’t matter if column names or property names are passed in.
  • Modified SqlClientProvider.Shared.BuildDynamicInsertCommand to ignore modifications to dis-allowed columns, such as Computed, Concurrency, and AutoIncrement.
  • Added a mapping entry for the Microsoft SQL HierarchyId data type.
  • Added an overload for SetColumn() which should be used when setting the values of virtual properties that exist in the underlying DataTable. The usage is covered in this blog post. We plan to make big improvements our virtual column handling in ES2010. The signature is as follows, you pass in true as the last parameter for virtual properties.

          public void SetColumn(string columnName, object Value, bool isVirtualColumn)
  • Greatly improved our Schema/Catalog handling in the DynamicQuery API making cross schema/catalog joins much better now.
  • During an insert all columns that are either computed or that have defaults are now returned (currently only implemented for Microsoft SQL Server). We will revisit this for all providers in ES2010.
  • Greatly improved the power of the ON clause of a JOIN statement. The ON clause can now fully parse anything that can be used in a Where clause. This means the full Where syntax can now be used in the ON clause of a JOIN statement. This is true for all providers accept for Microsoft Access which requires extra parenthesis be paced around each join condition. We will revisit this functionality for MS Access in ES2010.
  • Due to our relocation to a new dedicated hosting server some of our links on the Windows “EntitySpaces 2009” menu were no longer valid. This was also true for “Forums” link on the “Whats New” tab, these have been fixed.
  • Added WithNoLock support. This is currently support for Microsoft SQL Server only (Locking hints are vastly different on all database systems).

    OrderQuery oq = new OrderQuery("o");
    OrderItemQuery oiq = new OrderItemQuery("oi");

    oq.Select(oq.CustID, oq.OrderDate, "<sub.OrderTotal>");
    oq.From
        (
            oiq.Select(oiq.OrderID,
                (oiq.UnitPrice * oiq.Quantity).Sum().As("OrderTotal"))
                .GroupBy(oiq.OrderID)
        ).As("sub");
    oq.InnerJoin(oq).On(oq.OrderID == oiq.OrderID);

    OrderCollection collection = new OrderCollection();
    oq.es.WithNoLock = true; // <== NEW
    collection.Load(oq);

    Notice that even though many query objects are being used you only need to set WithNoLock to true for the parent or main query object. The SQL generated is as follows:

    SELECT o.[CustID],o.[OrderDate],sub.OrderTotal 
    FROM
    (
       SELECT oi.[OrderID],SUM((oi.[UnitPrice]*oi.[Quantity])) AS 'OrderTotal' 
       FROM [OrderItem] oi WITH (NOLOCK)
       GROUP BY oi.[OrderID]
    ) AS sub
    INNER JOIN [Order] o WITH (NOLOCK)
    ON o.[OrderID] = sub.[OrderID]
     

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Saturday, December 12, 2009 2:47:24 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Sunday, December 06, 2009

This question has been brought up recently so we created a sample to demonstrate how this can be accomplished. When we refer to Virtual Properties we mean properties that you manually add to your Custom classes (as opposed those that are created from your database schema during code generation and wind up in your generated classes). In this example we are going to create two Virtual Properties, one that is backed by a private string variable and the other backed by a column in the underlying DataTable.

Adding the Virtual Properties to the Custom Class (Your Main Entity)

Notice the two properties MyCustomProperty and MyCustomPropertyFullName

namespace BusinessObjects
{
    public partial class Employees : esEmployees
    {
        // Virtual Property backed by a private string
        public string MyCustomProperty
        {
            get { return myCustomProperty; }
            set { myCustomProperty = value; }
        }
        private string myCustomProperty;

        // Virtual Property backed by a Column in the underlying DataTable
        public string MyCustomPropertyFullName
        {
            get { return this.GetSystemString("FullName"); }
            set { this.SetColumn("FullName", value, true); } // New Method
        }

        // Makes sure these properties show up when binding ...
        protected override List<esPropertyDescriptor> GetLocalBindingProperties()
        {
            List<esPropertyDescriptor> props = new List<esPropertyDescriptor>();

            props.Add(new esPropertyDescriptor(this, "MyCustomProperty", typeof(string)));
            props.Add(new esPropertyDescriptor(this, "MyCustomPropertyFullName", typeof(string)));

            return props;
        }

        // We need to do this for the deserialization process (more on this later)
        public override void AddNew()
        {

            // only needed if for the DataTable backed column
            base.AddNew();

            if (!this.Table.Columns.Contains("FullName"))
            {
                this.Table.Columns.Add("FullName", typeof(System.String));
            }
        }

    }
}

Typically, you don’t allow users edit virtual properties. In this example we are allowing it and this is the reason we needed to override AddNew. The reason we need to do this is that when we deserialize from the client back to the server you do not get to create the EmployeesCollection, instead the deserialization process does this. So, we overload AddNew() to make sure our underlying DataTable contains the DataColumn to hold our “FullName” value coming back from the client side. In ES2010 we are going to take a hard look at this and make this area easier. With all of the new emphasis on Silverlight 4.0 we want to make sure our proxies and serialization logic are the best and easiest they can be. However, if you are not going to allow users to edit “Virtual Properties” on the client there is no need to override AddNew.

The above code in “red” is new and will be the next maintenance release. The allows you to set virtual columns in the DataTable and not have them marked as dirty which causes the provider to try to save it. However, you can do this now without the new method though the code for that is not shown here.

Adding the Virtual Properties to the Proxies

The Server Side Proxy Class

When we generated the server and client proxies we made sure to check the “CompactXml” checkbox. This makes the XML sent over the wire much more compact. Our “Compact Xml” names each field a0, a1, a2 and so on (in the XML only). This makes the XML so much smaller than using the actual property names. However, it doesn’t effect your property names whatsoever, you still always work with your nice names in code. We recommend that you start your Virtual Properties at “a1000” and then you will never get into to trouble, that is, unless you have 1000 columns in your table in which case you probably have bigger problems.

Our server side and client side proxies are partial classes, so you can easily add more properties to them. Below is the server proxy partial class that we created to house our two addition properties. This ensures that you never hand edit the generated proxies.

namespace BusinessObjects
{
    public partial class EmployeesProxyStub
    {
        [DataMember(Name = "a1000", Order = 1000, EmitDefaultValue = false)]
        public System.String MyCustomProperty
        {
            get
            {
                return this.Entity.MyCustomProperty;
            }
            set { this.Entity.MyCustomProperty = value; }
        }

        [DataMember(Name = "a1001", Order = 1001, EmitDefaultValue = false)]
        public System.String MyCustomPropertyFullName
        {
            get
            {
                return this.Entity.MyCustomPropertyFullName;
            }
            set { this.Entity.MyCustomPropertyFullName = value; }
        }
    }
}

The Client Side Proxy Class

If you are deserializing from the server side proxies into the client side proxies you want to use the same signature for the the properties in the client side proxy.

namespace Proxies
{
    public partial class EmployeesProxyStub
    {
        [DataMember(Name = "a1000", Order = 1000, EmitDefaultValue = false)]
        public System.String MyCustomProperty
        {
            get
            {
                return _myCustomProperty;
            }
            set
            {
                this.SetDirty();
                this._myCustomProperty = value;
                this.RaisePropertyChanged("MyCustomProperty");
            }
        }
        private System.String _myCustomProperty;

        [DataMember(Name = "a1001", Order = 1001, EmitDefaultValue = false)]
        public System.String MyCustomPropertyFullName
        {
            get
            {
                return _myCustomPropertyFullName;
            }
            set
            {
                this.SetDirty();
                this._myCustomPropertyFullName = value;
                this.RaisePropertyChanged("MyCustomPropertyFullName");
            }
        }
        private System.String _myCustomPropertyFullName;
    }
}

One Minor Gotcha

The way our logic is setup the esRowState property of the proxies must be the last property serialized because it determines the row state. Therefore, what we did for this example was to hand edit both the generated proxies (server and client) and change the esRowState to the name and order of 10,000 to make sure it’s last. Here are the hand edits …

[DataMember(Name = "a10000", Order = 10000)]
public string esRowState
{
    get { return this._esRowState; }
    set { this._esRowState = value; }
}

However, we have already made changes in our template(s) so that our next maintenance release (due out very soon) will always set the esRowState to the name and order of 10,000. If you want to make these hand edits to your templates you can do so very easily and simply regenerate. You would need to do this in both proxy templates if you are using both the server and client proxies.

BEFORE

<%if(WcfSupport){%>[DataMember(Name="<%=CompactXML ? "a" + compactXmlIndex++.ToString() : "esRowState"%>"<%if(WcfOrder){%>, Order=<%=(++lastOrdinal).ToString()%><%}%>)]<%}%>
public string esRowState
{
    get { return TheRowState;  }
    set { TheRowState = value; }
}<%}%>

 

AFTER

<%if(WcfSupport){%>[DataMember(Name="<%=CompactXML ? "a10000" : "esRowState"%>"<%if(WcfOrder){%>, Order=10000<%}%>)]<%}%>
public string esRowState
{
    get { return TheRowState;  }
    set { TheRowState = value; }
}<%}%>

 

Finally, the test, does it work?

First, this code is for demonstration purposes only. You never have to use our esDataContractSerializer manually, in fact, you should not be using it unless you absolutely have to. Instead, just pass our proxies to and from your WCF methods as normal parameters and the serialization will happen normally. However, the code below uses our esDataContractSerializer so you can try this in your own code quickly without having to build the services and test it all. In this example we serialize from the server proxies (found in your generated classes) to the client side proxies and back again. If you were using the server proxies on both sides of the conversation you wouldn’t need to generate or mess with the client side proxies of course.

It’s fun to run the code below and look at the XML that is sent back and forth.

private void button1_Click(object sender, EventArgs e)
{
    try
    {
        EmployeesCollection coll = new EmployeesCollection();
        EmployeesQuery q = new EmployeesQuery("e");

        q.SelectAllExcept(q.Notes, q.Photo); // We want all columns but the Notes and Photo
        q.Select((q.LastName + ", " + q.FirstName).As("FullName"));  // Fills our DataTable backed property
        q.es.Top = 3;

        if (coll.Load(q))
        {

            // Change our string back properties
            foreach (Employees emp in coll)
            {
                emp.MyCustomProperty = "Test";
            }

            // Create Our Proxy Stubb
            BusinessObjects.EmployeesCollectionProxyStub server = new BusinessObjects.EmployeesCollectionProxyStub(coll, false);

            // Serialize it into a string and return this string to Silverlight
            string xml = esDataContractSerializer.ToXml(server);

            using (StreamWriter sw = File.CreateText("C:\\query.xml"))
            {
                sw.Write(xml);
                sw.Flush();
                sw.Close();
            }

            // Deserialize the string above into our Client side proxy
            Proxies.EmployeesCollectionProxyStub client = esDataContractSerializer.FromXml(xml, typeof(Proxies.EmployeesCollectionProxyStub))
                as Proxies.EmployeesCollectionProxyStub;

            // Set a property and notice that esRowState goes to Modified
            client.Collection[0].LastName = "CrazyDude";
            client.Collection[0].MyCustomProperty = "MyCustomProperty";
            client.Collection[0].MyCustomPropertyFullName = "Griffin, Mike";

            // Serialize our client side proxy into xml and send it to the server
            xml = esDataContractSerializer.ToXml(client);

            // Deserialize it on the server, the esRowState is modifed as we would expect
            BusinessObjects.EmployeesCollectionProxyStub server1 =
                esDataContractSerializer.FromXml(xml, typeof(BusinessObjects.EmployeesCollectionProxyStub))
                as BusinessObjects.EmployeesCollectionProxyStub;

            // Now save the Entity
            server1.GetCollection().Save();
        }
    }
    catch (Exception ex)
    {

    }
}

The XML

Notice that our two custom properties are at a1000, and a1001 and we have changed esRowState to be a10000.

<EmployeesCollection xmlns="http://tempuri.org/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <Collection>
        <Employees>
          <a0>1</a0>
          <a1>CrazyDude</a1>
          <a2>AAAA</a2>
          <a3>Sales Representative</a3>
          <a4>Ms.</a4>
          <a5>1948-12-08T00:00:00</a5>
          <a6>1992-05-01T00:00:00</a6>
          <a8>Seattle</a8>
          <a9>WA</a9>
          <a10>78890</a10>
          <a11>USAa</a11>
          <a12>(206) 555-9857</a12>
          <a13>5467</a13>
          <a16>70272</a16>
          <a17>http://accweb/emmployees/davolio.bmp</a17>
          <a1000>Test</a1000>
          <a1001>CrazyDude, AAAA</a1001>
          <a10000>Unchanged</a10000>

        </Employees>
        <Employees>
          <a0>2</a0>
          <a1>Fuller</a1>
          <a2>tttt</a2>
          <a3>Vice President, Sales</a3>
          <a4>Ms.</a4>
          <a5>1953-02-19T00:00:00</a5>
          <a6>1992-08-14T00:08:00</a6>
          <a7>908 W. Capital Way</a7>
          <a8>Tacoma</a8>
          <a9>WA</a9>
          <a10>98401</a10>
          <a11>USA</a11>
          <a12>(206) 555-9482</a12>
          <a13>3457</a13>
          <a16>99</a16>
          <a17>http://accweb/emmployees/fuller.bmp</a17>
          <a1000>Test</a1000>
          <a1001>Fuller, tttt</a1001>
          <a10000>Unchanged</a10000>

        </Employees>
        <Employees>
          <a0>3</a0>
          <a1>Spaces</a1>
          <a2>tttt</a2>
          <a3>Sales Representative</a3>
          <a4>Ms.</a4>
          <a5>1963-08-30T00:00:00</a5>
          <a6>1992-04-01T00:00:00</a6>
          <a7>722 Moss Bay Blvd.</a7>
          <a8>Kirkland</a8>
          <a9>WA</a9>
          <a10>98032</a10>
          <a11>USA</a11>
          <a12>(206) 555-3412</a12>
          <a13>3355</a13>
          <a16>2</a16>
          <a17>http://accweb/emmployees/leverling.bmp</a17>
          <a1000>Test</a1000>
          <a1001>Spaces, tttt</a1001>
          <a10000>Unchanged</a10000>

        </Employees>
    </Collection>
</EmployeesCollection>

Summary

This was an extremely valuable exercise for us and revealed a few shortcomings when it comes to serialization virtual properties. Is is possible to implement your code without the new method in red above but that code is not shown here. We are hoping most of you desiring this functionality will be upgrading to our upcoming maintenance release. Also, remember, you can generate entities from views and in views you can create columns that are virtual and not based on database columns at all. This would make a lot of the above work a mute exercise with the caveat that views cannot be saved (easily) back to the database.

Our proxies are very important to future of EntitySpaces and they even run down inside the browser along with our DynamicQueries inside of Silverlight (under the browser) and we will be stepping back to see how we can make them far more powerful and easy to expand in ES2010. However, our next maintenance release will certainly make the above code a no brainer.

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Sunday, December 06, 2009 2:53:37 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Wednesday, November 25, 2009

Last night we moved our site(s) over to dedicated hosting, there are a few kinds, very, very minor. We are working through those, but overall, things went incredibly well. The system is incredibly responsive. One of the main things you will see is that we are moving away from the Community Server forums and will be using the integrated DotNetNuke forums. The old forums are still available but will be made read only at some point in the near future. Click on the Forums link on our main menu to get to the new forums. There is an announcement post there.

Expect a more extensive blog post later on tonight …

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Wednesday, November 25, 2009 7:55:15 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Monday, October 26, 2009

This is a quick post to explain how to use the new built in EntitySpaces Concurrency Mechanism. Basically, all that is required is that you add an integer type column to your table. In the table below I have added a column named “MyTimestamp” which is of type “int”. All we need to do now is drill down to this column on the EntitySpaces “Metadata” Tab and indicate that we want to use this as our concurrency column.

thetable 

This is very easy, and if you’re on our Q3 release there are no more name/value pairs, you simply enter user metadata choices directly in the property grid.

image

Notice here I have set the IsEntitySpacesConcurrency flag to true. Now all I have to do is click the little Save icon and regenerate my “Generated” class.

The path to the Metadata file can be found on the “Settings” tab in the “File Locations” section. See the “User Metadata” path. The resulting xml for the simple entry above is as follows.

<esUserData Version="2009.2.1012.0">
  <Drivers>
    <Driver Name="SQL">
      <Databases>
        <Database Name="MyDatabase">
          <Tables>
            <Table Name="MyTable">
              <Columns>
                <Column Name="MyTimestamp" IsEntitySpacesConcurrency="True" />
              </Columns>
            </Table>
          </Tables>
        </Database>
      </Databases>
    </Driver>
  </Drivers>
</esUserData>

This technique can be used on all non-compact framework databases ..

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Monday, October 26, 2009 9:02:13 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Sunday, October 04, 2009

VistaDB 4.0 Support

We have made a new version of the EntitySpaces Developer available (2009.2.1005.0) that supports VistaDB 4.0. The official release of VistaDB 4.0 was just made available and within 24 hours of it’s release we have added support for it. The EntitySpaces Developer version is available but we haven’t updated the Trial version yet. That will happen within the next 24 hours or so. You can install this right over the top of the 2009.2.0928.0 release, just make sure you have Visual Studio closed. There are now two choices on the Settings tab when connecting to VistaDB.

  1. VistaDB   = VistaDB 3.x
  2. VistaDB4 = VsitaDB 4.x

Also, there is a new EntitySpaces DataProvider that is used with VistaDB 4.x. The assembly name is EntitySpaces.VistaDB4Provider.dll. In your config file in the EntitySpaces connection information you use “EntitySpaces.VistaDB4Provider” as the provider. There are no VistaDB 4.0 compact framework providers as VistaDB 4.0 does not currently ship a Compact Framework assembly.

Fixed the “||” Issue

There was an issue with the || (or) symbol. This has been fixed. In C# you should always be able to use && for AND and || for OR. Of course, in VB.NET you just use the OR and AND keywords.

VB.NET Nullable Type Query Issue

There was an issue that was causing VB.NET developers to use .Value when used nullable types in DynamicQuery statements. This has been fixed.

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Sunday, October 04, 2009 6:20:05 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Sunday, September 27, 2009
kick it on DotNetKicks.com Shout it

We are pleased to make our Official EntitySpaces Q3 Release available. Both the Developer and Source code are available for download to current customers and the Trial version is the official ES2009 Q3 production release as well. The version number is 2009.2.0928.0. We recommend you download ES2009 Q3 saving it to disk and then install via the Start menu’s “Run As …” command and run as “Admin”. This is necessary for Windows Vista and Windows 7.

NOTE: You must regenerate your “Generated” classes and your stored procedures, if using stored procedures.

The EntitySpaces 2009 Q3 release has some of the best support for Silverlight and WCF that any ORM has to offer. Our smart proxies are very powerful and make working with WCF services and Silverlight a breeze. See the PDF’s in our Silverlight and WCF demos. Also, our DynamicQuery API is much more powerful in this release. Here is a quick list of features, fixes, and enhancements that are in this release.

The release notes can be found in this PDF file. There are some breaking changes with our 0209 Production Release which is unusual for us, however, they are pretty minor.

  • Sybase SQL Anywhere Support Including the Compact Framework
  • Excellent Silverlight and WCF Support
  • 64 bit runtime assemblies are included
  • A New EntitySpaces.DynamicQuery Assembly which is Silverlight Compliant
  • A New EntitySpaces Generic Concurrency Mechanism for all databases
  • DynamicQuery - The Having Clause is Now Supported
  • DynamicQuery - Full Expressions in OrderBy and GroupBy
  • DynamicQuery - Daisy Chaining Syntax has been fixed
  • DynamicQuery - Supports “Raw SQL” Everywhere
  • DynamicQuery - Sub Operator Ordering Fix
  • DynamicQuery - Order of Values More Flexible
  • DynamicQuery – Serializable in XML (very tiny packets)
  • DynamicQuery – Parse() method allows you to get the SQL without executing the statement
  • Major Proxy Stub Enhancements (WCF/WebServices/Silverlight) and Compact XML Mode
  • Enhanced UserData.xml file (support for multi dabase developers)
  • Editing User Metadata Easier through the .NET Property Grid
  • Connection Configuration Information Enhancements (no longer read only, catalog/schema added)
  • VistaDB and Microsoft SQL CE Password Bug Fixes
  • Microsoft SQL CE “TOP” syntax fixed
  • There is now a Twitter toolbar button on the “Whats New” tab
  • In the Settings “Other” tab you can control what double-click means for a template.
  • In the Settings “Other” tab you can turn off the DateTime stamp in the header.
  • Brand new Silverlight and WCF Demos
  • We are now bound to VistaDB 3.4.1.84

Of course, there are many other internal changes not listed in the above list.

One thing we didn’t get completed is “path relative project files”. We know this is a very important feature however it turned out be be more complicated than we first thought. However, this will be a high priority for 2010. Also, the Trial version comes with the source code to our Sybase plugin for our code generation engine which will allow you to easily switch Sybase versions. The ES2009 Q3 Developer does not have the Sybase source in it, we will make it available via a separate download.

We will be doing a series of blog posts highlighting a lot of these new features so stay tuned.

 

EntitySpaces

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, a Silverlight/WCF application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Sunday, September 27, 2009 9:32:03 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Thursday, September 24, 2009

We have posted a pre-release build of the 2009.2.0928.0 release. We really need your help, it's for customers only, you'll find it under our Products => Download menu on our main site

  • You should close Visual Studio
  • Uninstall your previous ES2009 release
  • Install the new “Test” release
  • Regenerate your "Generated" classes and stored procedures (if you're using stored procedures)

Please report in on this thread and let us know if you were able to test and what database you are using. The more non-Microsoft SQL users the better. We will be publishing the official release Sunday night. We know this is a lot to ask but we really would like some extra testing before the official release.

- The EntitySpaces Team

posted on Thursday, September 24, 2009 9:18:23 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Monday, September 07, 2009

Better Naming Logic

This is a non-breaking change and won’t effect your current codebase. Take a look at this SQL table, notice that the table name and column names are full of funky characters and such …

CREATE TABLE [dbo].[Crazy Names # 123 !(*]
(
    [PrimaryKey#] [int] IDENTITY(1,1) NOT NULL,
    [ Field With Spaces ] [nchar](10) NULL,
    [123FieldStartingWithANumber] [nchar](10) NULL,
    [Field with % Special # Characters , In It) ] [nchar](10) NULL,
    [A Field] [nchar](10) NULL,
    [A_Field] [nchar](10) NULL,
    [StandardFieldName] [nchar](10) NULL,
    [_wow_this_is_crazy.man ok] [nchar](10) NULL,
    [this#dba##should###be####fired#####.ok] [nchar](10) NULL,
    [_ALIAS_ME_#$%] [nchar](10) NULL,
)

This is what the resulting class looks like (in the past, we didn’t handle these so well)

[Serializable]
abstract public class esCrazyNames123 : esEntity
{
    public System.Int32? PrimaryKey;
    public System.String FieldWithSpaces;
    public System.String _123FieldStartingWithANumber;
    public System.String FieldWithSpecialCharactersInIt;
    public System.String AField;
    public System.String A_Field;
    public System.String StandardFieldName;
    public System.String _Wow_This_Is_CrazyManOk;
    public System.String ThisDbaShouldBeFiredOk;
    public System.String MyAlias;
}

You may have noticed the last field “MyAlias” is different. That is because we Aliased it to ensure Aliasing still works. Aliasing is done via the Metadata tabl. You might also notice that “underscores” were left in the column names. However, this is not the default. We merely check the “Preserve Underscores” checkbox because of the “A Field” and A_Field” columns so they wouldn’t conflict. “Preserve Underscores” if off by default. Take a look at this screen shot.

image

Notice on the “Naming Conventions” tab we have “Preserve Underscores” checked. Also, you might notice the “Trimlist” field is completely gone, it is not used anymore. But don’t worry, these changes will not effect your current objects.

Here are the rules basically for Property names in .NET


if(Char.IsLetterOrDigit(character))
{
    // this character is valid
}

The only exception to this rule is you can have an “_” underscores and the 1st character cannot be a number. That’s it. So now, no matter how things are created in your database EntitySpaces will always generate valid classes that compile out of the box, no need for aliasing unless you want to.

 

DynamicQuery Parse() Method

You can now capture the SQL Syntax a DynamicQuery would generate without having to execute it. This is done via the Parse() method like so:

CrazyNames123 c = new CrazyNames123();
c.Query.es.Top = 1;
c.Query.Where(c.Query.MyAlias == "asdf");
string str = c.Query.Parse();

This can come in handy when writing your queries …

EntitySpaces

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, a Silverlight application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Monday, September 07, 2009 9:29:09 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Monday, August 31, 2009
kick it on DotNetKicks.com   Shout it

We are pleased to make our ES2009 Q3 Beta available as our Trial version. In fact, this is our only Trial version as we want folks new to EntitySpaces to begin with this version. The production release is scheduled for September 28th, 2009. This trial includes data providers for all of our supported databases. We have listened to your feedback and hopefully have implemented a lot of the requests you have asked for. We will still sneak in some more items from the Q3 Wish List forum before the official release so if you see something we overlooked that you feel is very important let us know on the forums. We really need some our customers to upgrade if you can, if you do, please post on the forums and let us know what things you ran into it that weren’t in our release notes and we will update those quickly.

The EntitySpaces 2009 Q3 release we feel has some of the best support for Silverlight that any ORM has to offer. Our smart proxies are very powerful and make working with WCF services and Silverlight a breeze. Also, our DynamicQuery API is much more powerful in this release. Here is a quick list of features, fixes, and enhancements that are in this release.

The release notes can be found in this PDF file. Although there are some breaking changes with our 0209 Production Release no new breaking changes will be implemented between the Beta and Production release.

  • Sybase SQL Anywhere Support Including the Compact Framework
  • Excellent Silverlight Support
  • A New EntitySpaces.DynamicQuery Assembly which is Silverlight Compliant
  • A New EntitySpaces Generic Concurrency Mechanism
  • DynamicQuery - The Having Clause is Now Supported
  • DynamicQuery - Full Expressions in OrderBy and GroupBy
  • DynamicQuery - Daisy Chaining Syntax has been fixed
  • DynamicQuery - Supports “Raw SQL” Everywhere
  • DynamicQuery - Sub Operator Ordering Fix
  • DynamicQuery - Order of Values More Flexible
  • DynamicQuery – Serializable in XML (very tiny packets)
  • Major Proxy Stub Enhancements (WCF/WebServices/Silverlight) and Compact XML Mode
  • Enhanced UserData.xml file (support for multi dabase developers)
  • Editing User Metadata Easier Through the .NET Property Grid
  • Connection Configuration Information Enhancements (no longer read only, catalog/schema added)
  • VistaDB Password Bug Fix
  • Microsoft SQL CE “TOP” syntax fixed
  • There is now a Twitter toolbar button on the “Whats New” tab
  • In the Settings “Other” tab you can control what double-click means for a template.
  • In the Settings “Other” tab you can turn off the DateTime stamp in the header.

Of course, there are many other internal changes not listed in the above list. One thing we didn’t get completed but will before the official release is path relative project files, we know this is a very important feature. Also, our WCF demo is not included. We are reworking it for the official release, but all other demo’s are included.

Download the Trial Version HERE.

EntitySpaces

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, a Silverlight application, a Mono application, 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.

 

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Monday, August 31, 2009 10:20:21 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Sunday, August 30, 2009

We are pleased to make this beta available. This beta includes data providers for all of our supported databases. The Trial Version of the Beta is not yet available. It will be available Monday night/Tuesday morning. We are only planning on having this one beta with the official release being published on September 28th, 2009. We have listened to your feedback and hopefully have implemented a lot of the requests you have asked for. We will still sneak in some more items from the Q3 Wish List forum before the official release so if you see something we overlooked that you feel is very important let us know on the forums. We really need some our customers to upgrade if you can, if you do, please post on the forums and let us know what things you ran into it that weren’t in our release notes and we will update those quickly.

The EntitySpaces 2009 Q3 release we feel has some of the best support for Silverlight that any ORM has to offer. Our smart proxies are very powerful and make working with WCF services and Silverlight a breeze. Also, our DynamicQuery API is much more powerful in this release. Here is a quick list of features, fixes, and enhancements that are in this release.

The release notes can be found in this PDF file. Although there are some breaking changes no new breaking changes will be implemented between the Beta and Production release.

  • Sybase SQL Anywhere Support Including the Compact Framework
  • Excellent Silverlight Support
  • A New EntitySpaces.DynamicQuery Assembly which is Silverlight Compliant
  • A New EntitySpaces Generic Concurrency Mechanism
  • DynamicQuery - The Having Clause is Now Supported
  • DynamicQuery - Full Expressions in OrderBy and GroupBy
  • DynamicQuery - Daisy Chaining Syntax has been fixed
  • DynamicQuery - Supports “Raw SQL” Everywhere
  • DynamicQuery - Sub Operator Ordering Fix
  • DynamicQuery - Order of Values More Flexible
  • DynamicQuery – Serializable in XML (very tiny packets)
  • Major Proxy Stub Enhancements (WCF/WebServices/Silverlight) and Compact XML Mode
  • Enhanced UserData.xml file (support for multi dabase developers)
  • Editing User Metadata Easier Through the .NET Property Grid
  • Connection Configuration Information Enhancements (no longer read only, catalog/schema added)
  • VistaDB Password Bug Fix
  • Microsoft SQL CE “TOP” syntax fixed
  • There is now a Twitter toolbar button on the “Whats New” tab
  • In the Settings “Other” tab you can control what double-click means for a template.
  • In the Settings “Other” tab you can turn off the DateTime stamp in the header.

Of course, there are many other internal changes not listed in the above list. One thing we didn’t get completed but will before the official release is path relative project files, we know this is a very important feature. Also, our WCF demo is not included. We are reworking it for the official release, but all other demo’s are included.

EntitySpaces

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, a Silverlight application, a Mono application, 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.


EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Sunday, August 30, 2009 10:33:01 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Friday, August 28, 2009

There are some very nice connection handling enhancements that will be in this weekends ES2009 Q3 Beta. First, and we know you’ll be thrilled to hear this, all of the information regarding the connection setup, including the connection string itself, is writeable at runtime. This is true even when using a web.config or app.config file, the information is no longer readonly. It is no longer necessary to use the configless approach to be able to modify things on the fly.

Also, you can now set your “schema” and “catalog” information in the Connection Info section as shown below. This will really help out our Oracle users and of course applies to all databases that support schema and catalog information.

<add name="SQLDynamic"
   providerMetadataKey="esDefault"
   sqlAccessType="DynamicSQL"
   provider="EntitySpaces.SqlClientProvider"
   providerClass="DataProvider"
   connectionString="yada yada;"
   databaseVersion="2005"
   schema="dbo"
   catalog="Northwind"

/>

This two changes alone really add a lot of flexibility to the EntitySpaces Connection management area.

EntitySpaces

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, a Silverlight application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Friday, August 28, 2009 7:10:37 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Monday, August 24, 2009

We just wanted to do a quick blog post and let everyone know that so far we are on track for the August 31st release date. We have almost finished adding the EntitySpaces universal concurrency checking code for provider independent programmers. Everything has to go through unit testing again but we’re very close now. This is a big release for us and this is going to be a very busy week for sure. Follow us on Twitter for more timely info ..

EntitySpaces

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, a Silverlight application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Monday, August 24, 2009 2:55:19 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Saturday, August 15, 2009

ORMBattle.NET is devoted to direct ORM comparison. This site is actually run by one of the ORM vendors but we still want to take our shot at it.

 

Vote Here For EntitySpaces to the Next ORM product evaluated ==> ORM BATTLE.NET

 

EntitySpaces

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, a Silverlight application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Saturday, August 15, 2009 7:24:46 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Tuesday, August 11, 2009

Things are going great. We now have all of our data providers upgraded and compiling clean, including the Compact Framework providers. We have many users working fine with our Sybase support so we are very pleased on how our Sybase support is being received. This is just a quick post to let you know we have added the Having clause to fill out our DynamicQuery API.

Here is a sample query (this might not make sense as a real query, this was just for testing the syntax, the query did return data however).

EmployeeQuery q = new EmployeeQuery();
q.Select(q.EmployeeID, q.Age.Sum().As("TotalAge"));
q.Where(q.EmployeeID.IsNotNull());
q.GroupBy(q.EmployeeID);
q.Having(q.Age.Sum() > 5);
q.OrderBy(q.EmployeeID.Descending);

EmployeeCollection coll = new EmployeeCollection();
if (coll.Load(q))
{

}

This resulting SQL is shown below:

SELECT [EmployeeID] AS 'EmployeeID',SUM([Age]) AS 'TotalAge'  FROM
[ForeignKeyTest].[dbo].[Employee]
WHERE[EmployeeID] IS NOT NULL
GROUP BY [EmployeeID]
HAVING SUM([Age]) > @Age2
ORDER BY [EmployeeID] DESC

Our DynamicQuery API has such terrific enhancements coming in ES2009 Q3. Also, our release dates have been posted on our Roadmap. Start making your plans today …

EntitySpaces

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, a Silverlight application, a Mono application, 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.

 

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Tuesday, August 11, 2009 9:00:51 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Thursday, August 06, 2009

This information is on our Roadmap page which can be seen HERE.

EntitySpaces

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, a Silverlight application, a Mono application, 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.

 

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Thursday, August 06, 2009 10:49:04 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Sunday, August 02, 2009
Shout it kick it on DotNetKicks.com

image

We are very excited to announce our Sybase SQL Anywhere support available with this release. We currently support Sybase SQL Anywhere 11 (versions 11.0.0.1490 and 11.0.1.2044). Our assemblies are bound to the 11.0.1.2044 version. However, if you are using the older 11.0.0.1490 version see this post on our forums. Swapping your SQL Anywhere provider version only takes a minute or two. We ship two providers for Sybase, a regular EntitySpaces provider for Sybase network server/personal server, and one for the Compact Framework. Both of these are available in this alpha release. EntitySpaces (the application) is available in two modes; a Visual Studio Add-In which is available from the Visual Studio “Tools” menu and the “stand alone” application available from your EntitySpaces 2009 menu after installation.

Our Sybase support in this initial release is already very rich. We support Sybase autoincrement columns, timestamps for concurrency, and both dynamic and stored procedures modes for updating your Sybase housed data. There is a new template included with this release that will generate your Sybase CRUD stored procedures if you want to use stored procedures for your CRUD operations. This isn’t required however, EntitySpaces can run with or without stored procedures. This is our first release with Sybase support so please let us know via the forums how the Sybase support is working for you. We’ve done a pretty good job of testing and will fix any bugs reported on our forums.

We already have a customer who is going to be writing a Silverlight application using EntitySpaces 2009 and Sybase, very cool stuff. Customers can find this release under our Products –> Downloads menu. The source code for customers who purchased source code should be published later on this evening and be available by Monday morning at the latest. UPDATE – 2009-08-07: We have posted a Trial version of this Alpha on our Trial Download page.

This Alpha Release only includes EntitySpaces providers for SQL Server and Sybase. The EntitySpaces 2009 Q3 enhancements will be rolled into the other providers and be available with the upcoming Beta Release. Our current Production Release (with all providers) is EntitySpaces 2009.1.0209.0. It is available to Customers on the Products Downloads page, and as a Trial version on the Trial Download page. For current customers wishing to try the EntitySpaces provider for Sybase, or want to get a jump start on the Q3 enhancements for SQL Server, be sure to read the installation instructions and release notes for the Alpha.

New EntitySpaces Users


If you are new to EntitySpaces watch our video demonstrating how easy it is to create your first EntitySpaces application and get up and running quickly. Click the video on the left to watch the video.

getstarted


Be sure and read through our Getting Started PDF file. You can click on the image to the left or click on the link on your EntitySpaces 2009 menu after installation. This document is pretty short and if you take the time to read through it you will save yourself time in the end. So take a look at this very valuable document.

Also, be sure and register on our forums. We have created two new areas specifically for our Sybase providers. If the issue you are having is specific to one of our Sybase providers, such as the incorrect SQL being generated (which isn’t very likely), post a note in the proper Sybase forum. Of course, all other “How do I ?” questions you can ask in the proper area on our forums.

Finally, on your EntitySpaces 2009 menu after installation you will see Windows.Forms, ASP.NET, and Silverlight programming samples that will compile right out of the box. They are set to run against the Microsoft SQL Northwind database. Even if that is not the database you are running they are great samples to look at. The ASP.NET samples also use our esDataSource control. So if you are looking for example code be sure and check the sample applications found in your EntitySpaces 2009 program menu entry.

Other Features

There are some other very nice features in this alpha release. Our proxies now support something we call “Compact XML” and can be used whenever you are using both our Client side and Server Side proxies together and avoiding the middle man (that is the Visual Studio Generated proxies as we do in our Silverlight demo). We have updated our online Silverlight example and it is now using our Compact XML mode. As a side note, Silverlight supports something called Binary XML serialization out of the box with only a config file change required.

There is also a new feature in the Settings Tab that lets you control what happens on a double click a template in the Template tab. You can either have the double click launch the template for editing, or for execution, or for execution with the last known settings. The EntitySpaces Universal Concurrency checking mechanism IS NOT in this release, but it will be in our upcoming beta.

Our next step is going to be to rapidly upgrade the rest of our data providers, implement our “EntitySpaces Universal Concurrency” feature for database independent concurrency handling, make our project files path relative, and squeeze in more features from our Q3 Wish List forum. Things are going to move very rapidly. After next weeks team meeting we should be able to publish the target release our first beta, including what features will be included, and finally, publish the RTW date for the official release of  EntitySpaces 2009 Q3.

EntitySpaces

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, a Silverlight application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

 

posted on Sunday, August 02, 2009 2:44:47 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Tuesday, July 28, 2009

This little gem was brought up by one of our customers, Paul_IBSoftware, and it looked like fun to implement so we snuck it into our Q3 release. Nothing like getting a suggestion and having it in the product the same day. Basically, we had the SQL conjuctions AND and OR but we didn’t have anyway to indicate AND NOT or OR NOT but that is no longer true, see the example below.

VB.NET

Dim q As New EmployeesQuery()
q.es.Top = 1
q.Where(q.EmployeeID = 1 And Not (q.LastName = "goofy"))
q.Load()

Notice you can now use And Not/Or Not in your query syntax. This will yield the following SQL syntax.

SELECT  TOP 1 *
FROM [Employees]
WHERE ([EmployeeID] = @EmployeeID1 AND NOT [LastName] = @LastName2)

C#

You can do this in C# too, however this is one case where the VB.NET syntax reads better than the C# syntax. Take a look at the sample below.

EmployeesQuery q = new EmployeesQuery();
q.es.Top = 1;
q.Where(q.EmployeeID == 1 && ! (q.LastName == "googy"));
q.Load();

Granted, a C# developer would probably never think of that syntax, but it yields the exact same SQL as above. Probably a C# developer would write it as below

EmployeesQuery q = new EmployeesQuery();
q.es.Top = 1;
q.Where(q.EmployeeID == 1 && (q.LastName != "googy"));
q.Load();

The above query would product the following SQL.

SELECT  TOP 1 *
FROM [Employees]
WHERE ([EmployeeID] = @EmployeeID1 AND [LastName] <> @LastName2)

Summary

The EntitySpaces 2009 Q3 DynamicQuery is going to blow your socks off. We are so excited about this release, things are moving very quickly too.

EntitySpaces

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, a Silverlight application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Tuesday, July 28, 2009 6:31:17 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Monday, July 27, 2009
kick it on DotNetKicks.com

We have our Sybase SQL Anywhere implementation working quite well now. We are releasing a new alpha on August 3rd that will come with a new provider for Sybase SQL Anywhere including a Compact Framework provider as well for Sybase mobile development. We have been developing and testing with SQL Anywhere version 11. Everything is working great including autoincrement keys, concurrency checking, and so on. We haven't tested our stored procedures yet but should have that work completed by August 3rd. Remember Sybase fans, EntitySpaces runs under Mono as well.

Having never really used Sybase before we must say it really is a very full featured database and they have worked with us very well. We basically have a red phone we can pick up and get right to technical support, fantastic! Sybase really seems to be focused on customer service more so than most companies we’ve worked with, maybe that’s part of why Sybase has announced terrific earnings for Q2 of this year, who else can say that? We will be taking a look at supporting their Ultra Light version as well. Sybase is a very serious contender in the database world, you will be hearing more from us on this subject in the future. If you don’t know much about Sybase click on some of the links in this post, we think you will be impressed.

This should be our last Alpha version. Soon we will be upgrading all our providers to support the new features we've implemented (with some still yet to be added). We will then provide a beta release that will be made available to the general public as a trial version as we head down the home stretch for EntitySpaces 2009 Q3.

EntitySpaces

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, a Silverlight application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Monday, July 27, 2009 9:43:51 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Tuesday, July 21, 2009

We thought we would use this blog post to report more progress on our EntitySpaces 2009 Q3 release. However, before we continue we want to point out that our current production release is EntitySpaces Q1 2009.1.0209.0 and it is available now, it is also very stable (as usual). Okay, so here is some of the new functionality, we are working through our Q3 Wish List forum posts.

image

In the above image we have selected the EntitySpaces 2009 Metadata tab. We have highlighted two areas in the image for purposes of this post. The red box is a .NET PropertyGrid control and we use this now instead of what we used to use, which was a .NET DataGrid. Not only does it look better and allow us to group data by functionality, but it also allows for easy editing. The blue box highlights certain fields that you can edit directly in the metadata. Notice that you can edit the “Alias” directly in the Metadata. Also, there is an Exclude flag which you can set to true to indicate that you want this column skipped entirely during code generation purposes. There is also a new flag called IsUniversalConcurrency which you can set on any integer type field (I can see econner jumping for joy already!). This will allow you to have exact matching schema’s across multiple databases and still have concurrency checking. The reason this is needed is Microsoft SQL’s Timestamp for instance is not really compatible with other database systems, or said better there really is no universal concurrency checking built into dbms systems so we will provide one for you. Finally, we have IsCustomAutoKey and CustomAutoKeyText, these will replace the current way that Oracle users (and possibly others) have to provide key/value pairs in our user metadata. We will automatically convert your current UserData.xml files for you to support his new approach. All of our Metadata is now presented this way (not just column information).

What is nice about this new approach is that we can expand it easily in the future and behind the scenes any values that you edit end up in the user metadata just as it would if you were typing in key/value pairs only it’s so much easier. We are also considering making IsInPrimaryKey editable so that you can make tables without primary keys appear as though they had them.

Also, we have eliminated the problem that prevented you from daisy chaining queries when joins were involved.

We have also flushed out the DynamicQuery API such that you have no operator precedence issues, for instance.

query.Where(42 > query.Age);

or

query.Where(query.Age < 42);

The same holds true with our mathematical operators as well.

query.Select(“Wow” + query.FirstName + “Cool”); // notice the string “Wow” comes first

or

query.Select(100 * query.Age);  // Notice the 100 comes first

Progress is moving very rapidly and we are still passing at 100% in our unit tests (including a bunch of new tests that have been added).

EntitySpaces

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, a Silverlight application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Tuesday, July 21, 2009 6:42:50 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Thursday, July 16, 2009
kick it on DotNetKicks.com

We have pushed our EntitySpaces Silverlight application up so you can run it and take a look at it. We decided to compile it under the Silverlight 3 toolset so it requires Silverlight 3 to run it. We did this to make sure we are compatible. Silverlight 3 is RTM now and you can download the Visual Studio tools for it HERE but you do not need these to run the demo, just to develop Silverlight 3 applications. There is a lot of code posted in this blog post but we thought you might really want to know how this stuff works, it’s not that hard to understand if you take the time to look at the code. The online demo can be found here ==> DEMO

image

You can add rows and edit rows and then save the data. We are using the Microsoft SQL Northwind database, specifically the Employees table. When you search you can search on the first name or last name fields. The purpose of this demo is not to make a really cool Silverlight UI, but to show how easy it is to use EntitySpaces to write a Silverlight application. There is one glitch when editing data. You need to move off of the selected row for your edits to “take”. This is a Silverlight issue and not an EntitySpaces Issue. The demo is included in our current alpha, however the version shown here is fancier. (It will be in the next release as shown above).

The EntitySpaces Silverlight Demo uses our EntitySpaces proxies on both sides of the conversation. The client side proxies run under Silverlight and our server side proxies run on the server. The Silverlight application hits our WCF service to fetch the data.

The WCF Service

This is what the WCF Service looks like including the Interface. The Interface for the service is shown below. Notice we are returning and taking the EntitySpaces Proxy Stub classes as parameters. However, we pass the EntitySpaces DynamicQuery to the server in string form. The EntitySpaces DynamicQuery is now fully functional under Silverlight and requires only a single 49k assembly which will automatically download with your Siverlight application.

using System.ServiceModel;
 
using BusinessObjects;
 
namespace EntitySpaces.SilverlightApplication.Web
{
    [ServiceContract]
    public interface INorthwind
    {
        [OperationContract]
        EmployeesCollectionProxyStub GetEmployees(string employeesQuery);
 
        [OperationContract]
        EmployeesCollectionProxyStub SaveEmployees(EmployeesCollectionProxyStub collection);
    }
}
 
The implementation class is shown below. Notice in GetEmployees() we deserialize the incoming query (passed as a string) with a single one-line call into a full server side query that we can execute. We then use that query to load our collection, and finally wrap it with a proxy collection and return it. The Save() method is ridiculously simple and powerful. Notice that we merely access the incoming proxies “Collection” property (which is a full EmployeesCollection class) and call save on it. Then we simply return the very same proxy that was sent to us as the incoming parameter. Try clicking the Add button in our demo a few times and then press the Save button. Notice the auto identity columns are immediately reflected in the grid. These are returned automatically via our save method. This is an incredibly powerful and easy way to create Silverlight applications. The row state, including added, modified, and deleted, are automatically maintained for you. All you have to do is call save.
 
using System;
using System.Collections.Generic;
using System.ServiceModel.Activation;
 
using BusinessObjects;
 
namespace EntitySpaces.SilverlightApplication.Web
{
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class Northwind : INorthwind
    {
        #region INorthwind Members
 
        public EmployeesCollectionProxyStub GetEmployees(string serializedQuery)
        {
            List<Type> types = new List<Type>();
            types.Add(typeof(EmployeesQuery));
 
            EmployeesQuery employeesQuery = EmployeesQuery.SerializeHelper.FromXml(
                serializedQuery, typeof(EmployeesQuery), types) as EmployeesQuery;
 
            EmployeesCollection employeesCollection = new EmployeesCollection();
            if (employeesCollection.Load(employeesQuery))
            {
                EmployeesCollectionProxyStub proxy = new EmployeesCollectionProxyStub(employeesCollection);
                return proxy;
            }
 
            return null;
        }
 
        public EmployeesCollectionProxyStub SaveEmployees(EmployeesCollectionProxyStub collection)
        {
            if (collection != null)
            {
                collection.GetCollection().Save();
                return collection;
            }
 
            return null;
        }
 
        #endregion
    }
}


The Silverlight Page

Our Page.xaml file looks like this. A lot of this is just noise like setting up the buttons and such. The part you are interested in is the <data:DataGrid.Columns> section where we manually setup the columns we want to display in the grid. We could have used AutoGenerateColumns=“True” however. For the two date columns we use a DataGridTemplateColumn in order to hookup the fancy date editing control. We also set the EmployeeID column to read only so that users cannot edit the primary key.

<UserControl xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"  xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  x:Class="EntitySpaces.SilverlightApplication.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
 
    <Grid Background="Black" >
 
        <Grid.RowDefinitions>
            <RowDefinition Height="50"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="50"></RowDefinition>
        </Grid.RowDefinitions>
 
        <Grid Grid.Row="0" Margin="7">
 
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="100"></ColumnDefinition>
                <ColumnDefinition Width="300"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="240"></ColumnDefinition>
                <ColumnDefinition Width="75"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            
            <HyperlinkButton Grid.Column="0" NavigateUri="http://www.entityspaces.net" TargetName="New"><Image Source="EntitySpaces_Logo.jpg" Grid.Column="0" /></HyperlinkButton>
            <TextBlock Name="SearchTextBlock" Grid.Column ="1" Text="EntitySpaces 2009 Silverlight Demo" Foreground="Yellow" FontSize="14" Margin="10,5,10,5" VerticalAlignment="Center"></TextBlock>
            <ProgressBar Name="WorkingBar" Grid.Column="2" Foreground="Yellow" Background="Black" Value="0" Maximum="100" Margin="2,2,2,2" />
            <TextBox Name="SearchTextBox" Text="Enter Criteria Here" Grid.Column="3" Margin="20,0,20,0" Padding="10,5,10,5" FontSize="14" GotFocus="SearchTextBox_GotFocus"></TextBox>
            <Button Name="SearchButton" Content="Search" Grid.Column="4" FontSize="14" Click="SearchButton_Click"></Button>
        </Grid>
 
 
 
        <Grid Grid.Row="1" Margin="7">
            <data:DataGrid Name="EmployeesDataGrid" AutoGenerateColumns="False" >
 
                <data:DataGrid.Columns>
 
                    <data:DataGridTextColumn Binding="{Binding EmployeeID}" Header="Employee ID" IsReadOnly="True" />
                    <data:DataGridTextColumn Binding="{Binding FirstName}" Header="First Name" />
                    <data:DataGridTextColumn Binding="{Binding LastName}" Header="Last Name" />
                    <data:DataGridTextColumn Binding="{Binding HomePhone}" Header="Home Phone" />
                    <data:DataGridTextColumn Binding="{Binding City}" Header="City" />
 
                    <data:DataGridTemplateColumn Header="Hire Date" Width="160">
                        <data:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding HireDate, Mode=OneWay, Converter={StaticResource ShortDateConverter}}" VerticalAlignment="Center" Margin="2"/>
                            </DataTemplate>
                        </data:DataGridTemplateColumn.CellTemplate>
                        <data:DataGridTemplateColumn.CellEditingTemplate>
                            <DataTemplate>
                                <controls:DatePicker SelectedDate="{Binding HireDate, Mode=TwoWay}" />
                            </DataTemplate>
                        </data:DataGridTemplateColumn.CellEditingTemplate>
                    </data:DataGridTemplateColumn>
 
 
                    <data:DataGridTemplateColumn Header="Birth Date" Width="160">
                        <data:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding BirthDate, Mode=OneWay, Converter={StaticResource ShortDateConverter}}" VerticalAlignment="Center" Margin="2"/>
                            </DataTemplate>
                        </data:DataGridTemplateColumn.CellTemplate>
                        <data:DataGridTemplateColumn.CellEditingTemplate>
                            <DataTemplate>
                                <controls:DatePicker SelectedDate="{Binding BirthDate, Mode=TwoWay}" />
                            </DataTemplate>
                        </data:DataGridTemplateColumn.CellEditingTemplate>
                    </data:DataGridTemplateColumn>
 
                </data:DataGrid.Columns>
 
            </data:DataGrid>
        </Grid>
 
        <Grid Grid.Row="2" Margin="7">
 
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="75"></ColumnDefinition>
                <ColumnDefinition Width="15"></ColumnDefinition>
                <ColumnDefinition Width="75"></ColumnDefinition>
                <ColumnDefinition Width="15"></ColumnDefinition>
                <ColumnDefinition Width="75"></ColumnDefinition>
            </Grid.ColumnDefinitions>
 
            <Button Name="AddButton" Content="Add" Grid.Row="2" Grid.Column="1" FontSize="14" Click="AddButton_Click" ></Button>
            <Button Name="SaveButton" Content="Save" Grid.Row="2" Grid.Column="3" FontSize="14" Click="SaveButton_Click" ></Button>
            <Button Name="ClearButton" Content="Clear" Grid.Row="2" Grid.Column="5" FontSize="14" Click="ClearButton_Click" ></Button>
        </Grid>
 
    </Grid>
</UserControl>

 

Our Page.xaml.cs file is shown below. Take a look at the SearchButton_Click event. We build the EntitySpaces DynamicQuery and call the service.GetEmployeesAsync() method passing in the query in string form. In the service_GetEmployeesCompleted() method we access our EmployeesCollectionProxyStub class which was returned to us in the “e.Result” variable. However, now we are working with the client side lightweight proxy class. The interesting thing about this approach is that we are NOT using the Visual Studio generated proxies. Our proxies are smart and maintain row state, and they are going to get even smarter. This approach makes EntitySpaces a terrific architecture for building your Silverlight applications. The SaveButton_Click is also incredibly simple. The timer stuff you see is just to make the fancy progress bar work in the demo.

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;
 
using EntitySpaces.SilverlightApplication.NorthwindClient;
using Proxies;
 
 
namespace EntitySpaces.SilverlightApplication
{
    public partial class Page : UserControl
    {
        private NorthwindClient.NorthwindClient service = new NorthwindClient.NorthwindClient();
        private Proxies.EmployeesCollectionProxyStub employees;
        private Storyboard Timer = new Storyboard();
        private int RecordsAdded;
 
 
        public Page()
        {
            InitializeComponent();
            Timer.Completed += new EventHandler(Timer_Completed);
            Timer.Duration = TimeSpan.FromMilliseconds(2);
        }
 
        private void SearchButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Proxies.EmployeesQueryProxyStub q = new Proxies.EmployeesQueryProxyStub("emp");
 
                q.Select(q.EmployeeID, q.FirstName, q.LastName, q.HomePhone, q.HireDate, q.BirthDate, q.City);
                q.Where(
                    q.FirstName.Like("%" + SearchTextBox.Text + "%") |
                    q.LastName.Like("%" + SearchTextBox.Text + "%"));
                q.OrderBy(q.LastName.Ascending);
 
                service.GetEmployeesCompleted += new EventHandler<GetEmployeesCompletedEventArgs>(service_GetEmployeesCompleted);
                service.GetEmployeesAsync(Proxies.EmployeesQueryProxyStub.SerializeHelper.ToXml(q));
 
                WorkingBar.Value = 0;
                Timer.Begin();
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.StackTrace);
            }
        }
 
        void service_GetEmployeesCompleted(object sender, GetEmployeesCompletedEventArgs e)
        {
            WorkingBar.Value = 100;
            Timer.Stop();
            
            if (e.Result != null)
            {
                employees = e.Result;
                EmployeesDataGrid.ItemsSource = employees.Collection;
            }
        }
 
        private void ClearButton_Click(object sender, RoutedEventArgs e)
        {
            SearchTextBox.Text = "";
            employees = null;
            EmployeesDataGrid.ItemsSource = null;
        }
 
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (employees == null) return;
 
                WorkingBar.Value = 0;
                Timer.Begin();
 
                service.SaveEmployeesCompleted += new EventHandler<SaveEmployeesCompletedEventArgs>(service_SaveEmployeesCompleted);
                service.SaveEmployeesAsync(employees);
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.StackTrace);
            }
        }
 
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            if (employees == null)
            {
                employees = new EmployeesCollectionProxyStub();
                EmployeesDataGrid.ItemsSource = employees.Collection;
            }
 
            if (RecordsAdded++ < 5)
            {
                EmployeesProxyStub newEmp = new EmployeesProxyStub();
                newEmp.FirstName = "Scott";
                newEmp.LastName = "Schecter";
 
                employees.Collection.Add(newEmp);
            }
        }
 
        void service_SaveEmployeesCompleted(object sender, SaveEmployeesCompletedEventArgs e)
        {
            try
            {
                WorkingBar.Value = 100;
                Timer.Stop();
 
                RecordsAdded = 0;
 
                employees = e.Result;
                EmployeesDataGrid.ItemsSource = employees.Collection;
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.StackTrace);
            }
        }
 
        private void SearchTextBox_GotFocus(object sender, RoutedEventArgs e)
        {
            if (SearchTextBox.Text == "Enter Criteria Here")
            {
                SearchTextBox.Text = "";
            }
        }
 
        void Timer_Completed(object sender, EventArgs e)
        {
            WorkingBar.Value++;
            Timer.Begin();
 
            if (WorkingBar.Value > 100)
            {
                WorkingBar.Value = 1;
            }
        }
    }
}

Rather than repeat of bunch of content from previous posts, here are two posts that will help you further understand how we created the entire solution.

1) How we generated the lightweight client side proxies.

2) How we built the application and informed Visual Studio to use our proxies rather than generate proxies for us.

Be sure when you execute the “Generated Master” template to check the “Serializable Queries” checkbox on the advanced tab. Again, the demo is included in the latest alpha. We are even adding a new checkbox that will “scrunch” the XML when it goes over the wire so that your packets are much smaller. The XML will send all of your fields as “a1”, “a2”, “a3” and so on rather than “EmployeeID”, “FirstName”, “LastName”. This will make a big difference when sending large chunks of data from client to server and back again. Of course, we only send the columns that actually have data (non null/default) so your XML will be very tiny. This will not impact your proxies, they of course will still have your nice property names.

Well, that’s it for now. We are not only working on Silverlight and Proxies, we are also working through the Q3 Wish List as well.

EntitySpaces

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, a Silverlight application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Thursday, July 16, 2009 10:42:46 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Sunday, July 12, 2009

The Developer version and Source version have been published for this release. You must uninstall any prior versions of EntitySpaces 2009 including the production release or any prior alphas. EDIT – 2009-08-07: This Alpha only supports the EntitySpaces provider for SQL Server.

These are new features contained in this release:

  • The EntitySpaces Hierarchical Object Model Improvements
  • The EntitySpaces 2009 Getting Started PDF is now on the EntitySpaces 2009 menu after installation.
  • You can turn off the DateTime value in your class headers so that they wont cause differences in your source control system (in the settings tab).
  • Major Improvements to our lightweight client side proxies.
  • Our Silverlight demo which demonstrates using our proxies on both sides of the Silverlight / WCF conversation complete with editing and saving data through a grid. We will be posting the demo online so you can execute it and play with it. You will find it on our Samples menu after install it will compile right out of the box, just see the Readme.txt file in the solution.

Lightweight Client Side Proxy Stub – Major Improvements

The lightweight client side proxies now support

  • The INotifyPropertyChanged interface
  • ObservableCollections (great for Silverlight support)
  • And a Silverlight checkbox will we remove any non supported items such as [Serialized] attributes

image

We used the settings above settings to create the client side proxies for our Silverlight demo. Below is what our proxy collection looks like.

image

Noitce the Collection property is an ObservableCollection. In our Silverlight demo you can add records directly to your collection and they will automatically show up in the grid.

image

Above is our single Entity object. It implements the INotifyPropertyChanged interface. You can change a property directly on your Entity object it will immediately be reflected in the Silverlight grid.

We are adding a lot of enhancements to our lightweight client side proxies. You can begin your Silverlight application starting with this Alpha, it is working very well. A few things will be adding are a compressed mode where we will “Scrunch” the XML being sent over the wire by giving your property names in XML like “a1, a2, a3, a4, a5 …” and so on to reduce the size of the XML packet. This isn’t really an EntitySpaces issues its just the result of XML itself which is pretty bulky and will not effect your code in any way.

We will be hosting our new EntitySpaces Silverlight demo on our site and providing some insight on how it all operates. It is very simple to create Silverlight applications with EntitySpaces 2009 and the full demo is including with this latest alpha. The demo runs against Microsoft SQL’s Northwind database.

EntitySpaces

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, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Sunday, July 12, 2009 2:46:59 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Saturday, July 11, 2009

The “Selected Tables Only” checkbox

We have implemented a long standing request that provides you with more control over how your hierarchical object model is created. Now you can limit your hierarchical object model to include only those tables that you have selected at code generation time. When EntitySpaces creates your hierarchical object model it does so using your foreign keys in your database to determine the relationships. Let’s take a look at how this new “Selected Tables Only” checkbox logic works.

image image

Notice above that we have checked the “Selected Tables Only” checkbox and that we have only two tables selected (the “Employees” and the “Orders” table). When EntitySpaces generates the code it will generate the Employees and Orders classes as usual. However, since we have checked the “Selected Tables Only” checkbox only the hierarchical properties involving the Orders and Employees table will be added as hierarchical properties. Let’s take a look at the Employees class (below) generated with the above settings and see what it looks like.

image

Notice the Employees class contains only the self referencing ReportsTo properties and the OrdersCollectionByEmployeeID property. This is because only these two tables were selected and of course we checked the “Selected Tables Only” checkbox.

image

The Orders class above contains only the Employee hierarchical property for the same reason.

Without the “Selected Tables Only” checkbox

Finally, let’s regenerate with the “Selected Tables Only” un-checkbox and show you what the difference would be. When you leave the “Selected Tables Only” checkbox un-checked the hierarchical object model will include all of the related objects regardless of what tables you have selected (this is currently how it works).

image

The Orders table hierarchical properties would be as follows.

image

This feature is already implemented and will be included in our next release and is one of the items requested in our Q3 Wish list forum. This can come in real handy when your database contains many tables and you only want a subset of them in your hierarchical object model. This can also be very useful in DotNetNuke development if you wanted to include the users and roles tables only for instance and not have to include all of the other tables they reference (due to the hierarchical properties). We are working through the Q3 Wish list and implementing the requests quite rapidly.

EntitySpaces

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, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Saturday, July 11, 2009 7:51:01 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Thursday, July 09, 2009
image

When we moved from ES2008 to ES2009 we didn’t update our Getting Started PDF, however, that has now been rectified. This document can be of great help to those just downloading EntitySpaces or even those who have been customers for some time and want to know more about all of the options on the Advanced Tabs for instance. This document is up-to-date with our current Alpha as well. The Getting Started PDF is available on our home page under the “Documentation” menu and will be included in all future releases and available under your “EntitySpaces 2009” menu after installation.

You can download and view the documentation by clicking on the link below.
http://www.entityspaces.net/documentation/GetStarted.pdf

Of course as always your feedback is welcome.


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, a Silverlight application, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Thursday, July 09, 2009 10:49:27 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Wednesday, July 08, 2009
kick it on DotNetKicks.com

Okay, we finally got it!! We can honestly say getting a grip on Silverlight has been a real learning curve for our team, but it’s going to be a breeze for EntitySpaces customers because we’ve done all the research and laid all of the track. Our first approach was to use strings for everything because we didn’t want to use the “brain dead” proxies created by Visual Studio when you add a service reference to a Silverlight project. Then we figured out how we could force Visual Studio to use our client side proxies when adding a service reference. This is truly awesome. I cannot imagine a better way to write Silverlight applications than with EntitySpaces. What we are about to show you is so easy it will floor you. We will also be making a video on this and making our demo available with a future alpha or beta version. Okay, enough hype, show us already !!

image

Above, is our Silverlight Solution that contains everything needed to run the entire demo. Notice first, that we have all of the EntitySpaces runtime projects included rather than just references to the dlls (EntitySpace.Core35, etc.). We do this as we develop so we can debug and fix things if need be. Naturally, these project references are not required in your solution. You only need to add the runtime dll references to the project which houses your WCF service, EntitySpaces.SilverlightApplication.Web in this case.

Also notice the first project in the red box, EntitySpaces.Proxies.Silverlight. This is simply a Silverlight class library that we added to our solution. Then we generated our client side proxies into that solution. So now we have our client side proxies housed in a Silverlight class library. We could have just added these to our SilverlightApplication but there is a very important reason we didn’t. More on this later. These are generated via our Client Side Proxy Stub Template.

Next we have the SilverlightApplication project itself. This is the Silverlight application that runs in the browser. It references our EntitySpaces.Proxies.Silverlight class library that houses our client side proxies, and it references the EntitySpaces.DynamicQuery.Silverlight assembly because we want to be able to run full “es” DynamicQueries under Silverlight. Of course this project also contains our Page.xaml.cs file which contains our code that executes everything under Silverlight, we’ll be looking at that in a moment.

Finally, we have our EntitySpaces.SilverlightApplication.Web project which houses our WCF service in a web application. The two important files we’ll be looking at here are the INorthwind.cs file and the Northwind.svc.cs file.

Let’s start with the WCF Service

image

We have two methods. GetEmployees takes a serialized query in string form (the only time we have to use strings is with a query) and returns the data through our server side proxy class “EmployeesCollectionProxyStub”. Our Save method takes and returns a server side “EmployeesCollectionProxyStub” as well. The server side proxy stubs are generated via the Generated Master template. You indicate that you want them created via the Proxy/Stub tab as shown below. Also, be sure and check the “Serializable Queries” checkbox on the advanced tab.

image 

 

You can see how simple our WCF Service is in this example. Let’s look at the Northwind.svc.cs file.

image

First, look at the second method, our SaveEmployees() method. Could this be any easier? Not only do you not have to worry about which rows are added, modified, or deleted, but you can simply call Save, and return the very same collection. All new records, including their identity columns and such, will be returned to the Silverlight application so it can update it’s grid (in our case).

The GetEmployees method is a little more complicated, but not by much. It merely deserializes the string (a serialized proxy query) into a full blown EmployeesQuery, asks the EmployeesCollection to load it, then creates an EmployeesCollectionProxyStub class, passing in the EmployeesCollection, and returns it. Pretty simple really.

The Silverlight Application Logic

Let’s take a look at what our Silverlight Application looks like.

image

What the demo application does is create an EntitySpaces DynamicQuery when the user clicks on the Search button, calls our WCF service method GetEmployees(), then populates the grid with the data. The user can edit the data in the grid, and then merely click the Save button, which calls the WCF service method SaveEmployees(). Again, pretty simple.

So let’s look at our page.xaml.cs file. (We’ve removed any error handling to make the screen shot smaller.)

image

Notice in SearchButton_Click we create a EmployeesQueryProxyStub and use it exactly as we do with our full server side DynamicQuery objects, only we cannot load it directly. It must be serialized and sent to the server. In the last line of that method, we call our WCF service method GetEmployees().

In service_GetEmployeesCompleted() we assign e.Result to “employees”, which is our client side EmployeesCollectionProxyStub object, then we bind to employees.Collection, and our grid is populated.

Now, in the save button click event we intentionally set the first rows’ name to “GoogyGaga”, then add an additional Employee just for kicks, and call our WCF service method SaveEmployees(), which returns a refreshed collection, which we again assign to “employees”, and rebind the grid.

That’s it folks. An entire Silverlight application using EntitySpaces, showing both sides of the conversation. EntitiySpaces not only provides the glue between Silverlight and WCF, but it also provides all of the database access as well. All generated in mere seconds from your database schema via our Visual Studio Add in. Does it get any better than this?

Making Visual Studio Use the EntitySpaces Proxies instead of Visual Studio Generated Proxies

This is very cool indeed. We do not want to use Visual Studio generated proxy classes because they do not maintain row state for us (and other things). Our client side proxies maintain what rows are modified, added, and deleted such that you can send the entire collection back to the server and simply call Save() on it and bingo, it’s in the database. Here’s the trick. Remember the EntitySpaces.Proxies.Silverlight class library that houses our client side proxies? Well, there’s a reason we needed to have it housed in it’s own Silverlight class library and that is so we could tell Visual Studio to use it rather than generate proxies for us. Here’s how you do that when adding your Service Reference to the Silverlight application.

image

This is how we add our reference above. However, the trick to forcing Visual Studio to use our client side proxies is performed by pressing the “Advanced …” button.

image

Notice here that we tell it to reuse the types in our EntitySpaces.Proxies.Silverlight assembly. This is totally awesome. It’s great that Visual Studio allows us to do this. But even better, we were somewhat ahead of our time. Our client side proxies easily serialize into our server side proxies and vise versa. This is exactly what the DataContractSerializer is all about. It allows you to have different classes on each side of the conversation, and it works wonderfully in EntitySpaces.

Summary

This may seem like a lot to soak in but it really isn’t. We’ll be shipping our Silverlight demo hopefully with our next Alpha. Writing Silverlight applications is so graceful using EntitySpaces. Sure, you’re going to need to learn XAML and other things but all of the plumbing, wiring, and track have been laid for you. EntitySpaces has terrific Silverlight support. Everything you see here in this blog post works in our current alpha version. It’s late and we need to get some sleep, we are really jazzed about this and if anything we are understating how fantastic EntitySpaces is at providing the glue between Silverlight and WCF.

EntitySpaces

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, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Tuesday, July 07, 2009 11:43:13 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Sunday, July 05, 2009

kick it on DotNetKicks.com

[UPDATED – SEE EntitySpaces, Silverlight, and WCF a Fantastic Combination FOR OUR NEW AND FAR SUPERIOR APPROACH]

Besides the enhancements mentioned in the DynamicQuery Enhancements post, this release addresses some important issues discovered in our previous alpha concerning Silverlight and WCF. You should uninstall the prior alpha before upgrading. Our Silverlight assembly is now named EntitySpaces.DynamicQuery.Silverlight.dll. There is, also, a new class called esDataContractSerializer (available in the .NET 3.5 assemblies) that can be used in any WCF or Silverlight application. Take a look at the code sample below which demonstrates an entire conversation from Server to Client and back to the Server again.  Using this approach all of your methods would use strings to send data to and receive data from the server. Of course, you can use the auto generated proxy classes created by Visual Studio but the nice thing about this approach is that the row-state of all of the data is maintained automatically and then saving becomes trivial.

public void TestCollection()
{
    EmployeesCollection coll = new EmployeesCollection();
    coll.Query.SelectAllExcept(coll.Query.Photo);
    coll.Query.es.Top = 3;

    if (coll.Query.Load())
    {
        // Create Our Server Side Proxy Stub
        BusinessObjects.EmployeesCollectionProxyStub server = new BusinessObjects.EmployeesCollectionProxyStub(coll);

        // Serialize it into a XML string and return this string to our Silverlight or WCF Client
        string xml = esDataContractSerializer.ToXml(server);

        // Deserialize the string above into our Client Side Proxy under Silverlight or our WCF Client
        Proxies.EmployeesCollectionProxyStub client = esDataContractSerializer.FromXml(xml, typeof(Proxies.EmployeesCollectionProxyStub))
            as Proxies.EmployeesCollectionProxyStub;

        // Set a property and notice that esRowState goes to Modified
        client.Collection[0].LastName = "Squarepants";

        // Serialize our Client Side Proxy into xml and send it back to the server
        xml = esDataContractSerializer.ToXml(client);

        // Deserialize it on the server back into a Server Side Proxy Stub, the esRowState is modifed as we would expect
        BusinessObjects.EmployeesCollectionProxyStub server1 = esDataContractSerializer.FromXml(xml, typeof(BusinessObjects.EmployeesCollectionProxyStub))
            as BusinessObjects.EmployeesCollectionProxyStub;

        // Now save the Entity
        server1.GetCollection().Save();
    }
}

You can also use this same approach with the single entity based proxies. For example, the EmployeeProxyStub class.

Some Silverlight / WCF Code

The PopulateEmployees() method below is the method that populates the grid in our soon to be released Silverlight demo. The method executes under Silverlight after the user types in his search criteria and hit’s the Search button. Notice that the query classes (both proxy and full server) contain their own ToXml / FromXml methods. This is because when we serialize and deserialize queries we are doing so for complex object graphs with circular references. This is more complex than what our esDataContractSerializer class is designed for.

private void PopulateEmployees()
{
    try
    {
        NorthwindClient.NorthwindClient service = new NorthwindClient.NorthwindClient();

        Proxies.EmployeesQueryProxyStub q = new Proxies.EmployeesQueryProxyStub("emp");
        q.Select(q.EmployeeID, q.FirstName, q.LastName, q.Title, q.HomePhone, q.HireDate, q.BirthDate);
        q.Where( q.FirstName.Like("%" + SearchTextBox.Text + "%") | q.LastName.Like("%" + SearchTextBox.Text + "%"));
        q.OrderBy(q.LastName.Ascending);
        q.es.Top = 5;

        // Notice we send the XML representation of the Query to the Server via the Async call “GetEmployees”
        service.GetEmployeesCompleted += GetEmployeesCompleted;
        service.GetEmployeesAsync(Proxies.EmployeesQueryProxyStub.SerializeHelper.ToXml(q));
    }
    catch (Exception exc)
    {
        Console.WriteLine(exc.StackTrace);
    }
}

The above code has called GetEmployees (a WCF service method on the server). This is what our WCF Service method on the server that receives the query looks like.

public string GetEmployees(string serializedQuery)
{
    List<Type> types = new List<Type>();
    types.Add(typeof(EmployeesQuery));

    // Deserialize our EmployeesQueryProxyStub class into our full blown server side query so we can execute it
    EmployeesQuery employeesQuery = EmployeesQuery.SerializeHelper.FromXml(
        serializedQuery, typeof(EmployeesQuery), types) as EmployeesQuery;

    EmployeesCollection employeesCollection = new EmployeesCollection();
    if (employeesCollection.Load(employeesQuery))
    {
        // Okay, we have loaded it, lets send the results back in string form
        EmployeesCollectionProxyStub proxy = new EmployeesCollectionProxyStub(employeesCollection);
        return esDataContractSerializer.ToXml(proxy);
    }

    return null;
}

Back under Silverlight in the browser our async GetEmployeesCompleted method is called, and we bind the data to the grid.

void GetEmployeesCompleted(object sender, GetEmployeesCompletedEventArgs e)
{
    try
    {
        WaitText.Visibility = Visibility.Collapsed;

        string serializedEmployees = e.Result;

        // Turn the XML into a Proxies.EmployeesCollectionProxyStub collection
        Proxies.EmployeesCollectionProxyStub employees = esDataContractSerializer.FromXml(
            serializedEmployees, typeof(Proxies.EmployeesCollectionProxyStub)) as Proxies.EmployeesCollectionProxyStub;

        // Now Databind
        EmployeesDataGrid.ItemsSource = employees.Collection;
    }
    catch (Exception exc)
    {
        Console.WriteLine(exc.StackTrace);
    }
}

This approach offers some real advantages. You can later send the serialized collection back to the server with added, updated, and deleted rows. Once on the server, deserialize it, and simply call Save on the full server side collection. This is because our proxies maintain the rowstate for you. We are still working out the kinks as we build our Silverlight application. The one problem we have right now is the Silverlight grid seems to revert back to the original data and lose our cell edits. However, this happens with the Visual Studio proxies as well. Once we get this issue resolved and are fully saving data, we will publish our Silverlight demo. If you want to use this technique, you will need to generate the client side proxies and include them in your Silverlight or WCF client application. Be sure and click the new checkbox named “Serializable Queries” on the Advanced Tab of the Generated Master template. However, as you can see from the DynamicQuery Enhancements post, we are doing more than just addressing Silverlight and WCF development.

The bug that was affecting project files has been fixed. This occurred if you edited a template instance in an existing project, and saved without visiting all of the tabs. With this fix, un-visited tabs no longer revert to their default values. There is also a Twitter toolbar button on the What’s New page so you can easily get to our Twitter page. This alpha still only supports Microsoft SQL Server.

EntitySpaces

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, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Sunday, July 05, 2009 10:49:49 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Saturday, July 04, 2009

We have greatly improved the power of our DynamicQuery API, and there is still much more coming before our next official release goes into production. This is just a quick blog post to show some of the upcoming enhancements.

Full Expressions in OrderBy and GroupBy

This query doesn’t really make sense, but we wanted to show you what will be possible in the next release.

EmployeesQuery q = new EmployeesQuery();
q.Select(q.LastName.Substring(2, 4).ToLower());
q.OrderBy(q.LastName.Substring(2, 4).ToLower().Descending);
q.GroupBy(q.LastName.Substring(2, 4).ToLower());

EmployeesCollection coll = new EmployeesCollection();
if (coll.Load(q))
{
   string s = q.es.LastQuery;
}

The SQL Generated is as follows (and works)


SELECT SUBSTRING(LOWER([LastName]),2,4) AS 'LastName'
FROM [Employees]
GROUP BY SUBSTRING(LOWER([LastName]),2,4)
ORDER BY SUBSTRING(LOWER([LastName]),2,4) DESC

In the current production release 2009.1.0209.0, you can only use a “Column Name” in the OrderBy and GroupBy statements. In the upcoming release, you will be able use full expressions, just as you can now do in the Select statement.

Raw SQL Injection Everywhere

There may be times when you need to access some SQL feature that is not supported by our DynamicQuery API. But, now having used and fallen in love with DynamicQuery, the last thing you want to do is stop and go write a stored procedure or create a view. We have always supported the raw injection feature in our Select statement, but it will soon be available almost everywhere. The way it works is you pass in raw SQL in the form of a string surrounded by < > angle brackets. That indicates to the EntitySpaces dataproviders that you want the raw SQL passed directly to the database engine “as is”.

Here is an example query. You would never write a query like this in reality. EntitySpaces supports this simple query without having to use < > angle brackets. This is just to show all of the places that can accept the raw SQL injection technique:

EmployeesQuery q = new EmployeesQuery();
q.Select("<FirstName>", q.HireDate);
q.Where("<EmployeeID = 1>");
q.GroupBy("<FirstName>", q.HireDate);
q.OrderBy("<FirstName ASC>"); 

EmployeesCollection coll = new EmployeesCollection();
if (coll.Load(q))
{
    string s = q.es.LastQuery;
}

The SQL Generated is as follows (and works)

SELECT FirstName,[HireDate] AS 'HireDate' 
FROM [Employees] WHERE (EmployeeID = 1)
GROUP BY FirstName,[HireDate]
ORDER BY FirstName ASC

Of course, you could easily write the above query without injection, but you get the idea. The escape hatch will be available to you almost everywhere ….

EmployeesQuery q = new EmployeesQuery();
q.Select(q.FirstName);
q.Where(q.EmployeeID == 1);
q.OrderBy(q.FirstName.Ascending);
q.GroupBy(q.FirstName, q.HireDate);

Using the raw SQL injection techniques above will allow you to invoke SQL functions that we don’t support, including database vender specific SQL, and so on. Hopefully, you will almost never have to resort to writing a custom load method to invoke a stored procedure or an entirely hand written SQL statement. Of course, you can use our native API everywhere and just inject the raw SQL on the GroupBy for instance. You can mix and match to get the desired SQL.

There’s much more to come in this release …  Just last night we were serializing DynamicQuery’s from a Silverlight application and sending them to a WCF server to fetch the data… very slick. Watch for an upcoming blog post on our Silverlight demo very soon.

EntitySpaces

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, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Saturday, July 04, 2009 11:06:11 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Tuesday, June 16, 2009

This stuff is hot guys and gals. We are asking Jon Davis to write an entirely new Silverlight demo that will showcase our DynamicQuery feature running under Silverlight inside the browser and hitting a WCF service on the server. We cannot wait, this is so slick … Here’s another sneak peak post.

First the Client Code

Notice here we are using new “QueryProxyStub” classes that are available in through our proxy template (in addition to the existing single object and collection).

Proxies.OrdersQueryProxyStub o = new Proxies.OrdersQueryProxyStub("o");
Proxies.EmployeesQueryProxyStub q = new Proxies.EmployeesQueryProxyStub("emp");
q.Select(q.LastName.ToLower().Substring(2, 4), o.Freight, (q.FirstName + "," + q.Address).As("Mike"));
q.LeftJoin(o).On(q.EmployeeID == o.EmployeeID);
q.Where(q.EmployeeID > 30);
q.es.Top = 50;

// Manually convert it (you won’t need to do this)
string xml = q.Serializer.ToXml();

Their is a new property on the Query called Serializer than can help with certain serialization issues, for the most part however you shouldn’t have to use it. But it’s nice to have around, above we serialize our query to XML via the WCF DataContractSerializer (the entire object graph) via the ToXml() method.

 

Now the Server Code Deserializing (Simulated)

Notice below that we deserialize the XML from our QueryProxyStub classes into our full blown server side Query classes so that we can execute them. In reality the code that you will write on the server will be much simpler than the code shown below. You will use the KnownTypeAttribute on your WCF Service methods. We will have a full sample showing how this works, don’t let the code below scare you, it’s so easy. This is just test harness code but it works just fine.

using (MemoryStream memoryStream = new MemoryStream(Encoding.Unicode.GetBytes(xml)))
{
    using (XmlDictionaryReader reader =
        XmlDictionaryReader.CreateTextReader(memoryStream, Encoding.Unicode,
        new XmlDictionaryReaderQuotas(), null))
    {
        types = new List<Type>();
        types.Add(typeof(EmployeesQuery));
        types.Add(typeof(OrdersQuery));

        EmployeesQuery emp = new EmployeesQuery();
        DataContractSerializer dcs = emp.Serializer.GetSerializer(types);

        // Deserialize
        emp = dcs.ReadObject(reader) as EmployeesQuery;

        EmployeesCollection coll1 = new EmployeesCollection();
        if (coll1.Load(emp))
        {
            // It worked
        }
    }
}

At this point we could return the newly loaded collection back to the client and it would implicitly be returned as a ProxyCollection.

The Demo

We hope to have an entirely new Silverlight / WCF Demo available to coincide with and built from the upcoming Alpha release. Of course will we do a blog post on that as well. When you see it in action you will be amazed how easy it is. We still have a few issues to work out but things are moving very rapidly now. Imagine having what appears to be the full EntitySpaces API available to you on a client somewhere and only needing to have a single 52k assembly present, and it is fully Silverlight compliant as well. This is just one thing our upcoming release will provide.

EntitySpaces

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, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Tuesday, June 16, 2009 10:40:36 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Sunday, March 01, 2009
kick it on DotNetKicks.com     Shout it

Can you Query me now?mobile (Silverlight, WCF, Webservices, and Mobile)

EntitySpaces 2009 Q2 is going to revolutionize your ability to use the EntitySpaces 2009 architecture on the client side of any two-way conversation, whether it be a Silverlight, WCF, or a webservices conversation. In fact, you will be able to work on the client side as if the full EntitySpaces architecture was at your disposal but without actually requiring the EntitySpaces architecture be present on the client. "But how can that be?" you wonder. Continue reading and we will explain.

EntitySpaces has always had good support for mobile applications via our Compact Framework support. We even generate "smarter" proxies than the ones generated by Visual Studio for WCF or webservices scenarios. Our proxies maintain row state such as (inserted, updated, and deleted) such that all that is required is that you send the data back to the server and commit it.  But this client side proxy support is about to become much, much more powerful and can be used for non-mobile scenarios such as Silverlight, WCF, and webservices. With our enhanced proxies (especially for mobile applications where space is limited) this can prove to be a very powerful way to use EntitySpaces. We like to think of this as a sort of "Virtual EntitySpaces Mode" as it feels just like EntitySpaces only it really doesn't require the full architecture on the client side. So, let's dive into this and see how it works starting with a review of our current proxy support.
 

Our Current Client Side Proxy Functionality

The EntitySpaces Client Side proxies offer the ability to easily work with EntitySpaces on the client side of a two way conversation without requiring any of the EntitySpaces assemblies. Our proxies also track the dirty state for you so that when you send data back to the server EntitySpaces automatically knows whether to insert, update, or delete the data. This functionality is already built into the currently shipping ES2009 Q1 release. The template that you use to create the Client Side proxies is highlighted below.

ProxyStubTemplate

When you execute the "Client Side Proxy/Stub" template there are currently two classes generated for you, the Collection and Entity class. Shown below are the proxy stub classes that were generated by the "Client Side Proxy/Stub" template for the Microsoft Northwind Suppliers table. Notice that the classes do not inherit from any base classes nor do they require any of the EntitySpaces assemblies. Also, in the SuppliersProxyStub (entity) class notice the esRowState property. This is the property that EntitySpaces uses to determine the state of the entity (inserted, updated, or deleted) and the proxy is smart enough to set this property for you based on the actions you take (you do not have to worry about setting it). These two classes are extremely small and lightweight in size.

proxystub1

With these two classes you work with data on the client side of a conversation without EntitySpaces being present, but something is missing, a feature that hooks most EntitySpaces developer once they start using it.

New Functionality Coming in ES2009 Q2

In our ES2009 Q2 release the Client Side template will now generate a new, optional, third class, the "QueryProxyStub" class. Yes, you guessed it, the full EntitySpaces DynamicQuery API now available on the client side of a two-way conversation. Take a look at the SuppliesQueryProxyStub class below. This class is just like the DynamicQuery classes you are accustomed to using already only it inherits from a new class named esDynamicQuerySerializable. If you take a close look at the methods in the esDynamicQuerySerializable class you will notice that there are no methods to load or execute the query itself (more on this later). This query can only be created, defined, and then serialized back to the server (a very cool way to write a Silverlight application). If you have never seen how powerful our DynamicQuery API is check out our Showcase post HERE.

proxystub2

Now, imagine that you're on the client side of a WCF conversation or even running down inside the browser in a Silverlight application and you need to query your Supplier table for data. No problem, here is how you would accomplish that task with the new proxy query class.

SuppliersQueryProxyStub sQuery = new SuppliersQueryProxyStub ();
sQuery.Select(sQuery.SupplierID, sQuery.Region);
sQuery.Where(sQuery.Country == "Spain");

Notice that we do not call sQuery.Load(). This is because the esDynamicQuerySerializable has no way to actually load data, it represents the query only, the ability to load it (or execute it) exists on the server side of the conversation. Also, the full join syntax is available although it is not shown above in the query. The proxy queries are fully serializable which is the key to how it works. At a very high level this is how you would fetch data from the server, imagine a method like this:

public SuppliersCollectionProxyStub FetchSupplers(SuppliersQueryProxyStub query)

You would transmit the proxy stub query to the server, where it will be deserialized, assigned to a full server query object, executed, and then the resulting proxy stub collection would be returned. The code will look very much like this.

public SuppliersCollectionProxyStub FetchSupplers(SuppliersQueryProxyStub query)
{
    SuppliersCollection coll = new SuppliersCollection();
    coll.Query = query as esDynamicQuerySerializable;
    coll.Query.Load();

    // more code below ...
}

Notice how we are able to merely assign our SuppliersQueryProxyStub object to the full blown SuppliersCollection's query object and then execute it. Could it be any easier?

EntitiySpaces.DynamicQuery - A New Assembly

Just where does this esDynamicQuerySerializable class that our SuppliersQueryProxyStub inhertis from live? The answer is a new assembly that will ship with ES2009 Q2 named EntitySpaces.DynamicQuery.dll. This is very tiny (less that 50k) assembly that only references System.Core and System.XML and is fully Silverlight 2.0 compliant. It does not link with EntitySpaces.Core or EntitySpaces.Interfaces. However, even better we are not maintaining two separate DynamicQuery API's. This new assembly and class is used on the server side as well, which means this new assembly is required now for EntitySpaces applications. Look at the diagram below which shows the hierarchy of a normal DynamicQuery class as generated by the ES2009 Q2 Generated Master template. This preserves your current API.

proxystub3

Notice the the original base class esDynamicQuery is still there, however, it now inherits from the esDynamicQuerySerializable class. In order to run under Silverlight our client side DynamicQuery assembly could not reference the System.Data namespace, so we have separated the original esDynamicQuery into the two classes you see above.

What Does it All Mean?

Our new enhanced client side proxies will allow you to have a "Virtual EntitySpaces Architecture" running almost anywhere including mobile devices, Silverlight applications, WCF scenarios, and webservices. It will act and feel just like EntitySpaces Of course, we can already run in all of these environments but with ES2009 Q2 and the addition of the DynamicQuery proxy and the massive DynamicQuery API enhancements that are also coming you will truly be blown away by the productivity and reach of the EntitySpaces Architecture. The only thing that is required on the client to make this all possible is the tiny EntitySpaces.DynamicQuery assembly (less than 50k) which is completely Silverlight compliant. There are other enhancements that will be made to the proxies but we will keep them small and lightweight.

There are also a few technical issues we must solve yet, though most have been worked out. For example, where do the extra properties go when you bring them back via a join? In the full server side classes this is handled gracefully, and we make those properties appear as if there are in your strongly typed entities via sophisticated binding support. How do we do this on the client side? These are a few of the issues we must solve yet.

We find this new support terribly exciting and it presents almost boundless usage scenarios. Especially when you factor in the enhancements we are making to DynamicQuery API itself, but that is the topic for another post. And keep those comments coming in our ES2009 Wish List forum, we are listening and will implement a lot of your requested features.

EntitySpaces

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, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Sunday, March 01, 2009 1:31:36 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Tuesday, February 24, 2009
kick it on DotNetKicks.com     Shout it

EntitySpaces is pleased to announce support for the Sybase SQL Anywhere Database Management System. Our plan is to support iAnywhere for both high end server applications as well as on the Compact Framework for mobile applications which will further strengthen EntitySpaces' mobile abilities (we already support Microsoft SQL CE and VistaDB for mobile applications). If there is demand we will consider supporting the Sybase SQL Anywhere UltraLite version as well.


SQL Anywhere provides data management and exchange technologies designed for database-powered applications that operate in frontline environments without onsite IT support. It offers enterprise-caliber features in a database that is easily embedded and widely deployed in server, desktop, remote office and mobile applications. Sybase iAnywhere has been named number one in the worldwide mobile device management enterprise software market for the seventh consecutive year.

sybase

The image above shows EntitySpaces 2009 walking the SQL Anywhere Demo Database metadata. We have already generated a full EntitySpaces set of classes complete with our hierarchical object model against the Sybase demo database and have created an EntitySpaces.SybaseSqlAnywhereProvider.dll DataProvider that can successfully query Sybase using our DynamicQuery API. For instance, we are able to execute queries like this just fine.

EmployeesCollection coll = new EmployeesCollection();
coll.Query.Select(coll.Query.DepartmentID, coll.Query.City);
coll.Query.Where(coll.Query.City.Like("%F%"));
coll.Query.Load();

Of course, our Sybase support will have to fully pass our massive NUnit test suite before being released which won't actually happen until our ES2009 Q2 release. But we have made enough progress now that we can safely announce our support for Sybase. We would also like to thank the folks at Sybase for working with us and making themselves available to us. We are extremely impressed by their support and dedication to customer satisfaction, something rarely seen today from large companies, so a big thumbs up to the folks at Sybase.

EntitySpaces

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, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Tuesday, February 24, 2009 10:46:20 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Wednesday, February 18, 2009

Nick Dunham, an EntitySpaces user, created a very nice PDF and sent it to us. We thought it was great and decided to share it on our blog. Here is a snippet from the document ...

EntitySpaces 2009 (ES) works great for setting up and running projects from within Visual Studio (VS). Once I have a project set up, I can execute it by opening “Tools | EntitySpaces”, load my project, and go. As a companion to this, I started using the new command line version of EntitySpaces so I could skip the basic steps (once I configured my project with the tool). The setup instructions below allow me to execute an ES project using the External Tools features of VS ...


Checkout the PDF file HERE or a ZIP file HERE. It's best viewed when zoomed to around 150% to 175% depending on your monitor size.

Nick W. Dunham, University of Florida
Office of Research, Director of Information Services


EntitySpaces

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, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Wednesday, February 18, 2009 7:52:12 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Sunday, February 15, 2009

We have created a video to demonstrate the usage of our EntitySpaces 2009 Projects Files. Watch the video and project files will quickly become one of your favorite features of our Visual Studio Integration.

Please give the video a few moments to load.

 

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, a Mono application, 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.

EntitySpaces

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Sunday, February 15, 2009 3:31:40 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Monday, February 09, 2009
kick it on DotNetKicks.com      Shout it

EntitySpaces 2009 Persistence Layer and Business Objects for Microsoft .NET

We are pleased to announce the official release of EntitySpaces 2009 Q1. The version number is 2009.1.0209.0. The Trial Version has also been upgraded to the official release. EntitySpaces 2009 Q1 is a terrific product, if you have been using our beta or our release candidate then you know EntitySpaces 2009 feels like putting on your favorite pair of jeans, it's just feels right. No longer are we dependent upon third party code generation tools and this frees us up to be really creative.  EntitySpaces 2009 is also very high performance as it contains the performance enhancements we made at the tail end of 2008. Customers who have source code access will be able download it within a few days.

ES2009_Download

Features of EntitySpaces 2009:

  • Complete Visual Studio integration.
  • Stand alone executable for those not using Visual Studio.
  • No third party code generation tools required (No need for MyGeneration or CodeSmith). 
  • Project files to record and play back your code generation process with a single click.
  • Command line tool that can execute your EntitySpaces projects in continuous integration builds.
  • Debugger Visualizer and other debugging enhancements.
  • Totally updated Web Admin Templates.
  • Lots of samples available on the EntitySpaces 2009 menu after installation including:
    1. EntitySpacesDemo (C#) - Windows Forms
    2. EntitySpacesDemo (VB) - Windows Forms
    3. SqlCeDemo (Mobile Application) - SQL CE Mobile Application
    4. esDataSource (C#) - ASP.NET Web App, uses the esDataSource DataSourceControl
    5. esDataSource (VB) - ASP.NET Web App, uses the esDataSource DataSourceControl
    6. WCF Demo (C#) - Very extensive WCF Demo using our Full and Lightweight Proxies
    7. Template User Interface (C#) - Demonstrates how to extend our templates without actually modifying our UI

Fixes since the Release Candidate:

Below are the fixes and enhancements that have been made since the release candidate.

  • The SQL CE connection problem has been fixed.
  • The VistaDB connection hang on a bad connection string has been fixed.
  • DebuggerVisualizer capability is now included.
  • DebuggerDisplay attributes is now supported.
  • The Smiley Face icon is no longer our icon in Visual Studio.
  • There is a new sample demonstrating how to expand our template user interfaces.

Installation Instructions For those who have it already installed

  • Close Visual Studio
  • Uninstall your current version of ES2009 (you will not lose your connection settings)
  • Open Visual Studio - Answer yes to disable our Plug-in
  • Close Visual Studio
  • Install the official ES2009 Release

Finally, we would like to thank our customer base for all of the great and well thought out suggestions we are getting for ES2009 Q2 in our "Q2 Wish List" forum. We are very impressed with the thought and detail you are putting into your posts. If you are a potential custom looking at our forums those are the unanswered posts you see in our forums.

EntitySpaces

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, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Monday, February 09, 2009 11:21:43 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Saturday, February 07, 2009

While we were adding the Debugging Visualizer logic we went ahead and added DebuggerDisplay Attributes on the Collection, Query, and Entity classes. This really helps when you look at things in watch windows. Below is a quick preview of some new enhancements coming in the official ES2009 Q1 released scheduled to be out this weekend if all goes well.

debug1

Notice the last two checkboxes (above) on the "Generated Master" Advanced tab. The DebuggerDisplay option is turned ON by default. The DebugVisualizer is OFF by default as it requires that you link to an additional assembly, but it's very cool see part one.

Here is the code we executed. Once the collection was loaded and our breakpoint was hit you can see how our watch window looks like below as well.

EmployeesCollection coll = new EmployeesCollection();
coll.Query.SelectAll();

if (coll.Query.Load())
{
    // Breakpoint here ...
}

This is our watch window ... (notice the Value column)

debug2

Notice the "coll" variable shows the Count as it's value and if we look at coll.Query property it shows the "LastQuery" value. Finally, if we index into the collection to look at actual entities you will see the entity type plus it's primary key value(s) - works for composite primary keys of course.

Well, back to work ....

EntitySpaces

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, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Saturday, February 07, 2009 2:43:55 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Thursday, February 05, 2009

Here is a sneak peak at our Debugger Visualizer for EntitySpaces 2009 that will be included in the official release. When inspecting variables in the debugger you will notice that there is now a magnifying glass next to your EntitySpaces collections as shown in the image below. Notice the magnifying glass on the BusinessObjects.EmployeesCollection.

visualizer1

When you select the EntitySpaces Debugger Visualizer you will be presented with this window which will display the contents of your collection. Remember, this all happens when you are debugging.

visualizer2

You can sort, rearrange columns, and see the dynamic query (if any) that was used to fetch the data. This could be a useful feature when developing your EntitySpaces applications. This does require that you check an additional checkbox on the "Generated Master" template and then link your application with our EntitySpaces.DebuggerVisualizer.dll. There is no performance issue with generating your code like this, it's purely a debugging feature. This is a pretty simple debug visualizer however we will enhance it to support single entities and additional data in future releases.

[MODIFIED]

If you check the DebugVisualizer on the Advanced Tab of the "Generated Master" template here are the steps you need to follow:

  • Add a reference to the EntitySpaces.DebuggerVisualizer.dll assembly.
  • Add a reference to "Microsoft.VisualStudio.DebuggerVisualizers .NET 9.0.0.0".
  • Call the static method to initialize the Visualizer during your application startup, like this,  esVisualizer.Initialize().

However, we strongly recommend that you regenerate before you ship without the Visualizer checkbox checked and then you will not need to ship the Visualizer assembly (strongly recommened).  

EntitySpaces

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, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Thursday, February 05, 2009 10:04:34 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Wednesday, February 04, 2009

We have created a new forum so that we can solicit feedback from you in a specific place and not lose track of it. So here we go, if there are features, bugs, other databases you want supported you have a voice. If you have already made such a request somewhere else in the forums please post it in this new forum also to be sure it's on our radar. We have always been very customer driven and this will allow you even more input. Of course, not everything posted will get implemented, but your input will definitely have an impact on the next release. There are a few simple rules you can follow that we really help us out.

  1. Create a brand new post unless you can see your issue is clearly covered in another post (in this forum).
  2. Please present your idea clearly, post example code if need be, and be sure to use the code window if posting code.
  3. Please do not hi-jack existing threads and take them in totally new directions. This inevitably will happen, we understand, we expect some brainstorming in here so it's okay.
  4. Definitely ping or bump other posts that you agree with so that we know you also support the requested feature or fix.

We won't skew the input into this process by posting our roadmap or ideas for Q2 and thereafter, we want to hear from you.

EntitySpaces

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, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Wednesday, February 04, 2009 8:24:02 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Sunday, January 25, 2009

The Release Candidate for EntitySpaces 2009 has been published. The Version Number is 2009.1.0126.0. Here is what you will find that is either new or enhanced in the Release Candidate.

YOU MUST UNINSTALL ANY PRIOR VERSIONS OF ES2009 INCLUDING BETA III OR YOU "WILL" HAVE PROBLEMS. HOWEVER, YOU WILL NOT LOSE YOUR SETTINGS, JUST MAKE SURE YOU HAVE VISUAL STUDIO CLOSED UNTIL YOU HAVE UNINSTALLED AND INSTALLED THE RELEASE CANDIDATE.

 

  • A new very comprehensive WCF Sample is now included, the Readme can be seen ==> HERE.
  • There is now a VB version of the EntitySpacesDemo (thank you Martin).
  • The Web Admin Grids have now been fixed to work properly with Views.
  • The Settings tab now displays the EntitySpaces version number.
  • The EntitySpaces.CommandLine.exe tool is now included.
  • The esDynamicQuery has a new method named SelectAllColumnsExplicity() which will select all columns by name as opposed to Select *

Be sure to check the EntitySpaces 2009 menu after installation. Everything now is available from our menu, including all of our samples. You can choose them from our menu and they will compile cleanly right out of the box, no need to add references, just change the config file connection string and you're off.

EntitySpaces

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, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Sunday, January 25, 2009 7:17:11 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
NOTE: THIS IS THE READ ME FROM OUR NEW WCF DEMO INCLUDED IN THE ES2009 RELEASE CANDIDATE
 
Welcome to the

EntitySpaces 2009 Q1 WCF Demo

Created by Jon Davis for EntitySpaces, LLC

Contents

Introduction

This sample solution includes a set of projects that illustrate the use of EntitySpaces with Windows Communication Foundation (WCF), which is a technology featureset that arrived when Microsoft .NET 3.0 was released.

This demo is based on .NET 3.5 / Visual Studio 2008. It does not delve into WCF education or theory; it is only a "getting started" sample application that demonstrates how EntitySpaces objects can be used in a WCF architecture.

This is a lightweight sample that does not demonstrate more complex scenarios, such as working with data objects with one-to-many relationships.

Quick Start

This section is provided for those who just want to get the demo up and running and don't want to delve into the details.

To run the demo:

  1. Check the References of each project. If any of the EntitySpaces assembly references are broken (i.e. showing the "missing" icon), you will need to re-reference them. They should be in:
       %ProgramFiles%\EntitySpaces 2009\Runtimes\.NET 3.5\
  2. Make sure SQL Server Express is installed locally, and that you are a SQL Server admin. If the server is not running as ".\SQLExpress" you need to edit the app.config file in the ES2009WCF_Server project and rebuild the solution after reviewing #1 (above).
  3. In Visual Studio's Solution Explorer, right-click on the project called ES2009WCF_Server and choose Set as StartUp Project.
  4. Start Debugging. If you don't run into any errors and all is well, go ahead and shut it down (hit ENTER and let it quit).
  5. In Windows Explorer, track down the server's EXE file. It should be something like %DEMO%\ES2009WCF_Server\bin\Debug\ES2009WCF_Server.exe. Run it.
  6. In Visual Studio, for each of the client projects (each of the projects that are suffixed with "Client"), expand "Service References and right-click on the service reference item (should be something like "ESDemoService") and choose Update Service Reference.
  7. Stop the server process you started two steps previously (hit ENTER and let it shut down).
  8. Choose one of the client projects (any project suffixed with "Client") that you would like to run, right-click it, and select "Set as StartUp Project".
  9. Rebuild Solution.
  10. Start Debugging. The demo server will start automatically (after a prompt).

Troubleshooting:

  1. If with any client project you get an exception saying something followed by ".. The client and service bindings may be mismatched," stop the debugger, keep the server running, and right-click the service reference item in the project (in Solution Explorer) and choose Update Service Reference.
  2. If after the server starts successfully you get a System.ServiceModel.EndpointNotFoundException with a message "Could not connect to http://localhost:8731/ESDemoService/Light/. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8731," you will need to temporarily disable Windows Firewall or poke a hole on port 8731 and/or on behalf of all EXE's involved.
  3. Be sure to restart the demo server's .EXE (or just kill it and let the demo client start it) as it may get locked in a Faulted state if an exception occurrs.

To create WCF projects:

  1. With EntitySpaces DLLs referenced on the client:
    • You will be using the Full / Heavy Proxies on both client and server. These are included with EntitySpaces' Master template.
    • You should use a shared library to be used on both client and server containing your generated business objects.
    • WCF will automatically serialize/deserialize and bind to your EntitySpaces-based library.
    • You will be able to use the Query object using manual binary serialization. (You cannot use XML serialization of the Query object in the ES2009 Q1 release, but XML serialization is planned for Q2.)
    • For a service sample, refer to demo project ES2009WCF_Server, file Full->ESDemoService_Full.cs.
      • The service was created by right-clicking on the project, choosing WCF Service, and then replacing the DoWork() method with real methods, both on the interface file and on the class.
    • For a client sample, refer to demo project ES2009WCF_Full_ConsoleClient or ES2009WCF_Full_WinFormsClient.
      • The WCF client was bound by manually starting the server app (ES2009WCF_Server.exe) from Windows Explorer, right-clicking on the client project in Visual Studio, choosing "Add Service Reference...", entering the service URL as shown on the server app console (this is set in the server app's app.config), clicking "Go", expanding the tree, selecting the interface, and choosing OK.
      • By default, the Service Reference configuration has "Reuse types in referenced assemblies" checked.
  2. Without EntitySpaces DLLs referenced on the client:
    • You will be generating Lightweight Proxies for your clients. These are created from EntitySpaces' generator seperately by expanding the ProxyStub tree branch (in the Templates tab) and running the Client Side Proxy/Stub.
    • The server will still use the Full / Heavy Proxies; however, ...
    • You should plan on serializing/deserializing your objects manually, both on client and server. A wrapper class called XmlSerialized<T> is provided with the demo to make this easier.
    • You will not be able to use the Query object in the ES 2009 Q1 release.
    • For a service sample, refer to demo project ES2009WCF_Server, file Light->ESDemoService_Light.cs.
      • The service was created by right-clicking on the project, choosing WCF Service, and then replacing the DoWork() method with real methods, both on the interface file and on the class.
    • For a client sample, refer to demo project ES2009WCF_Light_ConsoleClient.
      • The WCF client was bound by manually starting the server app (ES2009WCF_Server.exe) from Windows Explorer, right-clicking on the client project in Visual Studio, choosing "Add Service Reference...", entering the service URL as shown on the server app console (this is set in the server app's app.config), clicking "Go", expanding the tree, selecting the interface, and choosing OK.
      • The sample app demonstrates how serialization/deserialization was performed with the lightweight proxies.

Pre-Setup

This demo requires SQL Server 2005 (Express, Standard, or Enterprise edition) to be installed and running on the machine you are running the demo on. (You can get SQL Server Express edition for free at http://www.microsoft.com/express/sql/default.aspx.)

Your SQL Server instance needs to recognize you as an administrator, as the demo server will auto-create the database and database tables when it runs. You can remove this behavior and create the demo database and table(s) manually by opening the app.config file in the ES2009WCF_Server project and changing the appSettings values of createDatabase and resetTableData to false.

If you do decide to create the database and table manually, here is how it should be configured. The database name should be ES2009WCFDemo. You should have the following table structure(s):

USE [ES2009WCFDemo]

/****** Object:  Table [dbo].[Employee]    Script Date: 01/21/2009 17:30:16 ******/
SET ANSI_NULLS ON

SET QUOTED_IDENTIFIER ON

CREATE TABLE [dbo].[Employee](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [FirstName] [nvarchar](50) NULL,
    [Age] [tinyint] NULL,
    [Salary] [money] NULL,
 CONSTRAINT [PK_Employee] PRIMARY KEY CLUSTERED 
(
    [Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

This is the same SQL script that is used automatically (if enabled) when the demo server is run .

You also need to validate the connection string in the app.config file under ES2009WCF_Server. By default it points to the server ".\SQLExpress".

Creating The Employee EntitySpaces Objects

The first thing that was done when creating this demo was the creation of an Employee database table and the EntitySpaces objects that work with it. The Employee schema is described previously (see Pre-Setup). The EntitySpaces objects were placed in a shared library that contains all business objects that can be used both on the server and in a full (EntitySpaces-referencing) client. This is database-secure because a client does not have a database connection string in the generated code nor in its config file, it only has WCF references if so architected.

To generate EntitySpaces objects,

  1. Open the EntitySpaces generator by selecting Tools -> EntitySpaces in Visual Studio.
  2. In the Settings tab, click Configure Connection and point the generator to the Employee database. For this demo, the following was used:
    • Server: .\SQLExpress
    • Security: Integrated Security
    • Database: ES2009WCFDemo
  3. In the Templates tab, expand Templates->EntitySpaces->2009->C# and then select Generated - Classes Master (C#)
  4. Click the green Execute button.
  5. In the dialog that comes up, under Select the Output Path enter the file path to the shared library project that will be used to keep EntitySpaces business objects.
  6. The Namespace should be the namespace for your shared library.
  7. The Connection Name should be the name that will be used on your server to identify the connection string.
  8. The Tables or Views and Select Tables will be automatically selected as Tables and Employee, respectively.
  9. Click into the Proxy/Stub tab. Check the Generate the Proxy/Stub option as well as Support WCF.
  10. You should also specify a custom DataContract URI.
  11. When you click on OK, the files will be generated in the Output Path you specified.
  12. Go to Visual Studio's Solution Explorer, click on the shared library project, and then click the Solution Explorer toolbar button called "Show All Files". You should see the Generated folder that EntitySpaces created. Right-click on it and choose "Include".

When using lightweight proxies/stubs, will need to run the generator again for the client project to create special lightweight proxies/stubs. Remember that lightweight proxies/stubs are used primarily if your shared library, as well as EntitySpaces' runtime libraries, will not be referenced by the client application. So in this case, the client will need generated stubs.

So to create the lightweight proxies/stubs for the client, follow the same steps as for creating the "Classes Master" objects, except:

  1. Instead of using the template Generated - Classes Master (C#), expand ProxyStub and select Client Side Proxy/Stub
  2. In the field Select the Output Path, enter the path to your client app project instead of the shared library which will not be referenced in your client app.

Creating The WCF Server

The WCF Server in this demo (project ES2009WCF_Server) is just a console application with ServiceHost. You can also host WCF services in IIS 7 or with WAS (Windows Activation Services) but that is beyond the scope of this demo; again, WCF education is not the intent with this demo but rather how EntitySpaces can work in a WCF architecture.

Initializing EntitySpaces For The WCF Server

Before doing anything with EntitySpaces within a server application, an app.config file needs to be created.

  1. Right-click the server app project in Solution Explorer and select Add Item...
  2. Select Application Configuration file. (Retain the default filename, app.config.)
  3. When the file is added to the project, click on the file in Solution Explorer, then under Properties set Copy to Output Directory to Copy if newer. Note: Visual Studio automatically renames this file to %assemblyname%.config in the output directory when the project is built.

After setting up the app.config file with EntitySpaces settings, the first thing our server app needs to do in order to work with EntitySpaces and with the database is initialize EntitySpaces with:

esProviderFactory.Factory 
    = new EntitySpaces.LoaderMT.esDataProviderFactory();

About The XmlSerialized<T> and BinarySerialized<T> Wrappers

Before moving on, it should be noted that there are a few scenarios where manual serialization must be used when working with EntitySpaces over WCF. While EntitySpaces business objects can be generated with WCF compliance, EntitySpaces was not built around WCF (WCF is a relatively young technology, and Visual Studio's and .NET SDK's generation of WCF stubs is not fully evolved to handle all scenarios). For example, the manual serialization is necessary to retain the behavioral functionality of the EntitySpaces objects such as change/dirtiness state on the client in the conformance pattern used by EntitySpaces.

Examples of manual serialization for WCF have been posted in the EntitySpaces forums and blog, namely

  1. here: EntitySpaces WebServices Example Application (with WCF implications)
  2. and here: Pure WCF Client Side Proxies

The samples provided prompted the creation of a pair of serialization wrappers that I, the creator of this demo, decided to produce both for this demo and for future use anywhere manual serialization/deserialization is needed.

I posted the wrappers and documented them on my own blog:

Jon Davis: XmlSerialized<T> and BinarySerialized<T>

These wrappers are used extensively throughout this demo, primarily:

  • BinarySerialized<T>, utilized for exposing the Query object over WCF for full proxy clients.
  • XmlSerialized<T>, utilized for exposing all lightweight proxies/stubs for the lightweight clients that do not reference EntitySpaces.

Creating The Full & Lightweight Proxy Services

To create a WCF service that exposes API points for clients, Visual Studio's WCF Service template items were used:

  1. Right-click on the server project in Solution Explorer and select Add -> New Item...
  2. Select WCF Service and give it an appropriate name.
  3. In the generated interface file (the file prefixed with an 'I'), replace the DoWork() method interface declaration with the methods that are appropriate for your service. (Don't forget to mark each method with the [OperationContract] attribute.)
  4. In the generated class file, just right-click on the interface name where the class name is declared, and select "Implement interface". You may want to remove the #region markers to keep it clean.
  5. The generated method stubs should look like the ones illustrated in the ES2009WCF_Server project, under the Full and Light directories.
    • The Full directory demonstrates a service that would be used for clients that can reference EntitySpaces runtime libraries and would therefore also reference a shared library that is referenced by both client and server.
    • The Light directory demonstrates a service that would be used for clients that do not reference EntitySpaces runtime libraries. These clients would need the lightweight proxies/stubs to be generated specifically for the client. For more information, see the earlier section Creating The Employee EntitySpaces Objects.

About The Server Demo Tests

Some simple tests were added to the ES2009WCF_Server project while creating the server just to make sure things are working. This isn't a TDD implementation but basic invocation of some of the services' API is demonstrated.

The Console-Based Full Proxy Demo Client

This client app will automatically start the WCF Demo Service.

The first client that was created for this demo was the Console-Based Full Proxy Client. This is just a console application that invokes some of the WCF API points. It was created to test and make sure that the WCF services were working correctly. The net result is a demonstration of code that illustrates how EntitySpaces can interact with a WCF service using full proxies.

The verbiage of "full proxies" used here means that the client has EntitySpaces runtime libraries referenced, as well as a shared library that contains the business objects used on the server. The client sees these objects in the same way as the server sees these objects. The only difference is that the client cannot invoke the database directly through the EntitySpaces API. Instead, WCF must be used to explicitly manage all queries using the API points established by the server's WCF services.

Note that the "full proxy" implementation partially supports binary serialization of Query objects so that you can perform a filtered query from a client over WCF. This is partially demonstrated in the demo app by filtering on the Employee's FirstName property.

The Console-Based Lightweight Proxy Demo Client

This client app will automatically start the WCF Demo Service.

The Console-Based Lightweight Proxy Demo Client is a complete API demonstration of the WCF service that was exposed for lightweight proxies. It does not reference EntitySpaces runtime libraries nor any shared libraries except for core .NET libraries and the project that contains the Serialized utility classes discussed earlier.

Note that the special proxy/stub classes were generated for this client and added to the client project.

The WinForms-Based Full Proxy Demo Client

This client app will automatically start the WCF Demo Service.

The WinForms-Based Full Proxy Demo Client is a rich GUI illustration of how WCF can be used in a client/server application. It automatically loads all employees, allows you to edit the details of an employee, allows you to delete an employee, and allows you to create an employee. It also demonstrates the use of a binary-serialized Query object by displaying a filter form with a name parameter and range parameters for Age and Salary.

Coming Soon: The WPF-Based Lightweight Proxy Demo Client

We will be working on a WPF-based client that demonstrates the use of the lightweight proxy/stub classes to be released hopefully in the near future.

When EntitySpaces 2009 Q2 is released we will also have XML-serializable queries as well as a fresh new updated Silverlight demo that illustrates its use. This, too, will utilize the lightweight proxy/stub classes that unfortunately the ES 2008 Silverlight demo [1, 2] did not properly illustrate as the proxy/stub classes were not generated for it.

Closing Comments

Hopefully this sample solution clearly demonstrates how EntitySpaces can work with WCF without any significant hassle.

Jon Davis produced this demo as an outside consultant. He is currently employed as a C#/NET Developer for a very prominent Internet services provider, but offers evening/weekend consulting services for both software and web solutions. He retains a blog at http://www.jondavis.net/techblog/.
posted on Sunday, January 25, 2009 6:15:03 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Thursday, January 15, 2009

The Developer Site

We are working hard on expanding our new developer site and you should definitely begin to use this site. The search feature is very good. More and more on our forums we will be pointing you to the developer site. All of the samples are provided in C# and VB.NET. Two recent additions include:

  • EntitySpaces 2009 Application Documentation

http://www.developer.entityspaces.net/documentation/EntitySpaces2009/WhatsNew.aspx

  • SubQuery Documentation

http://www.developer.entityspaces.net/documentation/DynamicQuery/SubQuery/SelectSubQuery.aspx

VB.NET Sample Application

We will also be providing a VB.NET sample application matching our current C# sample with both the Trial and Developer installs.

WCF Sample Application

Finally, we are creating a very informative WCF sample application that will be available for download. It will also be presented most likely in a two part blog posting as well (and included in our developer site). This sample app will demonstrate end-to-end how to use our Full Proxy (FP) and Lightweight Proxies (LP) in WCF scenarios.

wcf_sample

 

So, remember to search on our developer site before posting on our forums to see if you can find your answer there. Remember, we will continually be adding new content.

EntitySpaces

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, a Mono application, 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.

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net

posted on Thursday, January 15, 2009 11:20:53 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
 Tuesday, January 13, 2009

Effective February 2, 2009 we are changing the price of our EntitySpaces Developer version. EntitySpaces Developer licenses are licensed per developer seat. A developer seat is required for each developer that uses the EntitySpaces API which includes using the generated classes in their programming tasks. The EntitySpaces Source Code does not count as a developer license.

The last time we changed our prices was in February of 2007, that was two years ago. EntitySpaces 2009 is a substantial improvement over EntitySpaces 2008 when it comes to Code Generation with the addition of our Visual Studio Integration. There are some very cool enhancements planned for the ES2009 architecture after the Q1 release. If you are a current customer you can renew your license before the February 2nd, 2009 price increase one time.


The new pricing is as follows:

Developer Version

Current =>  149.00 Per Developer   89.40 Renewal
As of Feb 2nd, 2009= >  299.00 Per Developer 179.40 Renewal

Source Code  

Remains Unchanged =>  499.00 Per Developer 299.40 Renewal

Quantity Discounts

    • 2  to  4 developer licenses     = 10% 

    • 5 or more developer licenses = 20%

         Quantity discounts apply to items purchased at the same time.

      EntitySpaces

      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, a Mono application, 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.

      EntitySpaces LLC
      Persistence Layer and Business Objects for Microsoft .NET
      http://www.entityspaces.net

      posted on Tuesday, January 13, 2009 9:02:24 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Sunday, January 11, 2009

      Currently only the EntitySpaces Developer is available, the Trial version is not yet available. The Trial version will be published on the 12th (Monday night EST time). You can install Beta III right over the top of Beta II.

      Here are the fixes and enhancements in Beta III (Version 2009.0.0112.0).

      • The "What's New" tab now loads asynchronously so it no longer effects load time.
      • Added "Ctrl + A" support to select all tables or views in the template user interfaces. This was done on all table/view selection listboxes (excluding the Web Admin Grid templates).
      • There are now "Most Recently Used" lists available on both the Projects tab and Settings tab.
      • The Custom Master templates no longer overwrite existing files.
      • Fixed an error that could occur when saving project files.
      • Enhanced the Settings -> Naming Conventions -> Stored Procedure tab to help you visual customizations. We will also be doing this for the Class Names and Hierarchical tabs.

      The EntitySpaces.CommandLine.exe utility is also well underway. Once completed we will move from the beta to release candidate phase.

      EntitySpaces

      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, a Mono application, 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.

      EntitySpaces LLC
      Persistence Layer and Business Objects for Microsoft .NET
      http://www.entityspaces.net

      posted on Sunday, January 11, 2009 10:00:36 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Wednesday, January 07, 2009

      This is not an example how to use EntitySpaces. Most everything shown below can be done through our DynamicQuery API which is the preferred way. For instance, the GetMaxSalary() example shown in the EmployeesCollection class below could be done via our DynamicQuery like this:

      EmployeesQuery query = new EmployeesQuery();
      query.Select(query.Salary.Max());
      int maxSalary = (int)query.ExecuteScalar();
      And the CustomLoad() load method shown in the EmployeesCollection class below could be done via our DynamicQuery like this: 
      
      EmployeesCollection coll = new EmployeesCollection();
      coll.Query.Where(coll.Query.LastName.Like("g%"));
      if(coll.Query.Load())
      {
          // Then we loaded at least one record
      }

      So, when you look at the class below remember this is merely to demonstrate to you some of the lower level support functions that you have at your disposal. The idea being, of course, even though you are using an ORM system generated via our ES2009 code generator you are not cut off from the low level ADO.NET API when you need to hug the metal.

      public partial class EmployeesCollection : esEmployeesCollection
      {
          public bool CustomLoad(string partialName)
          {
              // This populates the EmployeesCollection itself
              return this.Load(esQueryType.Text, "SELECT * FROM EMPLOYEES WHERE LastName Like {0}", partialName);
          }
      
          public DataSet GetDataSet(int someParameter)
          {
              // We hate DataSets ;)
              return this.FillDataSet(esQueryType.StoredProcedure, "TestProc", someParameter);
          }
      
          public DataTable GetDataTable(int someParameter)
          {
              // We hate DataTables ;)
              return this.FillDataTable(esQueryType.StoredProcedure, "TestProc", someParameter);
          }
      
          public IDataReader GetReader(string partialName)
          {
              // We hate DataReaders ;)
              return this.ExecuteReader(esQueryType.Text, "SELECT * FROM EMPLOYEES WHERE LastName Like {0}", partialName);
          }
      
          public int GetMaxSalary()
          {
              return (int)this.ExecuteScalar(esQueryType.StoredProcedure, "procGetMaxSalary");
          }
      }


      Of course, we don't really hate DataSets, DataTables, or DataReaders. If you are an EntitySpaces user then you know that using our DynamicQuery API is the way to go. However, if there is something you need that is not available in our DynamicQuery API you have full access to the underlying power of ADO.NET.

      There is also a utility class called esUtility that will allow you to access this lower level API without adding custom methods to your EntitySpaces classes. This can be useful when what you need to do doesn't really belong to a particular entity. Here is an example of using the esUtility class.

      esUtility util = new esUtility();
      IDataReader reader = util.ExecuteReader(esQueryType.Text, "SELECT * FROM EMPLOYEES WHERE LastName Like {0}", "g%");

      One thing to note is that you never use decorators on your parameters such as ? or @ or : (depending on your database). The EntitySpaces Data Providers do this for you. For instance, notice in the sample code below that we do not set the parameter name to "@Salary" rather we just use "Salary". This allows you to access stored procedures and still have a database independent application as the EntitySpaces Data Provider will "gussy up" the parameters with the proper decorator. In fact,  you really don't have to use the syntax below unless you need to provide extra information such as parameter direction or perhaps the precision or scale of a decimal for some reason. Otherwise you can just use the {0}, {1} syntax as shown above in the GetReader() method. Even when using the {0} syntax EntitySpaces will create a true parameter for you to ensure that no SQL injection attacks are successful.

      esParameters parameters = new esParameters();
      esParameter param = new esParameter("Salary", null, esParameterDirection.Output);
      parameters.Add(param);
      
      esUtility util = new esUtility();
      IDataReader reader = util.ExecuteReader(esQueryType.StoredProcedure, "GetMaxSalary", parameters);

      While were at it here's another data access tip. This tip allows you to trick your table based collection (via the DynamicQuery) to query against a view. Of course, you can generate entities from a view if you like but if you don't really want the additional classes you can use this technique instead. Notice how we set the QuerySource below.

      EmployeesCollection coll = new EmployeesCollection();
      coll.Query.es.QuerySource = "MyView"; // <== Select against this view
      coll.Query.Select(coll.Query.LastName, coll.Query.FirstName);
      coll.Query.Where(coll.Query.Salary > 50000);
      coll.Query.Load();

      This can be very useful since you can still commit this data back to the Employee table provided that you also brought back the primary key, of course. And remember, these are tricks, not necessarily how to use EntitySpaces. You can easily use our DynamicQuery API to build a join on the fly to that would accomplish the same thing as the view above.

      In summary we have worked very hard to expose all of the underlying power of ADO.NET and yet you never have to pull in SqlClient, OracleClient or any other ADO.NET provider. Better still you can invoke stored procedures and not lose database independence if that is what you are after. We hope you have learned a thing or two from this post.

      EntitySpaces

      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, a Mono application, 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.


      EntitySpaces LLC
      Persistence Layer and Business Objects for Microsoft .NET
      http://www.entityspaces.net

      posted on Wednesday, January 07, 2009 11:37:43 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Sunday, January 04, 2009

       

                                     

      posted on Sunday, January 04, 2009 6:48:54 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Friday, January 02, 2009

      The ES2009 Beta II for both the Developer and Trial are now available for download. The version is 2009.0.0103.0 and you can install it right over the top of the previous Beta, just make sure you have Visual Studio closed.

      • User Metadata now truly works.
      • The C# and VB Web Admin Grids are available (documentation coming upon official release).
      • The DotNetNuke SQL Template is available. 
      • Npgsql 2.0.2.0 will now work during code generation (PostgreSQL Driver)

      At this point we are 100% functional. Everything should work, including Projects.  Now we merely "Beta" and work on the documentation and help files.

      We will also be creating some new video's, one on our Project files and one on how to use the Web Admin Templates.


      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, a Mono application, 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.

      EntitySpaces

      EntitySpaces LLC
      Persistence Layer and Business Objects for Microsoft .NET
      http://www.entityspaces.net

      posted on Friday, January 02, 2009 11:09:58 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Monday, December 29, 2008

      For those of you interested in the ASPX Admin Suite you will be happy to know these templates are being converted over into our ES2009 code generation model. The templates and the GridLoaders will be included with the installation and included in our BETA 2 which should be the final beta before the official ES2009 release. We are already generating fully functional admin pages via our C# Admin Suite and after we fully unit test it and fix any bugs mentioned in our forums we will create the VB.NET version. We will also provide much better documentation regarding how to generate your Admin Suite and what all the features in this powerful template do. The image below shows the ES2009 ASPX Admin Suite running under ES2009. The demo can be found HERE and we will upgrade it to our ES2009 model once we complete the templates.

       image

      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, a Mono application, 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.

      EntitySpaces

      EntitySpaces LLC
      Persistence Layer and Business Objects for Microsoft .NET
      http://www.entityspaces.net

      posted on Monday, December 29, 2008 8:41:49 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Thursday, December 25, 2008

      We have created a very simple video that demonstrates how to build your first EntitySpaces 2009 application. This presentation really demonstrates how easy it is to create your application using EntitySpaces 2009 which is fully integrated into Visual Studio. This is the first in a series of videos that will demonstrate the power of EntitySpaces 2009.

      Click on the image below to start the video. Give it a moment to load.

      image

       

      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, a Mono application, 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.

      EntitySpaces

      EntitySpaces LLC
      Persistence Layer and Business Objects for Microsoft .NET
      http://www.entityspaces.net

      posted on Thursday, December 25, 2008 10:15:16 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Sunday, December 21, 2008
      kick it on DotNetKicks.com

      We are pleased to make the EntitySpaces 2009 Beta available for public release. The EntitySpaces 2009 Trial version is fully integrated with Visual Studio 2005 or 2008. There is also a stand alone executable for those not using Visual Studio.

      EntitySpaces 2009 Visual Studio Add-In features

      • Settings Tab   - Connect to your database and customize your code generation settings.
      • Projects Tab   - Record and playback code generation templates.
      • Templates Tab  - Execute Templates.
      • Metadata Tab   - Online database metadata and user defined metadata.
      • Mappings Tab   - Database to property type mappings.
      • What's New Tab - Keep you up-to-date with EntitySpaces News.

      If you are looking at starting a new project in 2009 take a look at EntitySpaces 2009. It's a great architecture and we no longer rely on a third party code generator. To get started, simply install and switch to the "Settings" tab and connect to your database and click the "Save" icon and you're off and running. We will be publishing a series of video's on how to use ES2009 soon. Watch for these on our blog.

      NOTE:
      After installation you should see "EntitySpaces" on the Visual Studio "Tools" menu. If you do not see it go to your Programs -> "EntitySpaces 2009" menu you will find a "Manual Setup" PDF file which outlines a few simple steps performed within Visual Studio to manually add EntitySpaces to your Visual Studio Tools menu. It's really very easy. If you are using an international version of windows you will need to follow those steps.

      Also, if you have the alpha or pre-beta installed:

      1. Close all instances of Visual Studio
      2. Uninstall the ES2009 Alpha or Pre-Beta
      3. Delete your C:\Documents and Settings\All Users\Application Data\EntitySpaces folder (will be a different folder on Vista)
      4. Now install the ES2009 Beta and go to the "Settings" tab and reconnect to your database  (THEN PRESS THE SAVE ICON ON THE SETTINGS TAB)

              

       

      EntitySpaces Features

      • Mono Support
      • Compact Framework Support
      • Medium Trust Support
      • Design Time Data Binding
      • Hierarchical Data Models
      • Powerful Dynamic Query API
      • Binary and XML Serialization
      • Data Provider Independence
      • Two Different Transaction Models
      • Saving via Stored Procedures or Dynamic SQL
      • Generated from your Database Schema
      • No XML mapping files. 
      • LINQ Support for Collections
      • Regenerate Without Losing Custom Business Logic
      • Source Code Available

       

      EntitySpaces

      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, a Mono application, 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.

      EntitySpaces LLC
      Persistence Layer and Business Objects for Microsoft .NET
      http://www.entityspaces.net

      posted on Sunday, December 21, 2008 8:13:44 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Friday, December 19, 2008

      For customers only. If you can please download the ES2009 Pre-Beta in our downloads area and give it a run through and report anything back to us in our forums.

      IMPORTANT !!

      * Close all instances of Visual Studio

      * Uninstall the ES2009 Alpha

      * Delete your C:\Documents and Settings\All Users\Application Data\EntitySpaces folder (will be a different folder on Vista)

      * Now install the ES2009 Pre-Beta and go to the "Settings" tab and reconnect to your database
         (THEN PRESS THE SAVE ICON ON THE SETTINGS TAB)

      WHATS CHANGED

      * The International install issue is NOT FIXED YET but should be by this weekend

      * The "Projects" tab is implemented

      * Microsoft Access should work just fine

      * It should work on 64 bit machines

      * The stand alone app shouldn't require Visual Studio to be installed

      * The User Metadata is now saved

      * Various UI issues tweaked

      The reason we are releasing this pre-alpha is to get feedback from you before our official alpha release this weekend. The version number didn’t change, it's still versioned as the Alpha.

      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, a Mono application, 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.

      EntitySpaces

      EntitySpaces LLC
      Persistence Layer and Business Objects for Microsoft .NET
      http://www.entityspaces.net

      posted on Friday, December 19, 2008 12:37:48 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Friday, December 12, 2008
      We thought we would share with you what came out of this past Wednesday's EntitySpaces Team meeting which we hold every Wednesday. Our plan is to release the ES2009 Beta on December 22nd. The Beta will be available to customers as a true Developer Version and to the public as a Trial version which will be posted on our download page. In fact, we will encourage new users to go with the ES2009 Beta over the EntitySpaces 2008 Trial version.

      The Beta should have full functionality including the Projects Tab which will allow you to record and playback templates (and it's very easy to use). We have fixed all of the issues reported in the Alpha and have made many more improvements.

      There are two items that will not be in the Beta that will be delivered in the official ES2009 release. The first being the ASPX Admin Suite. However, once the Beta is released we are going to be giving our full attention to the ASPX Admin Suite and will porting the C# and VB versions over to ES2009 template system and fixing all of the known issues. We know the Admin Suite has fallen behind and is really in need of some attention. Secondly, the ES2009 Command Line utility will also be created which will allow you to generate your EntitySpaces Architecture from the command line. This utility will be able to execute individual templates as well as entire projects.

      While we haven't committed to an official release date we have in mind the end of January 2009 as our goal but that is an aggressive date. Once we ship ES2009 we will be free of third party code generators and then turn our full focus to the EntitySpaces Architecture itself.

      EntitySpaces

      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, a Mono application, 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.

       

      EntitySpaces LLC
      Persistence Layer and Business Objects for Microsoft .NET
      http://www.entityspaces.net

      posted on Friday, December 12, 2008 9:49:47 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Tuesday, December 09, 2008

      We have re-skinned our main site and we hope that you like what you see. We will be adding more content and changing our menu structure in the near future as well, so more changes are coming. Over the next few months we will be bulking up the documentation on our developer site. This will allow us to turn our main site into a marketing site that will convey the strengths and advantages of EntitySpaces and of course still act as our storefront.

      We at EntitySpaces, LLC would like to thank "Ann Chanyoursang" for designing our new DotNetNuke skin. Ann is a designer for AppTheory which is a development consultancy and a member of the Trend Core Group in Atlanta, GA. AppTheory has a unique perspective on DotNetNuke. With Core Team Developers on staff and a roster of top tier clients using DNN, AppTheory is considered one of the top DotNetNuke consultancies.

      Thanks Ann, great Job !!

      image 
       

      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, a Mono application, 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.

      EntitySpaces LLC
      Persistence Layer and Business Objects for Microsoft .NET
      http://www.entityspaces.net

      posted on Tuesday, December 09, 2008 8:45:38 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Sunday, November 23, 2008

      We have released our EntitySpaces 2009 Alpha internally to our customers and if all goes well within a week or so we will publish a trial version on our download page for everyone to try. You can install ES2009 side by side with (but not over the top of) ES2008 without conflict. The ES2009 Alpha is really a trial version that is hard coded to expire on Jan 15th, 2009, however we will have a beta version out before it expires. There are no limitations however in the features. You will find it to be very convenient never having to leave Microsoft Visual Studio when you need to generate your EntitySpaces architecture. Our ES2009 AddIn for Visual Studio is compatible with both VS2005 and VS2008. You will also find a stand alone version of ES2009 on your Start menu after installation for those who are not using Visual Studio. Everything in the ES2009 AddIn for Visual Studio is also available in the stand alone version. EntitySpaces 2009 no longer relies on MyGeneration or CodeSmith for it's code generation. We now have our own code generation engine. Bringing everything in-house has drastically removed the complexities involved in downloading EntitySpaces and getting your first application up and running. Once you do that, we know you'll be hooked.bbb

      The "What's New" tab will keep you in touch with what is happening in the EntitySpaces community. You can even get to our forums, blog, documentation site, and home page from the "What's New" tab. You can click the "Embed" button and use the hosted browser within our AddIn itself and avoid lauching browsers. Give it a try, it's pretty cool. Of course, you will want to play around and figure out just how you want to dock your ES2009 AddIn depending how you intend to use it. It's nice to doc the AddIn in the center pane and then embed our documentation site on the "What's New" tab so you can use our documentation site within Visual Studio.

      We have improved our metadata providers for SqlCe and VistaDB. You should now be able to connect to any version of SqlCe without the need to recompile our metadata provider. See the instructions on the "Settings Tab" for how to indicate what version of SqlCe you want to use. Our VistaDB metadata provider now works with the latest version of VistaDB as well. Our VistaDB metadata provider is compiled against VistaDB version '3.4.3.69'. If you need to run against a different version you will find the solution file for it in the C:\Program Files\EntitySpaces 2009\CodeGeneration\EntitySpaces.MetadataEngine.VistaDB folder. Merely open it up, compile it, and then copy the EntitySpaces.MetadataEngine.VistaDB.dll assembly into your C:\Program Files\EntitySpaces 2009\CodeGeneration\Bin folder.

      There hasn't been much work done on the actual EntitySpaces architecture since our November release of ES2008. However, we did upgrade our PostgreSQL provider (EntitySpaces.Npgsql2Provider.dll) to use the lastest Npgsql version, '2.0.1.0'. We would like to give a shout out to the Npgsql team for all of their efforts.

      There are some things missing from the alpha that will make it into our beta version. There is currently no support to automatically add the generated files to your solution, however, that is coming. Of course, you can generate the files directly into your solution's folders using the output path on the "Settings Tab". Also, there is no project support yet that would allow to record template execution for later playback, this is coming soon as well. Finally, the template stack is not yet implemented.

      Overall, we are very pleased with the quality of the Alpha release. It is very stable as in the EntitySpaces tradition. You should be able to generate your architecture and compile it just fine. We are very interested to hear how the installation works for you. We have tested on both Windows XP and Windows Vista and we hope everything runs smoothly for you as well. Be sure and let us know what can make ES2009 better, any missing features? suggestions? We want hear from you. We have created a special section within our forums for reporting and commenting on the ES2009 Alpha release. Please make all of your posts in this new forum so there is no confusion with our ES2008 posts. So chime in on our Special ES2009 Forum and let us know how your install went and your initial thoughts.

      This year is going to be your year. We have taken the first step in making your 2009 the most productive year ever. After the initial release of ES2009 will will focus on the EntitySpaces Architecture itself. We will review our TRAC system for outstanding issues and will put out all call for fixes that you need or features that are important to you.

      EntitySpaces

      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, a Mono application, 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.

       

      EntitySpaces LLC
      Persistence Layer and Business Objects for Microsoft .NET
      http://www.entityspaces.net

      posted on Sunday, November 23, 2008 8:16:07 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Wednesday, November 05, 2008

      You may have already noticed our new logo on our recently announced documentation site. You will gradually begin to see it replace our older logo on all content. Also, keep your eyes open for a totally new site. Good things are happening, watch for another blog post on ES2009 this weekend as well.

      EntitySpaces

      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, a Mono application, 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

      posted on Wednesday, November 05, 2008 11:28:48 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Tuesday, November 04, 2008

      EntitySpaces Co-Founder Scott Schecter will be in Las Vegas, NV for DevConnections '08 again this year. Scott will be manning booth #608 with AppTheory and giving away some free licenses of EntitySpaces in their drawing. If you are going to be in Vegas for DevConnections, stop by and say hi to Scott. Tell him what you love about EntitySpaces or what you would like to see added in the future. Find out more about the EntitySpaces 2009 visual studio add in or just shoot the breeze. We always love to hear from our customers, and it is exceedingly nice to get to meet them in person and shake their hand (and maybe have a scotch or two;). So if you are going to DevConnections stop in and say howdy. We would love to hear from you.

      FALL2008DEVCELL01
      posted on Tuesday, November 04, 2008 4:07:56 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Monday, November 03, 2008

      From the very beginning, we have always tried to provide ample documentation for EntitySpaces. Since all of the team members are developers, we can certainly empathize with using a product that lacks in this area. As the product grew, and more documents were added, it became harder and harder to centralize all of the various resources for easy searching. We, previously, had documentation on our main site, in our forums, and in blog posts.

      Today, we are proud to announce the new EntitySpaces Developer Documentation Site. This site will house all EntitySpaces documentation in an effort to provide one centralized, searchable location. We have started consolidating all of our existing documentation there. If you find any content that is out of date, missing, or needs expansion, please create a post in our Developer Documentation forum and we will get the site updated.

      We hope you find this new resource useful. As always, any feedback is greatly appreciated.

      - The EntitySpaces Team

      posted on Monday, November 03, 2008 9:29:13 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Saturday, October 18, 2008

      This post is a continuation of  EntitySpaces 2009 - Running under Visual Studio (Part 1)

      kick it on DotNetKicks.com

      Special Note: If you are investigating EntitySpaces this article gets a little technical. However, you will not have to write user controls or do anything other than browse to a template within Visual Studio and execute the desired template. This article is for some of our more advanced EntitySpaces users. Not only are we making EntitySpaces very easy to use but also very easy to extend. Everything you see in this blog post is running under Visual Studio.

      The Template Header

      imageIn this post we'll take a look at both the Template Browser and the template user interface mechanism. The Template Browser lists the templates in a tree based on each template's Namespace located in the template header (shown left). You can see from the TemplateInfo tag in the template header that there is both a Namespace and a UniqueID attribute. The UniqueID will be discussed later when we dig into the user interface. Now, however, let's take a look at the Template Browser. The Template Browser is shown below (while running under Visual Studio). 

       

      The Template Browser

      image

      You can select any template and click the green arrow to execute a template which will display the template's user interface, if any.

      The Template User Interface

      Look at the image below to get an idea of what happens when we click on the green arrow to execute the template. Notice the tabs on the image above are gone. Also notice in the open solution in our EntitySpaces.TemplateUI project there are three user controls. Basic, Advanced, and ProxyStub. These correspond to the three tabs you see on the screen below. We (and you) can write your user interface in pure Windows.Forms user controls and have full IntelliSense. You also have direct binding capabilities to our metadata. Now only that, but you can extend our templates with your own user interface by adding an additional tab. Again, this is only for necessary for those that want to extend EntitySpaces.

        image

      What you are looking at above is the template user interface which slides over and across the normal tabs. The template user interface is shown until you press Ok to execute the template or Cancel it. Once the template is executed the normal tabs such as Projects, Templates, and so on become visible again. It's pretty cool to see it in action. When the user presses Ok you simply stuff the users UI choices into the esMeta object's (metadata object) input Hashtable during the OnExecute method. So, how can you extend the user interface without modifying our templates and not be worried about a new release wiping out your changes? Easy. Let's look at how the UI works at a low level.

      A Template User Interface Tab

      Below is all that is necessary to add a tab to our existing templates, or add them for your own custom template. Notice we implement the ITemplateUI class. This means we need to implement the Init, OnExecute, and OnCancel methods. In the Init method, you tie your user control to a template via the TempalteInfo.TempalteId property, making sure to match it to the template's UniqueID in the template header (shown at the beginning of this post).

      image

      The above image is the code for the "Basic" tab that you see on the template user interface above. This is housed in it's own assembly and stored in a particular folder that the plug-in scans. Take a look at the Init() method which returns an esTemplateInfo object. Here we are indicating that when the template with the UniqueID of "2216AB4F-BDB4-47de-8412-8560C1F2F420" is executed we want this user control on a tab called "Basic Information". If you look at the OnExecute() method this is where we will store the users choices. (Later we will access them in our custom template). Recall that in ES2009 you will be able to add templates into our template stack to extend and customize EntitySpaces. The good thing is our templates will use use the same mechanism for our user interface. So, all three the tabs you see in the template user interface above are represented by an individual user control. The second parameter to Init() above is really the DTE2 ApplicationObject which will allow your user interface to have full access the visual studio solution just like our plug-in does. We pass it in as type "object" so that you are not forced to bind with the Visual Studio Plug-in assemblies unless you really want to.

       

      Binding to the Metadata in your User Control

      Notice how use the esMeta object passed into our ITemplateUI.Init() method to populate our user interface controls. Since this is all just normal Windows.Forms programming you can bind directly to our metadata collections and it could not be any easier.

      image

      We hope you like what you are seeing.

      EntitySpaces

      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, a Mono application, 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

      posted on Saturday, October 18, 2008 9:50:27 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Sunday, October 12, 2008

      kick it on DotNetKicks.com plug


      EntitySpaces 2009 (see roadmap) will plug right into Visual Studio and it will use its own internal code generator. This means that Visual Studio users will never have to leave Visual Studio to work on or generate their EntitySpaces architecture. The image below shows how EntitySpaces 2009 looks embedded within Visual Studio. While it is likely to change a little before our first beta this should provide you with a feel for ES2009. The nice thing is that ES2009 is a dockable window just like any other window within Visual Studio, you can even generate your EntitySpaces classes directly into your solution and the folders/files will be created automatically for you. We are also making our VistaDB and SQL CE providers version independent so you will no longer have to deal version issues during code generation.

       

      The EntitySpaces 2009 Tabs

      • Projects Tab - Projects allow you to record templates so that you can play them back at any time. Thus, you can regenerate with all of the settings you used when you recorded the session originally.
      • Templates Tab - The template browser lists all of the templates available to you, you can launch them from this tab.
      • Metadata Tab - The metadata tab allows you to examine all of the database metadata that EntitySpaces provides to your templates during code generation. Also the user meta data can be edited through this tab which allows you to alias columns, indicate Oracle sequences, and other things.
      • Settings Tab - The settings tab is where you add connections to various databases, indicate paths such as where your user meta data is located, the location of your output folder, and all kinds of EntitySpaces configuration settings.
      • Mappings Tab - This tab lists the mappings between database column types to .NET types.

       

      esplug

      If you are not a Visual Studio user no need to worry. We will provide a stand alone windows forms application that will look and work almost exactly the same (see below).

       

      es2009_alone

      The image above is the same binary code that runs under Visual Studio. We are developing both the Visual Studio compatible version and the Stand Alone version at the same time. Expect another blog post by the end of October which provide you with more insight into ES2009 including many more screen shots. Our goal is to have our first beta out by the end of 2008.

      EntitySpaces

      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, a Mono application, 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

      posted on Sunday, October 12, 2008 10:02:22 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Monday, September 29, 2008

      This should be our final ES2008 Release as we expect to have an ES2009 beta out by the end of the year. Here are the changes.

      1) The byte[] properties (for image and binary data types) were not being marked as dirty when set and thus weren't being saved.

      2) esEntity.MarkAsDeleted() now throws an exception if you call it and there is no data.

      EntitySpaces

      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, a Mono application, 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

      posted on Monday, September 29, 2008 1:56:30 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Sunday, September 21, 2008

      There were a few bugs found in our 0915 release and we felt the need to put out a new release to address them. We recommend that everyone on the 0915 release upgrade to our 0922 release. If you regenerated your classes on the 0915 release there is no need to regenerate your classes again on the 0922 release. We will post a 0922 Trial version very soon. You will know when the new Trial version is available by looking under the download button on our home page.

      Here are the issues that were addressed.

      1. There was a bug when binding to a grid and adding a new row through the grid interface, this has been fixed.
      2. There was a bug in certain complex hierarchical save scenarios, this has also been fixed.

      We have a slew of improvements and requests that we are  going to pour into ES2009. We have already converted our entire suite of C# templates to run under our new code generator so things are moving forward very nicely on ES2009.

      EntitySpaces

      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, a Mono application, 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

      posted on Sunday, September 21, 2008 7:27:42 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Wednesday, September 17, 2008



      EntitySpaces has teamed up with Justin Greenwood (shown left) of MyGeneration Software to create a brand new code generation engine for EntitySpaces 2009. Because of Justin's code generation expertise we contacted Justin and asked him to create a very simple, lightweight code generation engine whose only job is to execute templates. (There is no user interface support by design.) The code generation engine makes the EntitySpaces MetdataEngine available as an intrinsic object available to all templates through the "esMeta" property. We already have a working version of the code generation engine and thought we would share our progress with you.

      We have created a test form that invokes the code generation engine for testing. Here is the button click event that kicks the whole thing off.

      using EntitySpaces.MetadataEngine;
      using EntitySpaces.CodeGenerator;

      namespace Test
      {
          public partial class Form1 : Form
          {
              private void btnGenerate_Click(object sender, EventArgs e)
              {
                  EntitySpaces.MetadataEngine.Root esMeta = new EntitySpaces.MetadataEngine.Root();
                  esMeta.Connect("SQL", this.txtConnectionString.Text); // I'm Connection to Northwind
                  esMeta.LanguageMappingFileName = @"esLanguages.xml";
                  esMeta.UserMetaDataFileName = @"esUserData.xml";
                  esMeta.esPlugInSettingsFileName = @"esSettings.xml";
                  esMeta.Language = "C#";

                  Template template = new Template();
                  template.Execute(esMeta, "Master.est");

              }
          }
      }

      Master Template

      Here is what the "Master.est" template looks like. In the code above the connection string was set to the Microsoft SQL Northwind database and we have hard-coded the "Employees" table in the master template shown below.

      image 

      Sub Template

      Notice in the code above we execute a sub template named "Sub.est" and append it's output to our currently running template. We also show how you can have separate "pure code blocks" via the <script> tag. Below is the Sub.est template which is passed the "esMeta" object from the Master template and then runs through all of the columns in the Orders table.

      image

      The Output

      The output from the execution of the master template looks like this:

          EmployeeID
          LastName
          FirstName
          Title
          TitleOfCourtesy
          BirthDate
          HireDate
          Address
          City
          Region
          PostalCode
          Country
          HomePhone
          Extension
          Photo
          Notes
          ReportsTo
          PhotoPath

      <START|-|Wow, very cool|-|END>

      --> Sub.est

          OrderID
          CustomerID
          EmployeeID
          OrderDate
          RequiredDate
          ShippedDate
          ShipVia
          Freight
          ShipName
          ShipAddress
          ShipCity
          ShipRegion
          ShipPostalCode
          ShipCountry

      Summary

      At this point we have everything in place to provide a Beta version of EntitySpaces 2009 in a very short time frame. By having this all in house our code generation will be extremely easy for EntitySpaces 2009 and will not rely on third party tools. This also allows for our new code snippet model where a template is nothing more than a collection of code snippets which can be tweaked and replaced by our customers.

      Take a look at this mock master template.

      image

      All the master does is execute a set of sub templates that make up, for example, the single esEntity object. Now imagine a very cool UI that allows you to manage, edit, and customize these snippets and replace or tweak our properties, INotify support, or just add other methods and properties to your entities. And the best thing is you will not need to be a code generation expert, not by a long shot. We are very excited about EntitySpaces 2009. This is only a part of what is coming in 2009. Domain modeling and much more are on tap.

      For more on EntitySpaces 2009 take a look at our roadmap HERE.

      EntitySpaces

      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, a Mono application, 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

      posted on Wednesday, September 17, 2008 2:46:31 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Sunday, September 14, 2008

      We are pleased to announce that the official EntitySpaces 2008 0915 release is now available for download. This will be the final EntitySpaces 2008 release. Work is already underway on EntitySpaces 2009 and we will make a blog post filling you in on the some of details very shortly.

      New Features, Fixes, Enhancements

      1. Major Performance Improvements which all users will realize. See this blog post.
      2. The VistaDB provider now supports NEWID() and GUID() on inserts.
      3. IsDirty logic improvements (see below).

        Employees emp = new Employees();
        if (emp.LoadByPrimaryKey(1))
        {
            // At this point LastName = "'Smith"

            emp.LastName = "Crazy"; // emp.es.IsDirty = true
            emp.LastName = "Smith"; // emp.es.IsDirty = false
        }

      4. Added ExecuteReader and ExecuteScalar to the esDynamicQuery class. See this blog post. This can be very useful for retrieving large results sets for display purposes.
      5. Fixed the exception handling in FillDataTable and FillDataSet.
      6. Add Oracle FLOAT support.
      7. Added GetConnectionName() to allow classes to be configured to use a predefined connection string. See this blog post.
      8. Fixed the AcceptChanges/RejectChanges logic such that it always clears the ModifiedColumns.

       

      We will be publishing a new Trial Version later on this evening for the 0915 release.

      EntitySpaces

      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, a Mono application, 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

      posted on Sunday, September 14, 2008 11:58:32 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Saturday, September 13, 2008

      We have pushed up what we hope is our final beta for our 2008.1.0912.0 maintenance release. We need you to help us test. If you are able to upgrade your ES2008 application to our final beta, we ask you to do so. We plan on publishing the RTM late Sunday night. You will need to regenerate your classes. There is no trial version of this beta release available. Please report in your findings in our forums, positive or negative.

      Thank you

      - The EntitySpaces Team

      EntitySpaces

      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, a Mono application, 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

      posted on Saturday, September 13, 2008 7:08:33 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Thursday, August 28, 2008
      image 

      Besides performance enhancements we are adding some much sought after database connection flexibility. The "Generated Master" templates now have a "Connection Name" textbox which if left blank indicates that the generated objects should use the default connection (as they do now). However, by providing a connection name you can generate different sets of objects that target a particular connection in our connection list. In the example on the right we are generating a set of classes that will use the "Capricorn" connection from our config file (or configless setup).

      <EntitySpaces>
          <connectionInfo default="Taurus">
              <connections>

                  <add name="Taurus"
                      providerMetadataKey="esDefault"
                      sqlAccessType="DynamicSQL"
                      provider="EntitySpaces.SqlClientProvider"
                      providerClass="DataProvider"
                      connectionString="... Data Source=Taurus;"
                      databaseVersion="2005" />

                  <add name="Capricorn"
                      providerMetadataKey="esDefault"
                      sqlAccessType="StoredProcedure"
                      provider="EntitySpaces.SqlClientProvider"
                      providerClass="DataProvider"
                      connectionString=" ... Data Source=Capricorn;"
                      databaseVersion="2005" />

              </connections>
          </connectionInfo>
      </EntitySpaces>

      Notice that "Taurus" is registered as our default connection. However, by providing "Capricorn" in the "Connection Name" edit box during the code generation process we can generate any number of entities that will automatically use the "Capricorn" connection with no extra coding on our part.

      We are also adding an additional approach that will be great for ASP.NET developers that need to have different connections on a per user or per client basis. We are adding an Interface that you can implement which will serve up all connection names as EntitySpaces requests them. This will allow you to authenticate a user and store that users connection name such as "Capricorn" in the session (or wherever you choose). Then each time EntitySpaces needs a connection it will ask you for the connection name. You can simply pull the name right out of the session and return it. Using this approach you will be able to serve up connection names in any way you can possibly think of.  This will be available in our next ES2008 maintenance release and we should be pushing up a beta in a few days. We will do another blog post showing how to use provide the Interface and serve up connection names very soon.

      EntitySpaces

      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, a Mono application, 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

      posted on Thursday, August 28, 2008 8:20:04 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Sunday, August 24, 2008

      There have been quite a few questions about performance lately on our forums, that is, new users coming to our site and asking "How fast is EntitySpaces" or "How does it compare to architecture 'X' " and it's been our plan to do some investigation into this. Then we saw a POST on DotNetKicks regarding SubSonic's performance tests and wondered how EntitySpaces stacked up. We ran some tests and found an issue in that we were creating a needless transaction in some cases when saving single entities. A transaction was blindly being created to cover the case of a hierarchical save. However, we now detect whether or not we have other objects to save, and if not, we don't create a transaction. This really increased our performance along with a few other changes. We also made some performance enhancements in how our collection saves work. Now, it's important to state that you can not get these performance numbers in the current release. However, the performance enhancements have been made and will be in the next maintenance release to be pushed in less than two weeks. The good news is the performance enhancements will be realized no matter what database you are running against.

      We decided to take the SubSonic examples from the post above and literally recreate them in the EntitySpaces syntax and do a comparison. The tests were performed on a single computer with SQL 2005 hosting the Northwind database. Both the SubSonic and EntitiySpaces tests were run on the same machine, against the same database, and both using dynamic SQL (and not stored procedures). Here are the tests and timings. We loaded a single entity from the database before the timings began to eliminate any first time startup issues such as assembly loads and configuration file reads.

      All times are in mm:ss (minutes and seconds)

      Test 1

      This test creates an order and an order detail record saving them both. This is done in a loop for a given number of iterations.

      Test 1 Results (at different iterations)

           10,000 Iterations     100,000 Iterations   1,000,000 Iterations
      EntitySpaces             0:14               2:20               24:10
      SubSonic             0:20               3:21               33:21

       

      TEST 1 Source













      EntitySpaces ==>

      // Let's save a million items shall we?
      for (int i = 1; i < 1000000; i++)
      {
          Orders o = new Orders();
          o.CustomerID = "ALFKI";
          o.EmployeeID = 5;
          o.Freight = 10;
          o.OrderDate = DateTime.Now;
          o.RequiredDate = DateTime.Now;
          o.ShipAddress = "Somwhere, Someday";
          o.ShipCity = "City";
          o.ShipCountry = "US";
          o.ShipName = "Shipper";
          o.ShippedDate = DateTime.Now;
          o.ShipPostalCode = "99999";
          o.ShipRegion = "KS";

          o.Save();

          //OrderDetail detail = new OrderDetail();
          OrderDetails detail = new OrderDetails();
          detail.OrderID = o.OrderID;
          detail.ProductID = 13;
          detail.Quantity = 1;
          detail.UnitPrice = 100;

          detail.Save();
      }









      SubSonic ==>

      // Let's save a million items shall we?
      for (int i = 1; i < 1000000; i++)
      {
          Order o = new Order();
          o.CustomerID = "ALFKI";
          o.EmployeeID = 5;
          o.Freight = 10;
          o.OrderDate = DateTime.Now;
          o.RequiredDate = DateTime.Now;
          o.ShipAddress = "Somwhere, Someday";
          o.ShipCity = "City";
          o.ShipCountry = "US";
          o.ShipName = "Shipper";
          o.ShippedDate = DateTime.Now;
          o.ShipPostalCode = "99999";
          o.ShipRegion = "KS";

          o.Save("me");

          OrderDetail detail = new OrderDetail();
          detail.OrderID = o.OrderID;
          detail.ProductID = 13;
          detail.Quantity = 1;
          detail.UnitPrice = 100;

          detail.Save("me");
      }

       

      Note that on the above test at 1 million iterations with 2 inserts per iteration EntitySpaces was inserting 1,379 records per second.

      2,000,000 (inserts) / 1,450 (seconds) = 1,379 (inserts per second)

       

      Test 2

      This test loops through a million objects loading them one by one using the single entity class.
      We are reading a million records with ids 7080773 through 8080773.

      Test 2 Results

                                1,000,000 Entity Reads
      EntitySpaces                                       6:18
      SubSonic                                       7:05

       

      TEST 2 Source



      EntitySpaces ==>

      for (int i = 7080773; i < 8080773; i++)
      {
          Orders o = new Orders();
          o.LoadByPrimaryKey(i);
      }


      SubSonic ==>

      for (int i = 7080773; i < 8080773; i++)
      {
          Order o = new Order(i);
      }

       

      Test 3

      This test loops through a million objects loading them 10 at a time into a collection class.
      We are reading a million records with ids 7080773 through 8080773.

      Test 3 Results

                                1,000,000 Collection Reads
      EntitySpaces                                        08:53
      SubSonic                                        13:47

       

      TEST 3 Source



      EntitySpaces ==>

      for (int i = 7080773; i < 8080773; i++)
      {
          int nextTen = i + 10;

          OrdersCollection oc = new OrdersCollection();
          oc.Query.Where(oc.Query.OrderID.Between(i, nextTen));
          oc.Query.Load();
      }


      SubSonic ==>

      for (int i = 7080773; i < 8080773; i++)
      {
          int nextTen = i + 10;
          OrderCollection coll = new Select().From<Order>().Where("orderid")
              .IsBetweenAnd(i, nextTen).ExecuteAsCollection<OrderCollection>();
      }

       

      EntitySpaces has always stacked up well in reports sent to us by users and upon our next release our customers will have even better performance. We have also added the ability to turn our Dynamic Query's into DataReaders for even higher performance in certain scenarios as outlined in this blog post. We know it's controversial to publish performance results but we believe we have treated each architecture fairly and will publish the testing harness when we publish our next ES2008 maintenance release. SubSonic, NHibernate, and other architectures are fine architectures, this post was merely to head off the inevitable questions heading our way.

      EntitySpaces

      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, a Mono application, 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

      posted on Sunday, August 24, 2008 10:31:57 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Monday, August 18, 2008

      We thought we'd tell you about two nice enhancements to our DynamicQuery API. We added two new methods to the esDynamicQuery class, ExecuteScalar and ExecuteReader. These will be available in our next ES2008 maintenance release when it comes out.

      ExecuteScalar:

      This query simply fetches the total table count. Of course, I could have used a Where clause to reduce it to a certain set of records.

      EmployeesQuery query = new EmployeesQuery();
      query.es.CountAll = true;
      int count = (int)query.ExecuteScalar();

      ExecuteReader:

      This query selects the FirstName and LastName columns where the LastName is like "Gri%" and then gets an IDataReader on the result set.

      EmployeesQuery query = new EmployeesQuery();
      query.Select(query.FirstName, query.LastName);
      query.Where(query.LastName.Like("Gri%"));

      using (IDataReader reader = query.ExecuteReader())
      {
          while (reader.Read())
          {
              string s = reader.GetString(0);
          }
      }

      Notice that neither of these approaches is used to populate a collection or an entity. This is similar to the already existing Query.LoadDataTable() method.

      EntitySpaces

      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, a Mono application, 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

      posted on Monday, August 18, 2008 8:30:58 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Tuesday, June 24, 2008

      ProLINQ



       

       

      "EntitySpaces is an easy-to-use, high-performing .NET Object Relational Mapping (ORM) tool. If your organization is evaluating ORM tools, I would recommend that you add EntitySpaces to your list."   -- Vijay P. Mehta

       

       

       

       


      While this book isn't specifically about EntitySpaces we do get some kinds words from it's author in the section of the book that does takes a look at EntitySpaces.

      Author Information


      Vijay P. Mehta has been working as a software engineer and architect for the last 12 years. Starting off in the VC++/ATL, MFC, Win32, and VB6 worlds, Vijay later moved on to Java and .Net development. With his current focus on C# and .Net, Vijay holds a number of Microsoft certifications and has written a number of articles on .Net and Microsoft–focused development. Currently working as an Architect for a financial services software company in Indianapolis, Vijay spends the bulk of his time designing and implementing large, cutting-edge software systems.

      For more information see Pro LINQ Object Relational Mapping in C# 2008

       


      EntitySpaces LLC
      Persistence Layer and Business Objects for Microsoft .NET
      http://www.entityspaces.net

      posted on Tuesday, June 24, 2008 5:45:39 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Friday, June 20, 2008
      King Wilder posted Part Two of his ASP.NET MVC series and it's a very good read. Well done King. There are some very good comments at the end of his post as well.



      King Wilder, is an ASP.NET developer who runs and owns a small web hosting company called Gizmo Beach. The article is about an ASP.NET MVC application that King ported to use EntitySpaces as the data access layer, or model. Here's a brief snippet from the article.





      In Part 1 of this short series, I discussed how to build a simple ASP.NET MVC application using EntitySpaces.  If you have any Object Oriented background you will have noticed that that application was what is called, "tightly coupled".  That means that one set of objects depends on another.  This is generally a bad idea as it makes your application less flexible and extendable.

      In this article, I will discuss what changes are necessary to make the application "loosely coupled", which in turn will make it easier to extend.


      See the rest of the blog post HERE ...

      posted on Friday, June 20, 2008 10:59:35 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Saturday, June 14, 2008

      We've added support for CodeSmith and added many big new features including LINQ Support, subquery support, casting support, SQL 2008 support, NewSequentialID support, PostgreSQL Guid support, and just a ton of enhancements and fixes. We also now have a Microsoft SQL Server CE desktop provider as well as the Compact Framework provider. We didn't get everything done on the roadmap that we wanted to but we are well positioned for the future. We need to save some stuff for the official announcement so this is just a short and sweet post to let you know the official version "2008.1.0623.0".

      Below are a few blog posts that speak to some of the new features coming in ES2008. And know for sure, we need you to run with our release candidate this week. So help us if you can.

      EntitySpaces 2008 - LINQ to SQL in Next Beta

      EntitySpaces 2008 - LINQ to SQL in Next Beta (Part 2)

      EntitySpaces 2008 "Cast" Support

      EntitySpaces 2008 - Dynamic SubQuery Showcase

      EntitySpaces 2008 Adds Subqueries

       

      EntitySpaces

      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, a Mono application, 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

      posted on Saturday, June 14, 2008 7:15:53 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Wednesday, June 11, 2008

      We thought we would bring this blog post written by King Wilder to your attention. King Wilder, is an ASP.NET developer who runs and owns a small web hosting company called Gizmo Beach. The article is about an ASP.NET MVC application that King ported to use EntitySpaces as the data access layer, or model. Here's a brief snippet from the article.


      ENTITY SPACES

      Ok a brief word about Entity Spaces.  It is a really cool ORM tool but much more than that.  It reads your database and builds entity classes.  Now you might say that there are many tools that do that like NHibernate, SubSonic, etc., and you would be correct.  EntitySpaces actually costs money where SubSonic is free.  But I was using SubSonic before I trialed Entity Spaces.  After about a half a day playing with it, I purchased it and I'm going on my second year (2008) using it and I couldn't be happier.  Go to their web site to find out more.  But this article isn't about EntitySpaces, it's about building an ASP.NET MVC application without using Linq.

      See the rest of the blog post HERE ...

      posted on Wednesday, June 11, 2008 9:29:13 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]

      The EntitySpaces 2008 Release Candidate is available now. Both the Developer and Trial Versions are available. Not all of the items on the roadmap are going to make the 1st ES2008 release. Those items listed on the roadmap not shown in red will be included in a follow on maintenance release. We are probably looking at less than two weeks before the official release so we encourage you to upgrade and try it out to make sure that there are no fixes that you need.


      rc

      Here is a short list of fixes and enhancements included in the Release Candidate:

      • esDataSource will automatically fetch the TotalRowCount if you do not set it
      • Added LINQ support too (optional template option)
      • Added source code for VistaDB and SqlCe MetadataEngine plugins to installer
      • Fixed some Casting issues
      • Fixed DatePart sub-operator for Oracle
      • Fixed CodeSmith generation error for SqlCe
      • Fixed CodeSmith generating un-compileable code for Oracle sequences
      • Fixed ordering issue with paging for Oracle
      • PostgreSQL Guid Support

      EntitySpaces

      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, a Mono application, 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

      posted on Tuesday, June 10, 2008 11:29:54 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Saturday, May 24, 2008
      kick it on DotNetKicks.com

      Okay, before you rail against the machine we are aware of the BINARY(16) thing-a-ma-joppy being implemented in the MySQL Connector/Net provider (5.2.2.0 version) but surely this is not the preferred method and is only a short term solution until MySQL 6.0 is released?  However, this post seems to indicate that the core MySQL database engine guys are perfectly happy not having a real Guid data type in the year 2008. Correct me if I'm wrong please ...

      Basically, the MySQL Connector/Net (5.2.2.0) provider treats BINARY(16) columns as Guids, though there is not real Guid (uniqueidentifier in Microsoft SQL) data type. However, it's not transparent, there are special read and write methods for it. If you're a MySQL fan let the folks over at MySQL know that you want a true data type for Guids and not an imposter. We appreciate the hard work the MySQL Connector/Net team is doing. After all, MySQL doesn't have a Guid type yet so they are doing what they can. However, we would rather see them lobby the core database engine team for a true Guid column type. How about you?

      Fans of MySQL unite, saddle up your dolphins and let MySQL know you want a true Guid datatype in MySQL 6.0.

      posted on Saturday, May 24, 2008 10:49:39 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
      kick it on DotNetKicks.com

      I have always built architectures on top of ADO.NET DataTables, they're fast (yes), flexible, and the power it provides is really pretty good. Additionally, as new features are added to ADO.NET they can then be easily absorbed. We were able to add LINQ to SQL to EntitySpaces by simply turning a LINQ query into an ADO.NET DataTable. Once we exchange the LINQ query for an ADO.NET DataTable the EntitySpaces architecture functions as normal since its underlying data structure is a DataTable. Pretty sweet. Here's a nice little trick in case you are not aware of it.

      DataContext context = new DataContext("User ID=sa;Initial Catalog=ForeignKeyTest;Data Source=localhost;");

      var linqQuery = context.GetTable<Employee>().Where(s => s.LastName != "Griffin")
          .OrderBy(s => s.LastName);

      SqlCommand cmd = context.GetCommand(linqQuery) as SqlCommand;

      DataTable dataTable = new DataTable();
      SqlDataAdapter adapter = new SqlDataAdapter(cmd);
      adapter.Fill(dataTable);

      There you have it. A DataTable obtained from a LINQ query, easy as pie.  You can simply ask the DataContext for a Command object and then use the Command object in combination with a DataAdapter to fill a DataTable. This is exactly what EntitySpaces 2008 does under the covers. This is an excellent way for architectures to leverage the power of LINQ to SQL.

      EntitySpaces

      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, a Mono application, 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

      posted on Saturday, May 24, 2008 3:04:44 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Friday, May 23, 2008

      EntitySpaces and Silverlight Demo

      Part 2: Filtering and Changing EntitySpaces Data

      kick it on DotNetKicks.com

      Jon_Davis
      Written by Jon Davis
      http://www.jondavis.net/

       

       

      Run the Demo Here  ==> http://developer.entityspaces.net/ES2008/Demos/Silverlight/PartTwo
      Download the Source Here ==> http://www.developer.entityspaces.net/downloads/EntitySpacesSilverlightDemo2.zip 
       

      Review of Part One

      In Part One, I described the process of getting Silverlight to interact with a WCF web service, and I showed how I bound EntitySpaces based data objects (WCF client proxies) to Silverlight controls, specifically a DataGrid control. While there were a lot of pages of review in Part One, it was mostly point-and-click “configuration coding”, as MyGeneration, EntitySpaces, and Visual Studio did most of the work for me.

      linqII_one

      Figure 1 - EntitySpaces RIA running in Safari 3.1 (on Windows) with just about 20 lines of hand-written client-server code and XAML markup.

       

      But showing data in a grid isn’t very exciting. It’s time to look at some interaction with data and give EntitySpaces a little more credit than just a data wrapper.

       

      Category-Filtered Products (Client-Server Method)

      Let’s assume that the user wants to filter the products list by category. I want to keep this demonstration as simple as possible, while proving out technical implementations of basic scenarios, so I’m not going to make any significant effort just yet to make this look pretty.

      linqII_two  

      Here’s the XAML:

      <UserControl
          x:Class="EntitySpacesSilverlightDemo_Silverlight.Page"
          xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" 
          xmlns="http://schemas.microsoft.com/client/2007"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
          <Grid x:Name="LayoutRoot" Background="Gray">
              <Grid.RowDefinitions>
                  <RowDefinition Height="75" />
                  <RowDefinition />
              </Grid.RowDefinitions>
              <TextBlock Grid.Row="0" Text="EntitySpaces on Silverlight ~ Northwind Demo" VerticalAlignment="Center" HorizontalAlignment="Center" />
              <Grid Grid.Row="1">
                  <Grid.ColumnDefinitions>
                      <ColumnDefinition Width="200" />
                      <ColumnDefinition />
                  </Grid.ColumnDefinitions>

                  <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Text="Please Wait" Visibility="Collapsed" x:Name="WaitText" />
                  <ListBox Width="300" Grid.Column="0" x:Name="ViewSelector" SelectionChanged="ViewSelector_SelectionChanged">
                      <ListBoxItem Content="Products: All"></ListBoxItem>
                  </ListBox>

                  <Controls:DataGrid AutoGenerateColumns="True" x:Name="ESDataGrid" Grid.Column="1" />
              </Grid>
          </Grid>
      </UserControl>

      For starters and for the sake of continuing the discussion of ES over WCF, I’m going to make this a client-server filter—I’ll pass in a CategoryID as a parameter in my WCF request for products.

      Here’s the complete client-side code-behind for Page.xaml.cs, additions in bold+brown:

      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Windows;
      using System.Windows.Controls;
      using System.Windows.Documents;
      using System.Windows.Input;
      using System.Windows.Media;
      using System.Windows.Media.Animation;
      using System.Windows.Shapes;
      using System.Net;

      using EntitySpacesSilverlightDemo_Silverlight.Northwind;

      namespace EntitySpacesSilverlightDemo_Silverlight
      {
          public partial class Page : UserControl
          {
              NorthwindClient.NorthwindClient ESNorthwind;

              public Page()
              {
                  InitializeComponent();
                  ESNorthwind = new NorthwindClient.NorthwindClient();

                  ESNorthwind.GetCategoriesCompleted += ApplyCategoriesToList;
                  ESNorthwind.GetProductsCompleted += new EventHandler<NorthwindClient.GetProductsCompletedEventArgs>(NorthwindClient_GetProductsCompleted);
                  ESNorthwind.GetProductsByCategoryCompleted += new EventHandler<GetProductsByCategoryCompletedEventArgs>(Northwind_GetProductsByCategoryCompleted);

                  GetCategories();

                  LoadAllProducts();
              }

              private void GetCategories()
              {
                  ESNorthwind.GetCategoriesAsync();
              }

              private void ApplyCategoriesToList(object sender, GetCategoriesCompletedEventArgs e)
              {
                  if (e.Error == null)
                  {
                      Categories[] cc = e.Result.Collection;
                      for (int i = cc.Length-1; i >=0; i--)
                      {
                          Categories category = cc[i];
                          ListBoxItem lbi = new ListBoxItem();
                          lbi.Tag = "CategoryID: " + category.CategoryID;
                          lbi.Content = "Products: " + category.CategoryName;
                          ViewSelector.Items.Insert(1, lbi);
                      }
                  }
              }

              private void LoadAllProducts()
              {
                  WaitText.Visibility = Visibility.Visible;
                  ESNorthwind.GetProductsAsync();
              }

              void LoadProductsByCategory(int categoryId)
              {
                  WaitText.Visibility = Visibility.Visible;
                  ESNorthwind.GetProductsByCategoryAsync(categoryId);
              }

              void Northwind_GetProductsByCategoryCompleted(object sender, GetProductsByCategoryCompletedEventArgs e)
              {
                  WaitText.Visibility = Visibility.Collapsed;
                  ProductsCollection pc = e.Result;
                  ESDataGrid.ItemsSource = pc.Collection;
              }

              void NorthwindClient_GetProductsCompleted(object sender, Northwind.GetProductsCompletedEventArgs e)
              {
                  WaitText.Visibility = Visibility.Collapsed;
                  ProductsCollection pc = e.Result;
                  ESDataGrid.ItemsSource = pc.Collection;
                  ESDataGrid.Columns[ESDataGrid.Columns.Count - 1].Visibility = Visibility.Collapsed; // hide "esRowState"
              }

              private void ViewSelector_SelectionChanged(object sender, SelectionChangedEventArgs e)
              {
                  ListBoxItem lbi = ViewSelector.SelectedItem as ListBoxItem;
                  if (lbi != null)
                  {
                      if (lbi.Content.ToString() == "Products: All")
                      {
                          LoadAllProducts();
                          return;
                      }
                      string tag = lbi.Tag as string;
                      if (tag != null && tag.StartsWith("CategoryID: "))
                      {
                          tag = tag.Substring(12);  // length of "CategoryID:"
                          LoadProductsByCategory(int.Parse(tag));
                      }
                  }
              }

          }
      }

      On the server, we will perform a basic EntitySpaces query operation.

      INorthwind service interface:
      [ServiceContract]
      public interface INorthwind
      {
          [OperationContract]
          ProductsCollectionProxyStub GetProducts();

          [OperationContract]
          ProductsCollectionProxyStub GetProductsByCategory(int categoryId);
          [OperationContract]
          CategoriesCollectionProxyStub GetCategories();
      }

      Northwind service implementation:
      public class Northwind : INorthwind
      {
          public ProductsCollectionProxyStub GetProducts()
          {
              ProductsCollection pc = new ProductsCollection();
              pc.LoadAll();
              ProductsCollectionProxyStub pcs = new ProductsCollectionProxyStub(pc);
              return pcs;
          }

          public ProductsCollectionProxyStub GetProductsByCategory(int categoryId)
          {
              ProductsCollection pc = new ProductsCollection();
              pc.Query.Where(pc.Query.CategoryID.Equal(categoryId));
              pc.Load(pc.Query);

              ProductsCollectionProxyStub pcs = new ProductsCollectionProxyStub(pc);
              return pcs;
          }

          public CategoriesCollectionProxyStub GetCategories()
          {
              CategoriesCollection cc = new CategoriesCollection();
              cc.LoadAll();

              // strip out the OLE bitmaps
              for (int i = 0; i < cc.Count; i++)
              {
                  cc[i].Picture = null;
              }

              CategoriesCollectionProxyStub ccs = new CategoriesCollectionProxyStub(cc);
              return ccs;
          }

      }

      Category-Filtered Products (Local Filtering Method)

      Practically speaking, calling out to the server every time you want to filter the products is bad design unless the Products list contains a lot (hundreds of thousands) of records, in which case we should also drop the “Products: All” unfiltered option from the ListBox so that the user cannot make the mistake of loading all products which might take forever.

      If the unfiltered source data is relatively small, as Northwind’s Products table actually is, then it would make more sense to load all products from the server and then filter against the category locally. This eliminates the HTTP-based callback to the server and makes the user’s experience much faster and more responsive.

      LINQ-to-Objects is supported in Silverlight, and this includes LINQ-to-EntitySpaces-client-proxies. We can change the NorthwindClient_GetProductsCompleted and ViewSelector_SelectionChanged methods to use LINQ filtering rather than server-side filtering. In so doing, we can remove much of the code we just added and achieve the same results but executing much faster.

      Products[] NorthwindProducts = null;
      void NorthwindClient_GetProductsCompleted(object sender, Northwind.GetProductsCompletedEventArgs e)
      {
          WaitText.Visibility = Visibility.Collapsed;
          NorthwindProducts = e.Result.Collection;
          ESDataGrid.ItemsSource = NorthwindProducts;
          ESDataGrid.Columns[ESDataGrid.Columns.Count - 1].Visibility = Visibility.Collapsed; // hide "esRowState"
      }

      private void ViewSelector_SelectionChanged(object sender, SelectionChangedEventArgs e)
      {
          ListBoxItem lbi = ViewSelector.SelectedItem as ListBoxItem;
          if (lbi != null)
          {
              if (lbi.Content.ToString() == "Products: All")
              {
                  ESDataGrid.ItemsSource = NorthwindProducts;
                  ESDataGrid.Columns[ESDataGrid.Columns.Count - 1].Visibility = Visibility.Collapsed; // hide "esRowState"
                  return;
              }
              string tag = lbi.Tag as string;
              if (tag != null && tag.StartsWith("CategoryID: "))
              {
                  int catID = int.Parse(tag.Substring(12));
                  ESDataGrid.ItemsSource =
                      from p in NorthwindProducts
                      where p.CategoryID == catID
                      select p;
                  ESDataGrid.Columns[ESDataGrid.Columns.Count - 1].Visibility = Visibility.Collapsed; // hide "esRowState"
              }
          }
      }

      We can now eliminate one of the INorthwind interfaces we just added, ..

      • GetProductsByCategory(int categoryId)

      .. and we can eliminate some of the just-added client/server handling code in Silverlight:

      • LoadProductsByCategory(int categoryId)
      • Northwind_GetProductsByCategoryCompleted(...)

      Changing Data

      Let’s assume that the user is an administrator who is maintaining this list of products and needs to be able to make changes to product data on the fly. The bad news is that in the interest of focusing on EntitySpaces and less on Silverlight UI, I intended to refrain from creating a pop-up editor for editing a record. The good news is that the Silverlight DataGrid supports two-way databinding and inline edits, and in such case one would need no layout changes at all. I only need to add an event handler for DataGrid edits and pass the revised record up to the server via WCF.

      We’ll bind to the CommittingCellEdit and CommittingRowEdit events. In CommittingCellEdit we’ll update the property that was edited, and in CommittingRowEdit we’ll pass the Product out to the server.

      Page.xaml (modify):

      <Controls:DataGrid AutoGenerateColumns="True" x:Name="ESDataGrid" Grid.Column="1"
      CommittingCellEdit="ESDataGrid_CommittingCellEdit"
      CommittingRowEdit="ESDataGrid_CommittingRowEdit"
      />

      Page.xaml.cs (add):

      private void ESDataGrid_CommittingCellEdit(object sender, DataGridCellCancelEventArgs e)
      {
          Products p = (Products)e.Row.DataContext;
          string f = e.Column.Header.ToString();
          string v = ((TextBox)e.Element).Text;
          System.Reflection.PropertyInfo pi = p.GetType().GetProperty(f);
          if (pi.PropertyType == typeof(string))
          {
              pi.SetValue(p, v, null);
          }
          else if (pi.PropertyType == typeof(int) ||  pi.PropertyType == typeof (int?))
          {
              pi.SetValue(p, int.Parse(v), null);
          }
          else e.Cancel = true;
          if (!e.Cancel)
          {
              p.esRowState = "Modified";
          }
      }

      private void ESDataGrid_CommittingRowEdit(object sender, DataGridRowCancelEventArgs e)
      {
          Products p = (Products)e.Row.DataContext;
          if (p.esRowState == "Modified")
          {
              ESNorthwind.UpdateProductAsync(p);
          }
      }

      This won’t compile until we revise our service in the Web project and then update the reference to it in the Silverlight project.

      INorthwind.cs (add):

      [OperationContract]
      void UpdateProduct(ProductsProxyStub product);

      AppCode/Northwind.cs (or Northwind.svc.cs, add):

      public void UpdateProduct(ProductsProxyStub product)
      {
          Products prod = (Products)product.GetEntity();
          prod.Save(); // wow, that was easy..
      }

      Silverlight project:

      linqII_three

      Now the Silverlight code should compile, and if you set breakpoints both on the server’s UpdateProduct() method as well as on the new event handler in Silverlight, you should be able to watch the data model as it gets updated and sent back to the server.

      Recommitting back to the server was so easy (although the reflection bits in the CommitingCellEdit event handler needs some clean-up) it’s actually a little dangerous. We can’t go live with this change on a public demo without having a nightly automated process to restore the Northwind data or else it will become unusable.

      But this tutorial should have still sufficed in getting you on your feet with fetching, filtering, and updating data between Silverlight and EntitySpaces. There is a lot of design-related knowledge to be had in Silverlight, and real-world business objects to be realized in EntitySpaces, but this was a basic data discussion, so the rest is up to you.

       


      EntitySpaces

      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, a Mono application, 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

      posted on Friday, May 23, 2008 10:15:53 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Sunday, May 11, 2008

      Oh, I almost forgot the most important thing. And that is using LINQ to SQL to populate data directly into your EntitySpaces collections, oh man this is hot !!

      DataContext context = new DataContext("User ID=sa;Initial Catalog=Northwind;Data Source=localhost;");

      var linqQuery = context.GetTable<Employees>().Where(s => s.LastName == "Griffin")
          .OrderBy(s => s.LastName);

      EmployeesCollection coll = new EmployeesCollection();
      coll.Load(context, linqQuery);

      foreach (Employees emp in coll)
      {
          Console.WriteLine(emp.FirstName);
      }

      Notice that we pass the context and the linqQuery directly into our EntitySpaces EmployeeCollection's Load() method, the rest is the same as usual, awesome !!

      EntitySpaces

      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, a Mono application, 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

      posted on Sunday, May 11, 2008 10:37:53 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]

      Although this didn't make our Beta III release our LINQ support is already in the new templates for the next Beta (we're getting close to a final beta but not yet). Before we show you how it all works let's look at some examples to peak your interest.

      First lets select all Employees who have the last name "Griffin" and order them as well. The Employees class highlighted in blue above is your true EntitySpaces class.

      DataContext context = new DataContext("User ID=sa;Initial Catalog=Northwind;Data Source=localhost;");

      var q = context.GetTable<Employees>().Where(s => s.LastName == "Griffin")
          .OrderBy(s => s.LastName);

      foreach (Employees emp in q)
      {
          Console.WriteLine(emp.LastName);
      }

      Now let's do a join using a different syntax style. Notice that we select the EmployeeID from the Empoyees table and the OrderID from the Orders table.

      DataContext context = new DataContext("User ID=sa;Initial Catalog=Northwind;Data Source=localhost;");

      var employees = context.GetTable<Employees>();
      var orders = context.GetTable<Orders>();

      var query = from e in employees
                  join o in orders on e.EmployeeID equals o.EmployeeID
                  where e.LastName != "Griffin"
                  select new { e.EmployeeID, o.OrderID };

      foreach (var obj in query)
      {
          Console.WriteLine(obj .EmployeeID.ToString() + ":" + obj .OrderID.ToString());
      }

      To add LINQ to SQL support to your EntitySpaces classes all you need to do is check a checkbox on the advanced tab.

      When you check this checkbox the templates will make sure our LINQ to SQL support is injected in your classes. The code ends up looking like this.

      [Serializable]
      [Table(Name = "Employees")]
      public partial class Employees : esEmployees
      {
          #region LINQtoSQL overrides

          [Column(IsPrimaryKey = true, CanBeNull = false)]
          public override System.Int32? EmployeeID
          {
              get { return base.EmployeeID; }
              set { base.EmployeeID = value; }
          }

          [Column(IsPrimaryKey = false, CanBeNull = false)]
          public override System.String LastName
          {
              get { return base.LastName; }
              set { base.LastName = value; }
          }

          [Column(IsPrimaryKey = false, CanBeNull = false)]
          public override System.String FirstName
          {
              get { return base.FirstName; }
              set { base.FirstName = value; }
          }

          [Column(IsPrimaryKey = false, CanBeNull = true)]
          public override System.String Title
          {
              get { return base.Title; }
              set { base.Title = value; }
          }

          // and so on ....

          #endregion
      }

      Of course you will need to be targeting .NET 3.5 and the generated classes will include these additional namespaces:

      using System.Data.Linq;
      using System.Data.Linq.Mapping;

      This will work for any .NET Providers that support LINQ to SQL, currently I believe that is only Microsoft's SQL Client (but I could be wrong, I know the Npgsql guys are working on this too). So, now you can have all of the wonderful EntitySpaces features, including our Dynamic API (which runs on all of our supported databases and .NET 2.0) and LINQ as well if you so choose.

      EntitySpaces

      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, a Mono application, 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

       

      posted on Sunday, May 11, 2008 8:03:39 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Saturday, May 10, 2008

       

      We're less than one week away from the EntitySpaces 2008 presentation. 


      Indy ALT.NET, a Technical Presentation of EntitySpaces 2008

      The first meeting of the Indy ALT.NET community group will be May 15. Mike Griffin of EntitySpaces will be giving an in-depth technical presentation on EntitySpaces 2008 in Indianapolis. Pizza will be served and the presentation will start at 6pm. We expect this developer oriented technical presentation to go a couple of hours so drop in anytime after work. There will be Q&A time as well.

      Registration:
      You must register for this event. Space is limited to 70 individuals.
      Where:
      Country Inn & Suites By Carlson Indianapolis North
      9797 North Michigan Road
      Indianapolis, IN 46032
      317-876-0333

      MAP
      When:
      Doors open at 5pm with the presentation starting at 6pm. Get there at 5 for pizza!


      Mike from EntitySpaces will be demonstrating their new Subquery and Casting support, their powerful Proxy support including running EntitySpaces under Silverlight, database independence, LINQ to SQL and more ...

       


      EntitySpaces

      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, a Mono application, 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

      posted on Saturday, May 10, 2008 10:59:21 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
       Sunday, May 04, 2008

      EntitySpaces and Silverlight Demo

      Part 1: Propagating EntitySpaces Data

      kick it on DotNetKicks.com


      Jon_Davis 
      Written by Jon Davis
      http://www.jondavis.net/


       

      Introduction

      I was asked to see how easy it would be to get EntitySpaces objects to work inside Silverlight, and to demonstrate my findings. This was a curiously interesting notion, since many have pondered whether Silverlight is a valuable runtime environment for LOB (line-of-business) applications. There are a number of reasons why Silverlight, at least in its Version2 flavor, would be very ideal for building client/server applications:

      · Silverlight 2 comes with pre-built user controls ideal for business environments, such as the basic Textbox and more advanced data grid with editable cells

      · Silverlight 2's user controls support two-way data binding, so that synchronization can be performed easily in either direction

      · Silverlight 2's runtime is fast and fluid, using retained graphics vector-based rendering rather than redraw-at-invalidate "lazy" rendering. This results in a very responsive, clean, and professional user experience.

      · XAML takes lessons learned with ASP.NET with the separation of design from programming. Properly implemented, a Silverlight application can be completely re-skinned, with its layout completely reorganized, without touching any of the user interface programming code.

      · Silverlight 2 ships with built-in support for the language of your choice of: C#, VB.NET, IronRuby, IronPython, or JScript.NET. The .NET Framework itself inside of Silverlight is stripped down, but the core CLR is complete, and the target deployment environment does NOT need the .NET Framework installed with it.

      · Silverlight 2 runs not only on the Windows platform and on Internet Explorer, but it also runs happily on the Macintosh and in other browsers such as Firefox and Safari. This means that Silverlight is not just Microsoft's answer to Flash for its vector graphics, it's also Microsoft's decade-long-awaited answer to Java applets, "Write once, run anywhere." An investment in Silverlight on Windows is automatically a free, bonus investment in the Mac and Firefox runtime environments.

      · Silverlight 2 is also capable of communicating at runtime with web services over HTTP, making synchronization a natural programming experience without "hacking".

      So here I began. My first thought was to take the EntitySpaces generated objects and put them in a shared library, then reference them in my Silverlight application. This turned out not to work as I hoped, for a few important reasons worth mentioning:

      · Silverlight 2 can only reference assemblies (DLLs) that had been compiled against Silverlight's custom CLR. It cannot reference assemblies that were compiled against the normal .NET Framework (or against Mono).This is actually an opportunity for EntitySpaces, at least in its current form, because ES is built around code generation, so theoretically you could get the generated code to target Silverlight. Or so I thought, until I found...

      · Silverlight 2 only "speaks" HTTP. It doesn't "speak" T-SQL, so you cannot use an ADO.NET connection, for example. There is no System.Data namespace, no ADO.NET support. While this seemed bizarre and even annoying at first, eventually I began to understand, besides for obvious security reasons, why System.Data was not present in Silverlight 2 in the current beta form: CRUD is CRUD, it doesn't matter if it's happening over ADO.NET on a SQL connection or over HTTP, as long as the job gets done.

      Now I was beginning to procrastinate, because I made too many dumb assumptions. "So I guess I have to use System.Net.WebClient", I thought, "to make a manual connection to a web server, invoke a REST query I have to manually implement on the server, and then manually bring it back, parse it out, and in the end enjoy no benefit to using EntitySpaces at all?" When I finally sat down and researched what I needed to do, my jaw dropped. It’s nothing like that. In fact, it's almost silly how simple this is. The answer to the problem of the need for easy business object data synchronization lies in a wonderfully consistent new approach provisioned by Microsoft called WCF, or Windows Communications Foundation, now implemented at a basic level in Silverlight.

      WCF support on Silverlight is limited to basicHttpBinding (SOAP 1.1). But that binding should suffice for most business scenarios.

      The power of WCF is actually somewhat less about the underlying technology than it is about the code generation tools built into Visual Studio for building out the necessary client proxy stubs from defined interfaces at design-time. EntitySpaces' built-in WCF took me there 75% of the way, but the Silverlight SDK closed the gap very quickly by allowing me to reference my WCF service in just a couple clicks.

      There was no coding of System.Net.WebClient. No manual conversion of XML to C# objects. Just beautiful EntitySpaces proxy stubs that enabled me to gather rich business object data from a server and perform quick and easy data binding against Silverlight with minimal effort.

      So in this first part, I'll describe the first "baby step" of getting Silverlight to interoperate with a WCF service in order to pass valuable EntitySpaces objects into Silverlight with very little effort. Following that, in the next part I'll describe a simple scenario of fetching filtered data based on a WCF callback parameter that then takes advantage of EntitySpaces query filtering on the server, again with only a few more lines of code. Finally, if I have time, I'll continue to research and then demonstrate how to take advantage of the new client-side query support that is already available in ES 2008's latest build, adding even more flexibility to the programming user experience.

       

      Run the Demo Here  ==> http://developer.entityspaces.net/ES2008/Demos/Silverlight/PartOne

      Download the Source Here ==> http://www.developer.entityspaces.net/downloads/EntitySpacesSilverlightDemo.zip 


      Setup

      These are the prerequisites you need to walk through this demo:

      · Visual Studio 2008

      · EntitySpaces 2007

      · Microsoft Silverlight Tools Beta 1 for Visual Studio 2008

      · Northwind database
       

      image

      Figure 1 - Download the Silverlight tools for Visual Studio

       

      Setting Up the Project and Generating Northwind Business Objects

      If you’re not already familiar with EntitySpaces, we need to walk through some initial code generation so that we have some business objects to begin with.

      Since nearly everything we’re doing is going to be done inside of Visual Studio, let’s start off by creating a new solution.

      clip_image002[19]

      Figure 2 - Start up Visual Studio and start by creating a new Project 
       

      clip_image002[17]

      Figure 3 - Create a Silverlight Application using .NET Framework 3.5 
       

      clip_image002[1]

      Figure 4 - When you create a Silverlight Application, Visual Studio prompts you to ask whether you want to create a new web to the solution or if you just want a local HTML test page. Choose to add a new Web. 
       

      In my opinion, the data objects that get passed around in an application should exist in their own class library and then referenced into the application that uses them.

      clip_image002[21] 

      Figure 5 - Add a new project to the solution ... 

       

      clip_image002[25]

      Figure 6 - .. and choose Class Library as the project type. You can delete the resulting Class1 file. 

      I’m going to use MyGeneration 1.3 for this demonstration. After preparing Northwind for SQL Server, I can then fire up MyGeneration.

      clip_image014

      Figure 7 - Open the template browser 

      clip_image002[61]

      Figure 8 - Expand EntitySpaces, then C#, then right-click Generated Classes Master (C#), and choose Execute. 

      clip_image018

      Figure 9 - I have a Visual Studio class library project set up, waiting for new code to be added to the physical directory so that I can add the files to the project after they are generated. 

      clip_image020

      Figure 10 - I'd like to give the Namespace a similar name as the database: NorthwindData  

      clip_image022

      Figure 11 - You can pick and choose your tables -- we'll use Products and Categories -- but might as well select them all. 

      clip_image024

      Figure 12 - On the third tab, we want to enable the WCF proxies, as highlighted in the image.  

      clip_image026

      Figure 13 - Click the OK button at the bottom to generate the objects  

      clip_image002[27]

      Figure 14 - After a moment, you may receive a confirmation message. If not, no worries, as long as your error log window isn’t filled up.  

      Now I can close MyGeneration and go back to Visual Studio.

      clip_image002[29]

      My NorthwindData project doesn’t have anything in it yet, let’s add the newly generated files.

      clip_image002[11]

      Figure 15 - Click the "Show All Files" toolbar button in the Solution Explorer window.  

      clip_image002[31]

      Figure 16 - Now we can see our generated files. Right-click on the folder and choose "Include In Project".  

      Before we can call this class library “ready”, we need to remember to reference the EntitySpaces dependency assemblies.

      clip_image002[33]

      clip_image002[35]

      Figure 17 - You need EntitySpaces.Core and EntitySpaces.Interfaces .. 

      clip_image002[37]

      Figure 18 - .. as well as System.Runtime.Serialization and System.ServiceModel for WCF proxy support. 

      Finally, we should also add the same references to the Silverlight_Web project, as well as EntitySpaces.Loader, EntitySpaces.LoaderMT, EntitySpaces.SqlClientProvider, EntitySpaces.Web, and EntitySpaces.Web.Design.

      You will also need to add updates to your web.config for EntitySpaces to be able to read from (and later write to) the Northwind database. Here’s what I have ..

      <configuration>
         <configSections>
            <sectionGroup name="EntitySpaces" type="EntitySpaces.Interfaces.esConfigSettings, EntitySpaces.Core">
            <section name="connectionInfo" type="EntitySpaces.Interfaces.esConfigSettings, EntitySpaces.Interfaces"
                allowLocation="true" allowDefinition="Everywhere" restartOnExternalChanges="true"/>
      </sectionGroup>
      ...

      ...
      </system.webServer>

      <EntitySpaces>
          <connectionInfo default="SQL">
            <connections>
               <add name="SQL" providerMetadataKey="esDefault" sqlAccessType="DynamicSQL" provider="EntitySpaces.SqlClientProvider"
                    providerClass="DataProvider"
                    connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NORTHWND.MDF;Integrated Security=True;User Instance=True" databaseVersion="2005"/>
            </connections>
         </connectionInfo>
      </EntitySpaces>

      <runtime>
      ...


      Discovering the Silverlight Tools

      Before you got this far, you should have discovered that when you added the Silverlight Application, the Page.xaml file loaded right up to be edited. It might have looked like this:

      clip_image042

      Figure 19 - The XAML Editor view for a Silverlight Application 

      This is a design canvas for a Silverlight application layout. Silverlight works like ASP.NET in that the design and the programming code are isolated from each other. There is a “code-behind” file, or a similar principle, just as with an .aspx file.

      In the design (XAML) editor, there are two views on a split pane.

      One view is the XAML text editor. Think of it as an HTML editor in a split pane view, such as in Microsoft Expression Web or in Dreamweaver. The only big difference here is that XAML isn’t HTML, obviously, and in fact XAML is much stricter and less forgiving of errors than HTML ever was. Even so, its power becomes evident when elements can be added to a view with minimal markup.

      clip_image002[39]

      Figure 20 - The XAML text editor pane.  

      The other view is the Design view. Currently (at the time of this demo, the Silverlight Tools was only in Beta 1), this only works as a preview in Visual Studio. You can drag items from the toolbar to your layout, but only into the XAML text editor, not to the Design view. This isn’t the case if you have access to Blend 2.5, which at the time of this demo is currently in public Alpha (Technology Preview) and was not used for this demo at all. The design view does have some advantages, though. It provides a quick visual preview of the XAML text, and if you need to nitpick you can zoom in or out.

      clip_image002[41]

      Figure 21 - The Design pane.  

      So let’s start adding some XAML and some logic to get, say, a data grid populated with the entire contents of the Northwind “Products” table, as provided by the EntitySpaces business objects we generated earlier.

      Personally I don’t care for fixed dimensions before we even begin let’s just delete the Width and Height attributes on the <UserControl> XML node. This will make Silverlight fill the screen or else collapse to the largest object.

      Next I want to add a data grid.

      clip_image002[47]

      Figure 22 - Drag a DataGrid control to the <Grid> content. 

      I’ll add the attribute x:Name=”ESGrid”, which is the ID of the control on the page. The attribute AutogenerateColumns=”True” does what it suggests; when data is bound to the grid, the columns are automatically generated. (Without this setting, the grid would come up blank because I am not providing layout information for the columns.)

      <Grid x:Name="LayoutRoot" Background="White">
          <my:DataGrid x:Name="ESGrid" AutoGenerateColumns="True"></my:DataGrid>
      </Grid>

      The next thing we should do is insert a “Please Wait” text block so that as we download the Products list. This is just for effect so that the user isn’t staring at a blank DataGrid or a blank screen before the data shows up. To make this effective, we should also hide the DataGrid until the data is ready.

      <Grid x:Name="LayoutRoot" Background="White">
          <TextBlock Text="Please Wait .." x:Name="WaitText" VerticalAlignment="Center" HorizontalAlignment="Center" />
          <my:DataGrid x:Name="ESGrid" AutoGenerateColumns="True" Visibility="Collapsed" />
      </Grid>

      Now all our Silverlight app wants is some data. But before we can populate the DataGrid, we have to expose the data. So now we turn to our Silverlight_Web project.

      Exposing the Data via A WCF Service

      Open up the Property Pages for the Web project.

      clip_image002[49]

      The first thing that should come up is a list of References. Add a reference to the Northwind project
       

      image

      clip_image054

      With Northwind added, we can now add a WCF service. Right-click on the Silverlight_Web project again and choose Add New Item…
       

      clip_image056

      .. and then choose WCF Service. We’ll name it “Northwind.svc”.
       

      clip_image058

      This generates four things:

      • An interface file defining the interface INorthwind
      • A Service (Northwind.svc) file that only acts as a stub for the code-behind C# file
      • A service implementation file (Northwind.svc.cs or App_Code/Northwind.cs) where the service code is actually going to be written, and finally
      • A set of entries in web.config that define

        • Your site’s serviceModel configuration settings such as the EndPoint configuration
        • Bindings to the Northwind service

      In the Northwind service implementation, you’ll see a bogus DoWork method stub defined and exposed, like so:

      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Runtime.Serialization;
      using System.ServiceModel;
      using System.Text;

      // NOTE: If you change the class name "Northwind" here, you must also update the reference to
      // "Northwind" in Web.config.

      public class Northwind : INorthwind
      {
          public void DoWork()
          {

          }
      }

      You can toss this out but before you do you need to go and modify INorthwind.

      Notice that INorthwind attributes itself with the ServiceContractAttribute. This identifies the interface as a WCF service interface definition. Exposed methods are attributed with OperationContractAttribute.

      [ServiceContract]
      public interface INorthwind
      {
          [OperationContract]
          void DoWork();
      }

      Before we can see the Northwind project’s stuff in Intellisense, we need to build both it and the Silverlight_Web project. Right-click on the Silverlight_Web project, choose Build Web Site, and the Northwind project will build first because it is a dependency. (This is also a good time to check for errors.)

      Now let’s add some code.

      In INorthwind, replace “DoWork()” with “GetProducts()”, and change “void” to “NorthwindData.ProductsCollectionProxyStub”. Then go back to the service implementation file and replace “DoWork()” with “GetProducts()” again and “void” to “NorthwindData.ProductsCollectionProxyStub”.

      Next, we can give the method stub some functionality.

      public NorthwindData.ProductsCollectionProxyStub GetProducts()
      {
          NorthwindData.ProductsCollection products = new NorthwindData.ProductsCollection();
          products.LoadAll();

          NorthwindData.ProductsCollectionProxyStub proxy = new NorthwindData.ProductsCollectionProxyStub(products);
          return proxy;
      }

      This will fetch all products, wrap them in a WCF-ready proxy, and spit back the proxy.

      Now let’s make sure that our WCF service is functioning. Hit the Debug button in Visual Studio (while the Silverlight_Web project is selected) and when the web page comes up, navigate to Northwind.svc. You may get a prompt asking if you want to enable debugging, just say yes.

      clip_image060

      clip_image062

      clip_image002[51]

      If you can see the “Northwind Service” page, indicating “You have created a service,” you’re almost ready to start binding your service to Silverlight.

      Stop the debugger before continuing.

       

      Initializing EntitySpaces

      Before this service will successfully work with EntitySpaces at runtime, the EntitySpaces runtime needs to be initialized to point to a database.

      Right-click on the Silverlight_Web project node in Solution Explorer and choose “Add New Item...”, then select “Global Application Class” (name it the default, Global.asax). When it opens up, add the following code in Application_Start():

      protected void Application_Start(object sender, EventArgs e)
      {
          EntitySpaces.Interfaces.esProviderFactory.Factory = new EntitySpaces.LoaderMT.esDataProviderFactory();
      }


      Binding the WCF Service to Silverlight

      Silverlight “speaks” WCF, but only using basicHttpBinding (SOAP 1.1). We need to update the endpoint configuration on the service so that it uses basicHttpBinding rather than the default wsHttpBinding.

      Open web.config in Silverlight_Web and change wsHttpBinding to basicHttpBinding.

      <system.serviceModel>
      <behaviors>
          ...
      </behaviors>
      <services>
          <service behaviorConfiguration="NorthwindBehavior" name="Northwind">
          <endpoint address="" binding="basicHttpBinding" contract="INorthwind">
          ...

      We also need to create a temporary lock on the port that our development web server (Cassini) is using. When Web projects are created within Visual Studio, a small web server loads up in the background, with a visible icon in the Windows Notification Area (or “system tray”), and the port that it uses is random. If we lock it, though, we can force Silverlight’s WCF bindings to always point to the correct web address when it calls back to the web server. This is only for debugging purposes; when deploying to production, a URL will be used literally, on port 80, as with http://www.mydomain.com/myService

      To lock the web server port so that we can get a fixed reference on Silverlight, click on the Silverlight_Web project node in the Solution Explorer tree and disable the “Use dynamic ports” option.

      clip_image066

      Now it’s time to bind your WCF service to Silverlight. Right-click on the Silverlight project node in the Solution Explorer and choose “Add Service Reference ...”

      clip_image002[53]

      Then select “Discover >” and choose “Services in Solution”. The Silverlight_Web project is displayed. Expand it until you see the Northwind service, then expand that until you see the INorthwind service contract. Select the INorthwind service contract, and set the Namespace to “NorthwindClient”.
       

      clip_image002[55]

      Once you click on “OK”, the required assemblies for WCF support, all pre-compiled against the Silverlight runtime, are brought into Silverlight automatically.

      clip_image002[57]

      Great, I have my bindings. Now it’s time to populate my grid.

      If you expand the Page.xaml node in the Solution Explorer, you should see the Page’s “code-behind”-ish file. Open that up and see what’s inside.

      // using stuff ;
      namespace EntitySpacesSilverlightDemo_Silverlight
      {
          public partial class Page : UserControl
          {
              public Page()
              {
                  InitializeComponent();
              }
          }
      }

      So we already have a constructor here where we can fire off an invocation of the WCF service. Note: All System.Net.WebClient and WCF client calls are asynchronous, so you must plan for this ahead of time whenever programming callbacks with Silverlight.

      After adding “using NorthwindClient;” to the top of the file, here’s my code for within the “class Page” block:

      NorthwindClient.NorthwindClient ESNorthwind;

      public Page()
      {
          InitializeComponent();
          ESNorthwind = new NorthwindClient.NorthwindClient();
          ESNorthwind.GetProductsCompleted += new EventHandler<NorthwindClient.GetProductsCompletedEventArgs>(NorthwindClient_GetProductsCompleted);
          LoadAllProducts();
      }

      private void LoadAllProducts()
      {
          WaitText.Visibility = Visibility.Visible;
          ESNorthwind.GetProductsAsync();
      }

      void NorthwindClient_GetProductsCompleted(object sender, NorthwindClient.GetProductsCompletedEventArgs e)
      {
          WaitText.Visibility = Visibility.Collapsed;
          NorthwindClient.ProductsCollection pc = e.Result;
          ESGrid.ItemsSource = pc.Collection;
          ESGrid.Visibility = Visibility.Visible;
      }

      Hit F5 and run, and you should see something like this:

      clip_image002[59]

      This is what we were designing for. We have a data-bound DataGrid, where the data derives from the same EntitySpaces business objects I perhaps already invested in elsewhere on my site or in my application, and despite a learning curve for basic configuration for WCF interop, there was actually very little code that was written by hand.


      Deployment to IIS

      We’re not quite done yet. Now we have to look at deployment to a production server.

      Silverlight’s binding to the services is hard-coded to the URL http://localhost:11434/Northwind.svc. Silverlight is then compiled and bundled directly into the web project that hosts the WCF service. We now have a chicken-or-egg situation; both projects depend on the other. Further, EntitySpaces is hosting this demo on a shared web host that uses IIS 7 which enables WCF services natively, but WCF on IIS 7 doesn’t support HTTP endpoints through web.config without a custom service factory.

      Here’s a run-down on how we got this running at: http://developer.entityspaces.net/ES2008/Demos/Silverlight/PartOne/

      1. Upload the web project files to the web server via FTP and make sure that the directory paths correctly reflect the desired URLs.
      2. In Visual Studio, with the Solution still open, choose File -> Add -> Existing Web Site..., then select FTP on the left and fill out the necessary FTP information (hostname, username, password, directory).
        Be sure to enter the exact FTP directory path to the root of the web project.
      3. We now have two copies of the same web project loaded in our solution, the local copy and the FTP-based copy. Now we need to make some configuration changes in the FTP-based copy of the project in our solution.
        • Re-link the Silverlight project. Right-click on the Project node in the Solution Explorer, choose Properties Pages, and select Silverlight Links. (If anything there, remove it now so it is empty.) Click “Add...”, ensure that your Silverlight project is available in the drop-down list for “Project to link”, and keep the Destination folder set to “/”. Click Add and then click OK. You may get some warnings that the file(s) already exist, go ahead and choose to overwrite.
        • Restore the database connection. In web.config, change the connection string at configuration/EntitySpaces/connectionInfo/connections to point to a working instance of Northwind on SQL Server on the web host.
        • Add a Northwind service factory to the project. Open App_Code/Northwind.cs and make the following changes:

          // append to the "using" declarations at the top
          using System.ServiceModel.Activation;
          using System.Configuration;

          // append inside of namespace but before or after the Northwind class block
          public class NorthwindServiceHostFactory : ServiceHostFactory
          {
              protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
              {
                  // Specify the exact URL of your web service
                  Uri webServiceAddress = new Uri(ConfigurationManager.AppSettings["ServiceUri_Northwind"]);
                  NorthwindServiceHost webServiceHost = new NorthwindServiceHost(serviceType, webServiceAddress);
                  return webServiceHost;
              }
          }

          public class NorthwindServiceHost : ServiceHost
          {
              public NorthwindServiceHost(Type serviceType, params Uri[] baseAddresses)
                  : base(serviceType, baseAddresses)
              { }

              protected override void ApplyConfiguration()
              {
                  base.ApplyConfiguration();
              }
          }

        • Find the <appSettings> node of web.config (which might be collapsed as <appSettings/>, just change it to <appSettings><appSettings>) and add the following setting inside of it:

          <add key="ServiceUri_Northwind" value="http://developer.entityspaces.net/ES2008/Demos/Silverlight/PartOne/EntitySpacesSilverlightDemo_Silverlight_Web/Northwind.svc"/>
        • In web.config, under configuration/system.serviceModel/behaviors/serviceBehaviors, add:

          <behavior name="NorthwindFactoryBehavior" >
              <serviceMetadata httpGetEnabled="true" />
          </behavior>

        • Finally, under configuration/system.serviceModel/services, change

            <service behaviorConfiguration="NorthwindBehavior"  name="Northwind">

          .. to ..

            <service behaviorConfiguration="NorthwindFactoryBehavior" name="Northwind">

          .. and although I don’t think it’s used anyway with our factory, you might want to go ahead and change the <dns>localhost</dns> entry down in there to <dns>yourhost.com</dns>.

        • Build the solution. If build succeeds, ...
        • In the Silverlight project, expand the Service References node in the Solution Explorer and remove the NorthwindClient node by right-clicking it and choosing Delete. Then right-click on Service References and choose Add Service Reference. Click on Discover and choose Services in Solution. Select the FTP-based project. You may be asked to refine the URL, you will need to modify the default value to correctly reflect the accurate URL path to the Northwind.svc file on the live server.

        If you receive an error, open up a web browser and navigate directly to the URL of the Northwind.svc file. If it fails to show up, try to use the error message (Google is your friend) to drill down the problem. It may relate to something overlooked in the steps I described.

        1. Now right-click on the Silverlight project node in the Solution Explorer and build the project again.
        2. Finally, right-click on the web project node in the Solution Explorer and build the project again. This will pull the revised compiled Silverlight project into the hosted site.

        If you made it this far, all the hard stuff is over!! From here on out, it’s easy, blissful C# coding with EntitySpaces and a few XAML tweaks, no more configuration hassles.

        In Part 2 of this tutorial / demo, I’ll make the app a little bit more interactive, adding filters and the ability to make a few changes to the data. (It will be comparatively short compared to this part.) But now that you know how to link up ES objects to Silverlight over WCF, have fun and be safe!!



        EntitySpaces

        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, a Mono application, 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

        posted on Sunday, May 04, 2008 7:59:06 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Sunday, April 27, 2008
        kick it on DotNetKicks.com

        imageThe EntitySpaces 2008 Beta II is now available. The version number is 2008.0.0427.0 and is available for download now on our home page. You should uninstall any prior ES2008 alpha or beta that you may have installed. You can run ES2007 and ES2008 side-by-side. Do not install ES2008 over the top of ES2007. EntitySpaces 2008 has proven to be a big undertaking. Every EntitySpaces template has been rewritten using our new metadata engine and is now supported in both MyGeneration and CodeSmith, many were converted from VBScript to C#. However, from this point forward we start knocking off issues on our roadmap in rapid fire fashion. We are a little behind on our May 15th release date, but not too far. Not only is the trial available for download but both the Developer version and Source version are available to customers as well.

        The testing behind this release is tremendous. We have two code generators in play, C# and VB.NET templates, and to top it off we had to debug Oracle subquery issues with messages like "ORA-923 No worky, try again" (kidding, but only slightly). Throw in database independence, the Compact Framework, and you really have your hands full. However, we are over the hump now and can see the light. This is a little off topic but we cannot wait to put up our Silverlight demo showing EntitySpaces working hand-in-hand with Silverlight. Our Silverlight demo is being worked on by Jon Davis and when we saw his first cut we were very impressed, Jon is a very sharp guy indeed.

        We've made some good changes too with our installs. Both our Trial and Developer versions install exactly in the same folder structures. This will avoid confusion for those folks who use the EntitySpaces Trial for a large part of their development process and then purchase the Developer version before going live. Now you can simply install the developer version right over the top of the trial and not worry about changing reference paths. This beta comes with all providers, including our Compact Framework providers, it also comes with a SQL CE desktop provider in addition to the Compact Framework version. The beta will automatically install into both MyGeneration 1.2 and 1.3 folders and add support for CodeSmith. See the Getting Started documents on your menu after installation. There is a "Getting Started.PDF" for both MyGeneration and CodeSmith. Just a quick note for our MyGeneration customers. If you have any user meta data defined for aliases or Oracle or PostgreSQL sequences be sure to run the UserData template. It will convert the MyGeneration user data file to our new format upon first run. From that point on you maintain your user meta data via our UserData template and not through MyGeneration.

        image

        You can see by the image on the right that the runtimes are easily found in the Runtimes folder. We have both .NET 2.0 and 3.5 assemblies as well as Compact Framework assemblies (we now use CF and not Ce for those in our naming convention). Also notice that the CodeSmith templates are under the EntitySpaces 2008 folder. The "Getting Started.PDF" for CodeSmith will show you how to setup a Template Folder Shortcut in CodeSmith, it's a snap.

        Our ES2007 EntitySpaces demo still hasn't been converted thus our ES2008 demo is very lightweight. We are going to rewrite it and not just convert it so that's the reason why we've held off. There could be some minor breaking changes coming when we tackle a few things on the roadmap, however that's not the usual case for EntitySpaces. We do want to address a few things to make your lives easier though.

        We really hope a lot of our users start taking a serious look at ES2008, our Subquery and Casting support is very powerful and we will have a ton of enhancements rolling out soon as we head for the official release. We have also prototyped LINQ to SQL with EntitySpaces. And even more exciting when talking to Jon Davis about Silverlight we spoke about adding the very popular EntitySpaces DynamicQuery API to our proxies as an option. You could then issue full ES2008 dynamic queries from within Silverlight (down in the client) and from other situations such as WCF conversations where you might not have EntitySpaces on the client. All of this is to say that when we release EntitySpaces 2008 that is not the end, but the beginning.

        We are very excited about where we are going and have a great vision for EntitySpaces. Not only can we run on Mono, Medium Trust, the Compact Framework, but we can provide seamless support for Silverlight as well. Mike Griffin will be demonstrating a lot of these high end features at the Indy ALT.NET meeting on May 15th.

        So download the ES2008 Trial and if you hit a snag please post on the forums and we'll get you a speedy response.


        EntitySpaces

        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, a Mono application, 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

        posted on Sunday, April 27, 2008 9:22:04 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Wednesday, April 23, 2008

        For those of you planning on attending the first meeting of the Indy ALT.NET community group on May 15th registration is now open. However, there are only 70 slots so please only register if you plan on attending.

        Register Here ==> Indy ALT.NET, a Technical Presentation of EntitySpaces 2008

        We hope to see you there. Finally, I am no longer banned from user groups as I have been my entire life. I personally hope the ALT.NET movement really catches on as we desperately need community groups that are not controlled by Microsoft where developers such as myself are allowed to speak. In the end, it will be the .NET users who benefit by seeing great .NET technologies, applications, and speakers that they might not have seen otherwise. I know ALT.NET means many things to different people, but that's how I see it and I think it's a great idea. You can watch for ALT.NET groups at altnetpedia.

        See this POST for more information on the EntitySpaces presentation including times and location.

        =============

        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, a Mono application, 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

        posted on Wednesday, April 23, 2008 5:19:21 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Wednesday, April 16, 2008

        On May 15th Mike Griffin of EntitySpaces will be giving an in-depth technical presentation on EntitySpaces 2008 in Indianapolis. This promises to be a real "EntitySpaces Under The Hood" session so if you're near Indianapolis we hope you can attend. We have room for 70 people. More information will be provided soon but we wanted to get the word out so you can mark your calendar if you are interested. A registration site will be posted within a week so you can reserve a slot.

        When:

        Thursday, May 15th. Doors open at 5pm, pizza served, presentation starts at 6pm and should go a couple of hours. So drop in anytime after work. There will be Q&A time as well.

        Where:

        Country Inn & Suites By Carlson Indianapolis North
        9797 North Michigan Road
        Indianapolis, IN 46032
        317-876-0333

        Click here for a MAP

        EntitySpaces

        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, a Mono application, 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

        posted on Wednesday, April 16, 2008 10:37:21 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Sunday, April 13, 2008
        kick it on DotNetKicks.com

        beach


        Vacation

        If you noticed that I wasn't around much on the forums this past week you weren't imagining things. I was on vacation in Palm Beach Gardens, Florida. It's truly paradise on earth. We went to Juno Beach almost every day (don't let the Jones Beach shirt fool you). I was there with my wife and three children and we played in the waves all week, it was awesome. Maybe I'll post some other photos later. I have to admit it's a little depressing to be back in Indianapolis and it's only 39 degree's here (it was in the mid 80's all week in Florida).

        During the evenings I was able to read the new LINQ in Action book published by Manning. I was particularly interested in the LINQ to SQL functionality and how it could be applied to EntitySpaces. Well, it's been less than 24 hours since I've been home and I already have LINQ to SQL working with EntitySpaces. The LINQ in Action book is pretty good as a LINQ reference but it really kind of ticked me off otherwise. The strawman it setup in order to tear down was really blatant. I think I could take nearly all of the the supposed samples it uses to show how much better LINQ is over ADO.NET and provide appropriate samples using EntitySpaces and it would be far more intuitive. I might just do that later to make a point.

        Okay, enough ranting, let's focus on using EntitySpaces with LINQ to SQL (for Microsoft SQL Server only so far).

        EntitySpaces and LINQ to SQL

        Adding support to EntitySpaces for LINQ to SQL was pretty easy. I added [Table] and [Column] attributes from the System.Data.Linq.Mapping namespace to my "generated" Employee entity like so:


        [Table(Name="Employee")]
        public partial class Employee : esEmployee
        {
            [Column(IsPrimaryKey = true, CanBeNull = false)]
            public override int? EmployeeID
            {
                get { return base.EmployeeID;  }
                set { base.EmployeeID = value; }
            }

            [Column]
            public override string LastName
            {
                get { return base.LastName;  }
                set { base.LastName = value; }
            }

            // more properties here ...
        }

        I had to make pass through's for the properties however. Recall that the properties are in the generated esEmployee class not the generated Employee class and the esEmployee class is abstract. LINQ cannot instantiate the abstract esEmployee class and it appears that the [Table] and [Column] attributes must be on the same physical class (no inheritance allowed). So I made overrides of the properties in my Employee class, applied the attributes, and I was ready to test. For more information on the inheritance LINQ limitation see this MSDN forum post.

        After making the above changes it was time to test it and see if worked. Below is my test code.

        DataContext dataContext = new DataContext("User ID=sa;password=; ... ");

        var employees = dataContext.GetTable<Employee>();
        var query = from employee in employees where employee.Age < 50 select employee;

        foreach (Employee emp in query)
        {
            Console.WriteLine(emp.Age.ToString());
        }

        As I suspected and hoped, it worked. However, semantically this is a little different that using our DynamicQuery API. I didn't get back an EntitySpaces EmployeesCollection class. Instead I was handed a System.Linq.IQueryable<BusinessObjects.Employee> interface which I could then use to enumerate over the individual Employee objects. However, these were my true EntitySpaces objects which was kind of cool. This is all still exploratory and is slower than using the EntitySpaces DynamicQuery API but still offers valuable functionality. We're pushing hard on the next ES2008 beta and as time allows we will sneak in some of these cool new features as time allows. My guess is this will make the first release of ES2008.

        EntitySpaces

        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, a Mono application, 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

        posted on Sunday, April 13, 2008 12:32:08 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Sunday, April 06, 2008

        We are cranking very hard on EntitySpaces 2008. However, we are doing many things in parallel. We thought we would take this time to relay some of work going on here at EntitySpaces behind the scenes and to relay some long term strategy. None of these side tasks are drawing tremendous energy away from our main focus, which is, EntitySpaces 2008.

         

        Side Tasks

         

        Silverlight

         

        We are working with a Silverlight expert to create a sample that demonstrates running EntitySpaces under Silverlight. These are the scenarios we are investigating:

         

        1) Hosting the EntitySpaces assemblies under Silverlight in the browser.

        2) Hosting our lightweight proxies under Silverlight in the browser.

         

        This research is just getting underway and will let you know more soon. The idea is to make it so that you can write Silverlight pages using EntitySpaces. We know in some form this will be possible.

         

        Site Redesign

         

        EntitySpaces is undergoing a site redesign and logo change. Our goal is to make the changeover simultaneously with the release of ES2008.

         

        LINQ to SQL

         

        There is some investigation underway that might allow our Microsoft SQL users to check a checkbox during the code generation process that would allow them to use native LINQ to SQL calls to populate EntitySpaces. This is very much at the beginning of the R&D process. However, we are not creating our own LINQ provider. If we can offer you LINQ through the existing providers then we will do so. We are very committed to our DynamicQuery API and will continue to expand it in big ways. In no way will LINQ replace our DynamicQuery API.

         

        The .NET Micro Framework

         

        We will investigate this at some point after ES2008 is shipped. Whether or not it makes sense for us to support the .NET Micro Framework we are unsure of at this time. We are committed to ensuring that EntitySpaces remains tiny and continues to run under all possible .NET environments. Our Mono support and Compact Framework support will always be very important to us.

         

        Long Term

         

        After we ship EntitySpaces 2008 we will begin to solidify the design goals of our next release. The ES2008 release essentially decouples us from any particular code generator. We now use our own metadata engine and essentially only use code generators to gather the user input and execute our templates. Our templates are really just normal ASP.NET pages with <% %> tags and literal content and this is inline with our long term goals.

         

        Visual Studio Shell

         

        We have done some investigation into the Visual Studio Shell (both integrated and isolated) and we think this could be the platform we choose to go with long term. This would mean that we would no longer use code generators and instead would do the code generation ourselves. Since the Visual Studio Shell supports isolated mode this has the added advantage of still supporting the smaller shops that cannot afford Visual Studio (integrated runs inside of Visual Studio itself).

         

        The Modeler

         

        EntitySpaces will support custom domain model building. We currently generate the hierarchical object model from the foreign keys in the database. In the future, and in conjunction with the VS Shell application mentioned above, you will be able to design your own object model that is not tied to the physical database schema. However, we will not use XML or other such devices at runtime, we will simply generate the code using your virtual domain model. We will still support our current approach which is solely based on the database schema also.

         

        Template Engine

         

        Imagine a template engine that is based on snippets. Currently we have Master templates which execute sub-templates where a sub-template might be and entity class, a collection class, or query class. Our new template engine will be based on snippets. A sub-template itself would merely be a collection of snippets where each little "set" of functionality is a snippet. Writing a snippet would be very simple and within the grasp of all developers.


        A snippet could be a property creation snippet, an INotifyChanged snippet, and so on. This would allow users to swap in their own snippets as well as to share them. Our standard templates would be based on many individual snippets. To customize or extend EntitySpaces would no longer require hand changing templates, simply restack and or replace the snippets through a UI not hand editing.

        Our shell based application would have its own underlying database which would store templates and other settings. You would be working with templates graphically, where each snippet is a different colored block. You could then right mouse on a snippet and choose remove it and drag and drop other snippets from the available snippet library onto a template to further customize it. Users will be able to post snippets to an online webservice hosted by EntitySpaces that our shell app will make available to all EntitySpaces users. At some point, after ES008 ships, we will post some images of our new approach.

        We feel this is going to revolutionize the way people view code generation as we will open this up to the masses, not to just code generation experts. The Visual Studio Shell combined with our new Modeler will take our already stellar architecture to new levels.

        EntitySpaces

        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, a Mono application, 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

        posted on Sunday, April 06, 2008 11:24:03 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Monday, March 31, 2008

        The first EntitySpaces 2008 Beta is available on our download page. If you have the Alpha installed you should uninstall it before installing the Beta. There is no need to uninstall EntitySpaces 2007, you can run ES2007 and ES2008 side by side.

        Limitations

        Only our Microsoft SQL provider is supplied with this Beta and there is no Compact Framework support yet. Finally, only the C# templates are included. MyGeneration and CodeSmith are supported however in this single install.

        New Features

        The EntitySpaces 2008 Beta includes sub queries and casting.

        Changes for our MyGeneration Users

        The EntitySpaces templates for MyGeneration now use there own user meta data. You will find a new template in the root of the EntitySpaces 2008 namespace in MyGeneration called UserData. The first time you run it the template will convert your old user meta data (if any) to our new format and file name (esUserData.xml). Also, you will need to re-setup any custom settings you have made in the Settings template (replaces esPluginSettings) located in the root also.

        Also, a gentle reminder that we cannot spend our time writing complex queries for our users. Look at our samples on our blog linked under "New Features" above.

        Summary

        We are now going to start converting our other providers (including our Compact Framework providers) very rapidly. It could be that we decide to release a beta before the schedule April 27th Beta as listed on our roadmap. So if you aren't using SQL Server there might be a chance to get started before April 27th.

        EntitySpaces

        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, a Mono application, 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

        posted on Monday, March 31, 2008 2:50:18 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Saturday, March 22, 2008

        A Quick "Cast" Sample

        kick it on DotNetKicks.com

        The casting logic is now in-place for the EntitySpaces 2008 March 30 Beta release. Let's look at a few quick examples, so you can get a feel for how this new feature works. These examples are not real world scenarios, and were chosen to merely demonstrate the syntax.

        EmployeeCollection coll = new EmployeeCollection();
        EmployeeQuery q = coll.Query;

        q.Select
        (
            (
                (q.LastName + ", " + q.FirstName).Trim() + " [" + (esString)q.Age + "]"
            )
            .ToUpper().As("FirstName")
        );

        if (coll.Query.Load())
        {
            foreach (Employee emp in coll)
            {
                string fn = emp.FirstName;
            }
        }

        The sample above is a little over the top, but we wanted to show you some of the features. Notice that we Trim the results of ("LastName+ ", " + FirstName") by placing parenthesis around it, and then using Trim. However, we're not finished yet. We then continue by concatenating the Age. We cast Age into a string using the (esString) cast operator. You can use our natural language syntax throughout the EntitySpaces DynamicQuery API. 

        The resulting values for FirstName would be as follows:

        SMITH, JOHN [30]
        DOE, JANE [20]

        The SQL generated for the Query above would be as follows:

        SELECT UPPER((((LTRIM(RTRIM((([LastName]+', ')+[FirstName])))+' [')+CAST([Age] AS nvarchar))+']')) AS 'FirstName'  FROM [Employee]

        If you match-up the color coding from the EntitySpaces DynamicQuery to the resulting SQL, you can see that the (esString) resulted in a call to Cast(). Note how at various points we were able to group things with parenthesis to apply further processing, for example, Trim and ToUpper. Finally, we end the query by providing our virtual column with an alias. We even aliased it back to our FirstName column, so we could access it directly with a property instead of using GetColumn().

        Supported Cast Operators

        The cast operators supported are as follows:

        • esBoolean
        • esByte
        • esChar
        • esDateTime
        • esDecimal
        • esDouble
        • esGuid
        • esInt16
        • esInt32
        • esInt64
        • esSingle
        • esString

        More Advanced Casting

        In cases where you need a little more control, you can use the Cast() method in the query explicitly. There are three methods available.

        1. Cast(esCastType castType)                                       - Really offers nothing over the inline casting shown above
        2. Cast(esCastType castType, int length)                     - useful when casting strings
        3. Cast(esCastType castType, int precision, int scale) - useful for numeric/decimal types

        Forgive us, if these samples aren't quite real world samples:

        Employee emp = new Employee();
        emp.Query.Select(emp.Query.Age.Cast(esCastType.Decimal, 8, 4).As("CastColumn"));
        emp.Query.es.Top = 1;

        if(emp.Query.Load())
        {

        }

        This results in:

        SELECT  TOP 1 CAST([Age] AS decimal(8,4)) AS 'CastColumn'  FROM [Employee]

        If you didn't need to control the precision and scale, you could just use the syntax shown below:

        Employee emp = new Employee();
        emp.Query.Select((esDecimal)emp.Query.Age.As("CastColumn"));
        emp.Query.es.Top = 1;

        if(emp.Query.Load())
        {

        }

        This results in:

        SELECT  TOP 1 CAST([Age] AS decimal) AS 'CastColumn'  FROM [Employee]

        Summary

        Our new casting support, combined with our new SubQuery support, should add to the horsepower already provided by EntitySpaces 2007. EntitySpaces 2008 will give you a real boost when it comes to writing your EntitySpaces applications. EntitySpaces 2008 extends the DynamicQuery API significantly. All of these features are supported for all of the EntitySpaces databases.

        EntitySpaces

        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, a Mono application, 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

        posted on Saturday, March 22, 2008 6:10:33 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Saturday, March 15, 2008

        The EntitySpaces 2008 Roadmap is pretty aggressive and adds a lot of new functionality to the EntitySpaces Architecture. The EntitySpaces 2008 Alpha is already available. The remaining target dates are as follows:

        March 30th - 1st Beta

        April 27th   - 2nd Beta

        May 11th    - Official Release

        The March 30th Beta will have both CodeSmith and MyGeneration support, and will contain the C# templates, but we are unsure if the VB.NET templates will be in the March 30th release. It could be that we sneak an extra beta out if the VB.NET templates don't make the March 30th beta.


        The Roadmap

        With CodeSmith Support, SubQueries, and Casting (see below) already pretty much completed, we are working on the final major portion of the EntitySpaces 2008 release. That is some class reorganization. The big change as far as class layout for ES2008 is that we intend to make the Custom classes no longer be partial classes. This means that your Custom classes and Generated class could then be housed in different assemblies. We have theorized how this is going to work and the coding is underway, hopefully, we will not hit a snag as this has been asked for quite often. However, there is an impact. For the first time since EntitySpaces shipped, we are going to require a change to your Custom Classes. This will be easy to do however and may not require any hand coding. All of the classes in the Generated layer will now be abstract. For those who have been using EntitySpaces without generating the Custom classes, this will no longer be an option, you will need to generate them. We think the over all added flexibility more than justifies this change.

        Okay, now on to the list ...

        These are listed in no particular order

        The next provider that EntitySpaces will add to its list of supported databases will be the IBM DB2 Express database. Date of inclusion, however, has not been determined.

        But I don't see my issue here?

        Our goal is to complete all of the above by the target dates, and we are making good progress. However, the schedule is aggressive. If there is something we have missed, please post a note in our EntitySpaces 2008 forums section with ES2008 Wish - { your title }

        EntitySpaces

        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, a Mono application, 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

        posted on Saturday, March 15, 2008 12:40:02 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Sunday, March 09, 2008

        EntitySpaces 2008
        Persistence Layer and Business Objects for Microsoft .NET
         

        kick it on DotNetKicks.com

        imageWe are very excited to offer this Alpha release for those who want to get a head start with EntitySpaces 2008 (ES2008). This Alpha release supports only C# class generation from within CodeSmith, and only supports Microsoft SqlServer. A subsequent beta release will support CodeSmith, MyGeneration, C#/VB.NET classes, and all of our providers. The Alpha release comes with both .NET 2.0 and .NET 3.5 runtimes. The Alpha comes with the new, very powerful, SubQuery Enhancements to our DynamicQuery API. Please be sure to look at the "Getting Started" document that will be on your Start Menu after installation. It contains all of the information you need to get started (and it's very easy). CodeSmith users can generate their EntitySpaces classes right from within Visual Studio. Our EntitySpaces templates work well in CodeSmith project files, as well. All of our testing was done with CodeSmith 4.1.2.

        ES2008 is neutral in regards to which code generator you decide to use. ES2008 will support both CodeSmith and MyGeneration. Part of what makes this possible is that we now provide our own metadata engine. Our meta data engine is named EntitySpaces.MetadataEngine.dll, and is installed in the GAC during installation. The EntitySpaces.MetadataEngine assembly is NOT redistributable, nor can it be used to build applications. It can be used to create custom templates for EntitySpaces, but again, the EntitySpaces.MetadataEngine assembly cannot be distributed. It must be obtained from EntitySpaces, LLC. Our metadata engine uses OLEDB for accessing data. CodeSmith users can use our easy setup button on the template UI to do everything very easily. This is all covered in the Getting Started PDF.

        Our Compact Framework assemblies (although not in this beta) are being renamed to "CF" instead of "Ce". For example, EntitySpaces.Core.Ce.dll is now EntitySpaces.Core.CF.dll. This makes things much more understandable, and avoids confusion with SQL Server CE.



        image
        For a quick tutorial, see our video demonstrating how to generate your EntitySpaces 2008 Architecture HERE (13 meg)



        THE ENTITYSPACES 2008 ASSEMBLIES

        EntitySpaces.Core.dll Contains the esEntity/esEntityCollection classes
        EntitySpaces.Interfaces.dll Providers link to this assembly
        EntitySpaces.Loader.dll Loader, uses reflection
        EntitySpaces.LoaderMT.dll Loader, medium trust support (no reflection)
        EntitySpaces.MSAccessProvider.dll Provider - Microsoft Access
        EntitySpaces.MySqlClientProvider.dll Provider – MySQL
        EntitySpaces.OracleClientProvider.dll Provider – Oracle
        EntitySpaces.SqlClientProvider.dll Provider - Microsoft SQL Server
        EntitySpaces.SqlCeClientProvider.dll Provider - Microsoft SQL CE desktop provider
        EntitySpaces.VistaDBProvider.dll Provider - VistaDB
        EntitySpaces.NpgsqlProvider.dll Provider - PostgreSQL
        EntitySpaces.Web.Design.dll esDataSource (design time support for ASP.NET)
        EntitySpaces.Web.dll esDataSource (design time support for ASP.NET)
           
        Compact Framework Assemblies  
        EntitySpaces.Core.CF.dll Contains the esEntity/esEntityCollection classes
        EntitySpaces.Interfaces.CF.dll Providers link to this assembly
        EntitySpaces.Loader.CF.dll Loader, uses reflection
        EntitySpaces.LoaderMT.CF.dll Loader, medium trust support (no reflection)
        EntitySpaces.SqlCeClientProvider.CF.dll Provider - Microsoft SQL CE
        EntitySpaces.VistaDBProvider.CF.dll Provider - VistaDB CE

         
        In the list above, we have not listed any of the new providers we plan on adding. Only the Microsoft SQL Server provider is included in this Alpha, and none of the Compact Framework assemblies are included. EntitySpaces 2008 can be installed side-by-side with EntitySpaces 2007. DO NOT install EntitySpaces 2008 over the top of your EntitySpaces 2007 installation. The folder structure for ES2008 is significantly different than the ES2007 layout.

        Download the EntitySpaces 2008 Alpha Now, No Registration Necessary ==> DOWNLOAD 

        EntitySpaces

        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, a Mono application, 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

        posted on Sunday, March 09, 2008 7:57:57 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Sunday, March 02, 2008

        kick it on DotNetKicks.com

        EntitySpaces, LLC will be delivering substantial SubQuery horsepower in its 2008 release. The EntitySpaces DynamicQuery API (just one of the features of using EntitySpaces) has proven to be a very powerful tool for .NET developers. Not only is the syntax very intuitive and similar to SQL itself but it is also database independent. Even more importantly, the EntitySpaces DynamicQuery API is fully supported on the Compact Framework, Mono, and in ASP.NET Medium Trust Mode. It is also supported for Microsoft SQL and SQL CE, Oracle, MySQL, PostgreSQL, VistaDB, and Microsoft Access and will run on the .NET 2.0 Framework and higher.

        SelectAllExcept()

        SelectAllExcept() is not really a SubQuery, just a convenient enhancement that allows you to select all except one or more listed columns.

        EmployeeCollection coll = new EmployeeCollection();
        coll.Query.SelectAllExcept(
            coll.Query.EmployeeID,
            coll.Query.FirstName);
        coll.Query.Load();

        Results:

        SELECT [LastName],[Supervisor],[Age]  
        FROM [ForeignKeyTest].[dbo].[Employee]

        Select SubQuery

        A SubQuery in a Select clause must return a single value.

        OrderQuery orders = new OrderQuery("o");
        OrderItemQuery details = new OrderItemQuery("oi");
        
        orders.Select
        (
            orders.OrderID,
            orders.OrderDate,
            details.Select(
                details.UnitPrice.Max())
                .Where(orders.OrderID == details.OrderID).As("MaxUnitPrice")
        );
        
        OrderCollection collection = new OrderCollection();
        collection.Load(orders);

        Results:

        SELECT o.[OrderID],o.[OrderDate], 
            (SELECT MAX(oi.[UnitPrice]) AS 'UnitPrice'  
            FROM [ForeignKeyTest].[dbo].[OrderItem] oi 
            WHERE o.[OrderID] = oi.[OrderID]) AS MaxUnitPrice  
        FROM [ForeignKeyTest].[dbo].[Order] o

        This is the same as the query above, but returns all columns in the Order table, instead of just OrderID and OrderDate. Notice that the Select clause contains orders, not orders.*. The SQL produced will use the supplied alias o.*.

        OrderQuery orders = new OrderQuery("o");
        OrderItemQuery details = new OrderItemQuery("oi");
        
        orders.Select
        (
            orders,
            details.Select(
                details.UnitPrice.Max())
                .Where(orders.OrderID == details.OrderID).As("MaxUnitPrice")
        );
        
        OrderCollection collection = new OrderCollection();
        collection.Load(orders);

        Results:

        SELECT o.*, 
            (SELECT MAX(oi.[UnitPrice]) AS 'UnitPrice'  
            FROM [ForeignKeyTest].[dbo].[OrderItem] oi 
            WHERE o.[OrderID] = oi.[OrderID]) AS MaxUnitPrice  
        FROM [ForeignKeyTest].[dbo].[Order] o

        From SubQuery

        An aggregate requires a GROUP BY for each column in the SELECT that is not an aggregate. Sometimes you wish to include columns in your result set that you do not wish to group by. One way to accomplish this is by using a SubQuery in the From clause that contains the aggregate the way you want it grouped. The outer query contains the results of the aggregate, plus any additional columns.

        If you use a SubQuery in a From clause, you must give the From clause its own alias (shown below as "sub"). In the outer query, to refer to an aliased element in the From SubQuery, use the inline raw SQL technique to qualify the aggregate's alias with the From clause alias, i.e., "<sub.OrderTotal>".

        OrderQuery oq = new OrderQuery("o");
        OrderItemQuery oiq = new OrderItemQuery("oi");
        
        oq.Select(oq.CustID, oq.OrderDate, "<sub.OrderTotal>");
        oq.From
            (
                oiq.Select(oiq.OrderID,
                    (oiq.UnitPrice * oiq.Quantity).Sum().As("OrderTotal"))
                    .GroupBy(oiq.OrderID)
            ).As("sub");
        oq.InnerJoin(oq).On(oq.OrderID == oiq.OrderID);
        
        OrderCollection collection = new OrderCollection();
        collection.Load(oq);

        Results:

        SELECT o.[CustID],o.[OrderDate],sub.OrderTotal  
        FROM (
            SELECT oi.[OrderID],
            SUM((oi.[UnitPrice]*oi.[Quantity])) AS 'OrderTotal'  
            FROM [ForeignKeyTest].[dbo].[OrderItem] oi 
            GROUP BY oi.[OrderID]) AS sub 
        INNER JOIN [ForeignKeyTest].[dbo].[Order] o 
        ON o.[OrderID] = sub.[OrderID]

        Where SubQuery

        In and NotIn are two of the most common operators used in a Where SubQuery. The following produces a result set containing Territories that an Employee is not associated with.

        // SubQuery of Territories that Employee 1 is assigned to.
        EmployeeTerritoryQuery etq = new EmployeeTerritoryQuery("et");
        etq.Select(etq.TerrID);
        etq.Where(etq.EmpID == 1);
        
        // Territories that Employee 1 is not assigned to.
        TerritoryQuery tq = new TerritoryQuery("t");
        tq.Select(tq.Description);
        tq.Where(tq.TerritoryID.NotIn(etq));
        
        TerritoryCollection collection = new TerritoryCollection();
        collection.Load(tq);

        Results:

        SELECT t.[Description]  
        FROM [ForeignKeyTest].[dbo].[Territory] t 
        WHERE t.[TerritoryID] NOT IN (
            SELECT et.[TerrID]  
            FROM [ForeignKeyTest].[dbo].[EmployeeTerritory] et 
            WHERE et.[EmpID] = @EmpID1) 

        Exists evaluates to true, if the SubQuery returns a result set.

        // SubQuery of Employees with a null Supervisor column.
        EmployeeQuery sq = new EmployeeQuery("s");
        sq.es.Distinct = true;
        sq.Select(sq.EmployeeID);
        sq.Where(sq.Supervisor.IsNull());
        
        // If even one employee has a null supervisor,
        // i.e., the above query has a result set,
        // then run a list of all employees.
        EmployeeQuery eq = new EmployeeQuery("e");
        eq.Select(eq.EmployeeID, eq.Supervisor);
        eq.Where(eq.Exists(sq));
        
        EmployeeCollection collection = new EmployeeCollection();
        collection.Load(eq);

        Results:

        SELECT e.[EmployeeID],e.[Supervisor]  
        FROM [ForeignKeyTest].[dbo].[Employee] e 
        WHERE EXISTS (
            SELECT  DISTINCT s.[EmployeeID]  
            FROM [ForeignKeyTest].[dbo].[Employee] s 
            WHERE s.[Supervisor] IS NULL) 

        Join(query).On(SubQuery)

        SubQueries cannot be used directly within a Join(SubQuery) clause, but they can be used within a Join(query).On(SubQuery) clause.

        // Query for the Join
        OrderItemQuery oiq = new OrderItemQuery("oi");
        
        // SubQuery of OrderItems with a discount
        OrderItemQuery oisq = new OrderItemQuery("ois");
        oisq.es.Distinct = true;
        oisq.Select(oisq.Discount);
        oisq.Where(oisq.Discount > 0);
        
        // Orders with discounted items
        OrderQuery oq = new OrderQuery("o");
        oq.Select(oq.OrderID, oiq.Discount);
        oq.InnerJoin(oiq).On(oq.OrderID == oiq.OrderID &
            oiq.Discount.In(oisq));
        
        OrderCollection collection = new OrderCollection();
        collection.Load(oq);

        Results:

        SELECT o.[OrderID],oi.[Discount]  
        FROM [ForeignKeyTest].[dbo].[Order] o 
        INNER JOIN [ForeignKeyTest].[dbo].[OrderItem] oi 
        ON (o.[OrderID] = oi.[OrderID] AND oi.[Discount] IN  (
            SELECT  DISTINCT ois.[Discount]  
            FROM [ForeignKeyTest].[dbo].[OrderItem] ois 
            WHERE ois.[Discount] > @Discount1))

        Correlated SubQuery

        A correlated SubQuery is where the inner query relies on an element of the outer query. The inner select cannot run on its own. Below, the inner pq query uses the outer query's oiq.ProductID in the Where() clause.

        OrderItemQuery oiq = new OrderItemQuery("oi");
        ProductQuery pq = new ProductQuery("p");
        
        oiq.Select(
            oiq.OrderID,
            (oiq.Quantity * oiq.UnitPrice).Sum().As("Total")
        );
        oiq.Where(oiq.ProductID
            .In(
                pq.Select(pq.ProductID)
                .Where(oiq.ProductID == pq.ProductID)
            )
        );
        oiq.GroupBy(oiq.OrderID);
        
        OrderItemCollection collection = new OrderItemCollection();
        collection.Load(oiq);

        Results:

        SELECT oi.[OrderID],SUM((oi.[Quantity]*oi.[UnitPrice])) AS 'Total'  
        FROM [ForeignKeyTest].[dbo].[OrderItem] oi 
        WHERE oi.[ProductID] IN (
            SELECT p.[ProductID]  
            FROM [ForeignKeyTest].[dbo].[Product] p 
            WHERE oi.[ProductID] = p.[ProductID])  
        GROUP BY oi.[OrderID]

        Nested SubQuery

        EntitySpaces supports nesting of SubQueries. Each database vendor has their own limits on just how deep the nesting can go. EntitySpaces supports two different syntax approaches to nested SubQueries.

        Traditional SQL-style syntax is most useful if you already have a query designed using standard SQL, and are just converting it to a DynamicQuery.

        OrderQuery oq = new OrderQuery("o");
        CustomerQuery cq = new CustomerQuery("c");
        EmployeeQuery eq = new EmployeeQuery("e");
        
        // OrderID and CustID for customers who ordered on the same date
        // a customer was added, and have a manager whose 
        // last name starts with 'S'.
        oq.Select(
            oq.OrderID,
            oq.CustID
        );
        oq.Where(oq.OrderDate
            .In(
                cq.Select(cq.DateAdded)
                .Where(cq.Manager.In(
                    eq.Select(eq.EmployeeID)
                    .Where(eq.LastName.Like("S%"))
                    )
                )
            )
        );
        
        OrderCollection collection = new OrderCollection();
        collection.Load(oq);

        Results:

        SELECT o.[OrderID],o.[CustID]  
        FROM [ForeignKeyTest].[dbo].[Order] o 
        WHERE o.[OrderDate] IN (
            SELECT c.[DateAdded]  
            FROM [ForeignKeyTest].[dbo].[Customer] c 
            WHERE c.[Manager] IN (
                SELECT e.[EmployeeID]  
                FROM [ForeignKeyTest].[dbo].[Employee] e 
                WHERE e.[LastName] LIKE @LastName1) )

        Nesting by query instance name can be easier to understand and construct, if you are starting from scratch, and have no pre-existing SQL to go by. The trick is to start with the inner-most SubQuery and work your way out. The query below produces the same results as the traditional SQL-style query above. The instance names are color coded to emphasize how they are nested.

        // Employees whose LastName begins with 'S'.
        EmployeeQuery eq = new EmployeeQuery("e");
        eq.Select(eq.EmployeeID);
        eq.Where(eq.LastName.Like("S%"));
        
        // DateAdded for Customers whose Managers are in the
        // EmployeeQuery above.
        CustomerQuery cq = new CustomerQuery("c");
        cq.Select(cq.DateAdded);
        cq.Where(cq.Manager.In(eq));
        
        // OrderID and CustID where the OrderDate is in the
        // CustomerQuery above.
        OrderQuery oq = new OrderQuery("o");
        oq.Select(
            oq.OrderID,
            oq.CustID
        );
        oq.Where(oq.OrderDate.In(cq));
        
        OrderCollection collection = new OrderCollection();
        collection.Load(oq);

        Results:

        SELECT o.[OrderID],o.[CustID]  
        FROM [ForeignKeyTest].[dbo].[Order] o 
        WHERE o.[OrderDate] IN (
            SELECT c.[DateAdded]  
            FROM [ForeignKeyTest].[dbo].[Customer] c 
            WHERE c.[Manager] IN (
                SELECT e.[EmployeeID]  
                FROM [ForeignKeyTest].[dbo].[Employee] e 
                WHERE e.[LastName] LIKE @LastName1) )

        Any, All, and Some

        ANY, ALL, and SOME are SubQuery qualifiers. They precede the SubQuery they apply to. For most databases, ANY and SOME are synonymous. Usually, if you use an operator (>, >=, =, <, <=) in a Where clause against a SubQuery, then the SubQuery must return a single value. By applying a qualifier to the SubQuery, you can use operators against SubQueries that return multiple results.

        Notice, below, that the ALL qualifier is set to true for the SubQuery with "cq.es.All = true;".

        // DateAdded for Customers whose Manager  = 3
        CustomerQuery cq = new CustomerQuery("c");
        cq.es.All = true;
        cq.Select(cq.DateAdded);
        cq.Where(cq.Manager == 3);
        
        // OrderID and CustID where the OrderDate is 
        // less than all of the dates in the CustomerQuery above.
        OrderQuery oq = new OrderQuery("o");
        oq.Select(
            oq.OrderID,
            oq.CustID
        );
        oq.Where(oq.OrderDate < cq);
        
        OrderCollection collection = new OrderCollection();
        collection.Load(oq);

        Results:

        SELECT o.[OrderID],o.[CustID]  
        FROM [ForeignKeyTest].[dbo].[Order] o 
        WHERE o.[OrderDate] < ALL (
            SELECT c.[DateAdded]  
            FROM [ForeignKeyTest].[dbo].[Customer] c 
            WHERE c.[Manager] = @Manager1)

        Below, is a nested SubQuery. The ANY qualifier is set to true for the middle SubQuery with "cq.es.Any = true;".

        // Employees whose LastName begins with 'S'.
        EmployeeQuery eq = new EmployeeQuery("e");
        eq.Select(eq.EmployeeID);
        eq.Where(eq.LastName.Like("S%"));
        
        // DateAdded for Customers whose Managers are in the
        // EmployeeQuery above.
        CustomerQuery cq = new CustomerQuery("c");
        cq.es.Any = true;
        cq.Select(cq.DateAdded);
        cq.Where(cq.Manager.In(eq));
        
        // OrderID and CustID where the OrderDate is 
        // less than any one of the dates in the CustomerQuery above.
        OrderQuery oq = new OrderQuery("o");
        oq.Select(
            oq.OrderID,
            oq.CustID
        );
        oq.Where(oq.OrderDate < cq);
        
        OrderCollection collection = new OrderCollection();
        collection.Load(oq);

        Results:

        SELECT o.[OrderID],o.[CustID]  
        FROM [ForeignKeyTest].[dbo].[Order] o 
        WHERE o.[OrderDate] < ANY (
            SELECT c.[DateAdded]  
            FROM [ForeignKeyTest].[dbo].[Customer] c 
            WHERE c.[Manager] IN (
                SELECT e.[EmployeeID]  
                FROM [ForeignKeyTest].[dbo].[Employee] e 
                WHERE e.[LastName] LIKE @LastName1) )

        Some Final Thoughts

        The examples given above were designed to demonstrate (and test) usage in a variety of settings. They are not necessarily the simplest, or most efficient, way to achieve the desired result set. Think of them as an API usage guide, not as design guidelines. Most SubQueries can be re-written as Joins, and most Joins can be re-written as SubQueries. If, while coding, you are having trouble conceptualizing one approach, then try the other.

        Technically, a JOIN's ON clause can take almost any where_condition, and EntitySpaces supports many of these, including SubQueries. But, we agree with most authorities on the subject, that the ON clause should be reserved for the conditions that relate the two tables. All other conditional statements should be placed in a WHERE clause. Typically, the ON clause only contains a column from each table and a comparison operator.

        For example, take the Join(query).On(SubQuery) example above. The much simpler query below returns the same result set. Its Where() clause not only simplifies the On() clause, but eliminates the SubQuery completely.

        // Query for the Join
        OrderItemQuery oiq = new OrderItemQuery("oi");
        
        // Orders with discounted items
        OrderQuery oq = new OrderQuery("o");
        oq.Select(oq.OrderID, oiq.Discount);
        oq.InnerJoin(oiq).On(oq.OrderID == oiq.OrderID);
        oq.Where(oiq.Discount > 0);
        
        OrderCollection collection = new OrderCollection();
        collection.Load(oq);

        Now might be a good time to point out that we are not in the complex query creation business. If you post a bunch of SQL, and ask, "How do I do this in EntitySpaces?", you may, or may not, get much of a response. The Peer to Peer forums are your best bet for that kind of post. On the other hand, if you post an EntitySpaces DynamicQuery that is throwing an exception, or producing inaccurate results, you will find us eager to resolve the issue.

        We are going to need your help, however. As always, post the database and EntitySpaces version, the relevant code, the exception (if any), and the stack trace. We do not have your database schema, so if you can narrow down the issue using Northwind or pubs, that is a tremendous help. Posting obj.Query.es.LastQuery can provide valuable clues.

        EntitySpaces

        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, a Mono application, 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

        posted on Sunday, March 02, 2008 10:40:32 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Thursday, February 28, 2008
        We are calling this an Alpha however EntitySpaces is well tested. The alpha will have passed all of our unit tests so it will be very stable. The only reason we are not calling it a Beta is that initially we are only supplying the C# templates, our VB.NET templates will follow in the subsequent Beta. You will not have to register on our site to download the Alpha (same goes for our trial versions).

        If you are a CodeSmith fan consider taking a look at EntitySpaces, here are some of the features:

        • Mono Support
        • Medium Trust Support
        • Compact Framework Support
        • Hierarchical Data Models
        • Powerful Dynamic Query API
        • Data Provider Independence
        • Binary and XML Serialization
        • Two Different Transaction Models
        • Saving via Stored Procedures or Dynamic SQL
        • Design Time Data Binding
        • Generated from your Database Schema
        • LINQ Support for Collections 
        • Regenerate Without Losing Custom Business Logic
        • Admin Grid Template Suite for ASP.NET
        • Admin Grid Template Suite for DotNetNuke
        • Source Code Available

        Providers Available:

        • Microsoft SQL Server / SQL CE
        • Microsoft Access
        • Oracle
        • MySQL
        • VistaDB 
        • PostgreSQL  
        EntitySpaces

        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

        posted on Thursday, February 28, 2008 9:33:52 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Thursday, February 21, 2008

        In mid March we are going to offer an Alpha release of EntitySpaces 2008 (ES2008) for CodeSmith users. If you are a MyGeneration fan don't worry, your support will be in the Beta release of ES2008 the date of which hasn't been announced yet. This is an image heavy post and we apologize for that, it was really the best way to demonstrate our CodeSmith support. For those interested in code generation if you follow along you will see just how easy our new code generation syntax is.

        This post will serve to introduce to you our new EntitySpaces esMetadataEngine which is a pure C# assembly that doesn't rely on COM interop. The esMetadataEngine combines some of the best features of the MyMeta engine from MyGeneration and also combines the esPlugIn assembly and the Dnp.Utils assembly all into a single assembly which is installed in the GAC. Our esMetadataEngine supports Microsoft SQL Server and SQL Server CE, Oracle, MySQL, PostgreSQL, VistaDB, and Microsoft Access. Other database engines will be added as we add support for them. The esMetadataEngine works equally well under both CodeSmith and MyGeneration. For those wishing to extend and customize EntitySpaces we think you are really going to like the EntitySpaces esMetadataEngine.

         

        image

        In the CodeSmith Template Explorer (shown above) we use the right mouse button to execute our "Generated Classes Master (C#)" template. Take a look at the user interface shown below.

        image 

        Because we use our own metadata engine and not the CodeSmith Schema Explorer we need to provide our own connection information. However, we make this very easy. Notice the little " ... " button above on the "CLICK HERE FOR EASY SETUP" property. When you click on that button you will be presented with the dialog shown below.

        image

        In our setup dialog above you can connect to your database and choose any number of tables (multiple selection) or views for which to generate EntitySpaces classes. Once you press the "Ok" button we work some "magic" and all of the appropriate properties in the CodeSmith property dialog are auto-filled with your selections.

        image

        In the image above you can see how the ConnectionString, Database, and Entities have now been populated. If you click on the Entities property you will see that it is a normal CodeSmith StringCollection and will be presented as follows (shown below) if you were drill into that property.

        image

        Again, our easy "SetupDialog" makes all this setup painless and supports multiple selection for your tables and views. You can generate your entire EntitySpaces 2008 Architecture in a single template run. We play well and fully support CodeSmith projects as well.

        Our Master Template


        So let's take a look at how the esMetadataEngine makes life very simple. Take a look at our Master template shown below.

         

        image

         

        First we register and import our esMetadataEngine assembly followed by the registration of our subtemplates (which you can see in the first image in this post). Next, we declare our user interface properties. This is all pretty straightforward for the average CodeSmith developer.

         

        image

        The image above shows how we create an instance of the esMetadataEngine and connect it to the database using the UI properties from the CodeSmith property grid. Next, we add all of the user interface variables to a Hashtable built into the esMetadataEngine for just such a purpose (the sub templates will grab their values from here). Remember, we want our templates to be 98% the same for both CodeSmith and MyGeneration (and they are).

        image

        The above image shows how we instantiate all of our subtemplates being sure to hand them a reference to the esMetadataEngine.

        image


        The master template simply loops through a list of entities (tables or views) chosen by the user and invokes each subtemplate within a foreach loop asking it to RenderToString() its content. That's pretty much our entire master template. You'll be even more impressed at how simple our subtemplates look (and are to to create).

        A Subtemplate

        Now, let's take a quick look at one of the subtemplates.

         

        image


        The above image shows an entire subtemplate. Notice that there is no looping. The master template does the looping and calls the subtemplate for each table or view selected by the user. A subtemplate will extract the UI variables it needs from the esMetadataEngine.Input Hashtable. Notice also the syntax "esMeta.esPlugIn", this shows our ES2007 esPlugIn has been built right into the esMetadataEngine. Finally, at the bottom you can see the "TheMetaData" property that the master template uses to pass itself to the subtemplate. Granted the above template is a very simple subtemplate but it should give you an idea of how this all works. I loved the full intellisense and easy debugging built into CodeSmith as well.

        What is important is that other than the few tags at the very top there is no native CodeSmith API calls in any of our subtemplates. The master templates account for the 2% difference we will have between our CodeSmith and MyGeneration support. Basically, the master templates deal with the unique UI techniques and subtemplate execution methodologies between CodeSmith and MyGeneration (which is very easy to handle). The subtemplates are nearly and entire wholesale copy paste between code generation engines. Now, if you're looking forward to customizing and extending EntitySpaces and even sharing templates with others this is how you want to do it, and you can reach out to both CodeSmith and MyGeneration users. This isn't the whole story however, still much to come concerning customizing and extending.

        However, code generation enhancements are not all we are doing. In our team meeting tonight I was shown our SubQuery unit test fixture an almost flipped. In about a week we are going to do an amazing blog post on SubQueries that promises to really WOW you.

        EntitySpaces

        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

        posted on Thursday, February 21, 2008 12:28:54 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Friday, February 15, 2008
        kick it on DotNetKicks.com

        Imagine never having to leave Visual Studio while creating and shaping your EntitySpaces based application. Simply pop into the "CodeSmith Explorer", right mouse on our "Master Template", execute it, include the newly generated files into your solution, compile, and you're off and running in a matter of a few minutes. So Sweet.

        CodeSmith

        We are very excited about our upcoming CodeSmith support for ES2008 and will post more as soon as we are generating a complete EntitySpaces based application from within Visual Studio.

        EntitySpaces

        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

        posted on Friday, February 15, 2008 7:52:00 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Sunday, February 10, 2008

        If you are an EntitySpaces customer, then you know how serious we take our forum support. When issues or feature requests are posted in our forums, we create a ticket in our Trac system. This Trac ticket will have a description of the issue, offer some thoughts and comments on it, and finally tie the ticket back to the originating forum post via a URL. Before each EntitySpaces release, the EntitySpaces team will, in one of our weekly Skype meetings, go through the Trac system and create a milestone, which typically consists of several key new features and a list of issues as reported in the forums. Below is a (partial) snapshot of our first ES2008 Beta milestone, however, the 0315 date is not to be taken literally, it could be before or after that date.

        The key to the success of EntitySpaces lies in it's ease of use, which in large part comes from an elegant and intuitive API. However, none of that would matter if it wasn't backed by excellent forum support, tracking issues as they are reported, and extensive unit testing. Sometime in the ES2008 cycle we will do a blog post describing how our unit testing methodology is used to deliver a rock solid architecture to our customers.

        image 

        EntitySpaces

        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

        posted on Sunday, February 10, 2008 10:48:33 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Thursday, February 07, 2008
        kick it on DotNetKicks.com

        We're busy working on EntitySpaces 2008 (ES2008) and thought we would demonstrate to you how subqueries will work. If you are familiar with our Join syntax then subqueries will feel like a perfect extension. The EntitySpaces 2008 architecture allows subqueries on the Select, the Where, the From, and the Join statement. Before we look at subqueries take a moment to review how our join syntax works. The EntitySpaces DynamicQuery API has proven to be very popular, so much so that other architectures are following suit.

        EntitySpaces Join Syntax Review

        Notice that we create three query objects and then relate them through InnerJoins and finally ask the CustomerCollection to load the query.

        CustomerQuery cust = new CustomerQuery ("c");
        OrderQuery order = new OrderQuery ("o");
        OrderItemQuery item = new OrderItemQuery ("oi");

        cust.Select(cust.CustomerName, (item.Quantity * item.UnitPrice).Sum().As("TotalSales"));
        cust.InnerJoin(order).On(order.CustID == cust.CustomerID);
        cust.InnerJoin(item).On(item.OrderID == order.OrderID);
        cust.GroupBy(cust.CustomerName);
        cust.OrderBy("TotalSales", esOrderByDirection.Descending);

        CustomerCollection coll = new CustomerCollection ();
        coll.Load(cust);

        Pretty sweet and that is supported in ES2007 which is shipping now. But we're just getting started. Now let's look at some subquery samples.

        EntitySpaces SubQuery in the Select Statement

        This subquery determines the Maximum Unit Price for each order in the system.

        OrdersQuery orders = new OrdersQuery("orders");
        OrderDetailsQuery details = new OrderDetailsQuery("details");

        orders.Select
        (
            orders.OrderID,
            orders.OrderDate,
            details.Select(details.UnitPrice.Max()).Where(orders.OrderID == details.OrderID).As("MaxUnitPrice")
        );
        OrdersCollection coll = new OrdersCollection();
        coll.Load(orders);

        The resulting SQL generated by our SqlClientProvider is as follows.

        SELECT orders.[OrderID],orders.[OrderDate],
        (
            SELECT MAX(details.[UnitPrice]) AS 'UnitPrice' 
            FROM [Northwind].[dbo].[Order Details] details
            WHERE orders.[OrderID] = details.[OrderID]
        ) AS MaxUnitPrice 
        FROM [Northwind].[dbo].[Orders] orders

        The resulting data is as follows:

        OrderID     OrderDate               MaxUnitPrice
        ----------- ----------------------- --------------
        10248       1996-07-04 00:00:00.000    34.80
        10249       1996-07-05 00:00:00.000    42.40
        10250       1996-07-08 00:00:00.000    42.40
        10251       1996-07-08 00:00:00.000    16.80
        10252       1996-07-09 00:00:00.000    64.80
        10253       1996-07-10 00:00:00.000    16.00
        10254       1996-07-11 00:00:00.000    19.20
        10255       1996-07-12 00:00:00.000    44.00
        10256       1996-07-15 00:00:00.000    26.20

        EntitySpaces SubQuery in the From Clause

        Now let's look at using a subquery used in the From clause which returns the average freight per company.

        OrdersQuery o = new OrdersQuery("o");

        CustomersQuery c = new CustomersQuery("c");
        c.Select(c.CompanyName, c.Country, o.Freight);
        c.From
            (
                o.Select(o.CustomerID, o.Freight.Avg()).GroupBy(o.CustomerID)
            ).As("s");
        c.InnerJoin(c).On(c.CustomerID == o.CustomerID);

        CustomersCollection coll = new CustomersCollection();
        coll.Load(c);

        The resulting SQL generated by our SqlClientProvider is as follows.

        SELECT c.[CompanyName],c.[Country],s.[Freight] 
        FROM
        (
            SELECT o.[CustomerID],AVG(o.[Freight]) AS 'Freight' 
            FROM [Northwind].[dbo].[Orders] o
            GROUP BY o.[CustomerID]
        ) AS s
        INNER JOIN [Northwind].[dbo].[Customers] c
        ON c.[CustomerID] = s.[CustomerID]

        The resulting rows look like this:

        CompanyName                              Country         Freight
        ---------------------------------------- --------------- -------
        Alfreds Futterkiste                      Germany         37.5966
        Ana Trujillo Emparedados y helados       Mexico          24.355
        Antonio Moreno Taquería                  Mexico          38.36
        Around the Horn                          UK              36.3038
        Berglunds snabbköp                       Sweden          86.64
        Blauer See Delikatessen                  Germany         24.0371
        Blondesddsl père et fils                 France          56.6963
        Bólido Comidas preparadas                Spain           63.7233
        Bon app'                                 France          79.8747
        Bottom-Dollar Markets                    Canada          56.7107

        EntitySpaces SubQuery in the Where Clause

        Here we have returned a list of countries where customers live where there is no supplier located in that country. Here we pass a subquery to the NotIn() operator.

        SuppliersQuery supp = new SuppliersQuery("supp");
        supp.es.Distinct = true;
        supp.Select(supp.Country);

        CustomersQuery cust = new CustomersQuery("cust");
        cust.es.Distinct = true;
        cust.Select(cust.Country);
        cust.Where(cust.Country.NotIn(supp));

        CustomersCollection coll = new CustomersCollection();
        coll.Load(cust);

        The resulting SQL generated by our SqlClientProvider is as follows:

        SELECT DISTINCT cust.[Country] 
        FROM [Northwind].[dbo].[Customers] cust
        WHERE cust.[Country] NOT IN
        (
            SELECT DISTINCT supp.[Country] 
            FROM [Northwind].[dbo].[Suppliers] supp
        )

        The resulting rows look like this:

        Country
        ---------------
        Argentina
        Austria
        Belgium
        Ireland
        Mexico
        Poland
        Portugal
        Switzerland
        Venezuela

        Although not shown here it is also possible to use a subquery in the Join statement. Of course, subqueries can be nested in various ways too. We hope this gives you a glimpse of what is coming in ES2008. We are making great progress. The beauty of course is this will work on all of the databases we support.

        EntitySpaces

        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

        posted on Thursday, February 07, 2008 10:31:21 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Saturday, February 02, 2008
        kick it on DotNetKicks.com


          

        That's right ... "EntitySpaces running under Mono on Linux using MySQL as the backend".

         

         

        If you are an EntitySpaces customer, you can now travel anywhere. From Windows, to Mono/Linux solutions, to the Compact Framework and all kinds of wireless devices, to Web Applications including "Medium Trust" support, or to high-end Enterprise Applications, EntitySpaces can take you there. EntitySpaces is truly a tiny, lightweight, powerful architecture for the Microsoft.NET Framework, and uses zero reflection. If you are a Mono developer, EntitySpaces is a terrific architecture for you. With it, you can work on both sides of the isle. Our database independence can free you from most of the complexities of supporting many types of databases, including those that run under Mono, such as MySQL and VistaDB. No longer will you have to invent new architectures with every new challenge that comes down the road.

        Our contest winner goes by the title Pro.Coder, and is a independent contractor. We have received his entry to our Mono contest, and were quite pleased. Pro.Coder sent us a DVD with the EntitySpaces demo running under Mono. Thank you Pro.Coder, you did an excellent job. An image of it is shown below. Pro.Coder added the CRUD and DynamicQuery Join examples, to satisfy our contest requirements.

         

        image

        Below are some comments we received with Pro.Coder's DVD on how he got our EntitySpaces Demo to run under Mono ...

        As for EntitySpaces on Mono application development, I did the following Steps:

        1. Download and Install Latest Version My Generation 
        2. Download and Install Latest Trial Version Of EntitySpaces 2007 
        3. Download and Install Latest Version of MySQL Community Edition
        4. Download and Version 5.0.7.0 of MySQL .net/Connector (Otherwise EntitySpaces gives Version conflict error)
        5. Download and Install Latest Version of Mono for windows
        6. Download and Install Latest Version VMware Player
        7. Download Mono Suse 10.2 VMware Virtual Machine
        8. Imported the Northwind database to MySQL from Sql Server
        9. Created CRUD procedures for MySQL Northwind database using My Generation EntitySpaces Template

        Once all the installation was done, I was ready develop EntitySpaces on Mono. I used Visual Studio 2005 to develop, and used Mono to test it first on Windows. Once everything was working, I used VMware player and Mono Suse 10.2 VMware Virtual Machine to test it on Linux.

        Instead of developing an application from scratch, I used the VB.net example that was shipped with the Trial version of EntitySpaces 2007. The first thing I did was to make EntitySpaces use the configless connection string support, which was very easy. Then, I started the build and debug process. From the features I have tested, CRUD process and Dynamic Query all work fine. While modifying the example application, the main issues I faced were:

        Data Binding and Windows Forms
        Binding the Windows Forms DataGrid Control to a Data Source
        Binding Class
        BindingContext Class
        BindingsCollection Class 

        I think many methods and properties are not yet supported on Mono. Maybe they are supported, and I just have to do some tweaking. I'm not sure. I have not yet gone through the Mono documentation. Grid.DataSource = EntityCollection gives a type conversion error, so I used CreateColumnsForBinding. Even after using it, I still got type conversion error. I'm not sure what exactly CreateColumnsForBinding is for. I thought it should correct it. So, as it didn't work, I did the next best thing, and added a ToDataTable() method to collection class and used it to bind to the grid.

        EntitySpaces

        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

        posted on Saturday, February 02, 2008 11:02:11 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Thursday, January 31, 2008
        kick it on DotNetKicks.com

        If you are a CodeSmith guru, and well versed in writing CodeSmith templates, you are the kind of person we are looking for. We have a set of templates written for MyGeneration that we would like ported to CodeSmith. This will be pretty easy actually, as we have our own assemblies that will all run under CodeSmith. We use the MyMeta engine, which is now under the BSD license, and therefore can run under CodeSmith, as well. So, basically, we just need our templates converted, but the "core" of the templates will run as is. There is very little code that actually needs converting. Once you've done one of them, the rest will fall right into place. We have two sets of templates, one that creates our C# architecture, and one that creates our VB.NET architecture, but both sets of templates are written in C#.

        There are two master templates (they have a simple UI), and eleven sub templates (no UI) per language (C# and VB.NET). If you, or your company, are interested in contracting out to convert these templates, please reply to this thread, or send an email to support @ entityspaces dot net. This is something we are ready to start on immediately.

        EntitySpaces

        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

        posted on Thursday, January 31, 2008 8:24:02 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Saturday, January 19, 2008
        kick it on DotNetKicks.com

        This is only a preview of some of the big things planned for ES2008, this is not the roadmap. There are many items such as esDataSource improvements and various fixes that will be covered in the roadmap which will be published soon. ES2008 is going to roll out a little differently than have our past releases. Rather than rolling out releases at a rapid rate we are going to have two main releases for ES2008. This will result in greater productivity for the EntitySpaces team, and greater functionality for our customers, as the act of cutting a release itself burns a lot of cycles. We have dates in mind for these releases and they will published in the official roadmap. We have created a special place in our forums to talk about this preview and our upcoming roadmap when released, that is the place to make your wishes and concerns known. Let's take a very high level look at some of these key features.

        New Code Generation Model

        The EntitySpaces team has decided a new code generation model is needed for several reasons. One of the main reasons we have chosen a new model is to make it easier for customers to extend EntitySpaces. However, this new model will also make development much easier for the EntitySpaces team as well. The new EntitySpaces code generator will operate as an ASP.NET website hosted on your local machine or on a server within in your organization. However, even though we have chosen this approach we are not precluded from running these same templates under the CodeDOM model in the future as CodeSmith templates can use code behind pages. Here are some of the advantages of going to a pure ASP.NET website based code generation model.

        • No need to write our own code generator as ASP.NET itself can execute the templates naturally.
        • Developers are already familiar with this model.
        • Full Intellisense including Intellisense for our new esMetadataEngine.
        • Easy debugging, just step right into your templates while in Visual Studio (including Express versions).
        • Custom Objects can be formed that are different than what the database schema describes (true mapping).
        • Better template recording and playback capabilities.

        Take a look at this high level diagram

        image

        We have received some very good input on our forums that had an impact on the feature set for ES2008, specifically, the concept of a template stack. The EntitySpaces Core templates will be required and generate the main classes. The EntitySpaces Optional templates are just that, optional, and will generate things such as our WCF proxy classes. The Custom User templates are templates written by our customers. These templates can be created, shared, even sold by 3rd party developers. We hope to have a place where customers can publish their templates, and our code generator will be able to display those for you and you can then optionally pull them down for inclusion into your template stack. The concept behind the template stack is that customers can both extend EntitySpaces with new functionality, and replace standard functionality that we provide in the optional templates, by swapping our templates out and theirs in. The idea is that users can really begin to customize EntitySpaces without the fear of losing edits to templates. These templates are written as .ASCX controls with code behind pages, and therefore, support for CodeSmith is one of our goals as well. Our templates will be written in C# as they are now, however EntitySpaces will continue to generate both C# and VB.NET architectures as always.

        Our new esMetadataEngine will be different from the MyMeta engine in MyGeneration. It will not support JScript or VBScript and therefore will have no need for COM Interop, nor the need to be registered in the registry. In addition to reading the metadata from your database schema, our new esMetadataEngine will be able to serve up the metadata for custom designed objects, or mapped objects created by the customer that represent objects not specifically described in the database. Also, the esMetadataEngine will not be "hard-bound" to any 3rd party ADO.NET providers eliminating upgrade issues when vendors publish new providers. Of course, the esMetadataEngine will be based on the Factory pattern, and allow 3rd parties to add support to EntitySpaces for databases not supported by the EntitySpaces team.

        Most likely the data behind our new ASP.NET code generation model will be saved in an SQL CE ".sdf" database. This will include things such as configuration data, connection strings, and template stack information.

        EntitySpaces Class Streamlining

        The generated EntitySpaces classes are going to be streamlined. A lot of the functionality that can be pushed down in the EntitySpaces "Core" will be, while many other things like the ".str" methods, and so on, are going to be made optional. Also, you will be able to have null constructors in your Custom classes. Basically, you will be able to generate bare bones EntitySpaces classes, and then, enhance them as you see fit using our new customizable template stack approach. Remember, 3rd parties can publish their templates for inclusion into your stack. There could be a few minor breaking changes as a result of this streamlining but we hope to keep them to a minimum, as we think we have one of the best APIs in the business.

        DynamicQuery API Enhancements

        We will be adding some powerful enhancements to further expand the power of the EntitySpaces DynamicQuery API.

        We will be adding the ability to perform SubSelects at various places within the DynamicQuery API. A SubSelect will merely be another DynamicQuery inserted somewhere in the syntax. This is not unlike how our joins are performed. Let's take a look at a sample SubSelect statement.

        ProductsQuery avg = new ProductsQuery("a");
        avg.Select(avg.UnitPrice.Avg());

        ProductsCollection p = new ProductsCollection("p");
        p.Query.Select(p.Query.ProductName);

        p.Query.Where(p.Query.UnitPrice > avg);  // <= SubSelect
        p.Query.Load();

        This will generate the following SQL:

        SELECT p.ProductName
        FROM Products p
        WHERE p.UnitPrice>(SELECT AVG(a.UnitPrice) From Products a)

        We will also be adding native language casting operations. There are many times when you need to coerce a data type from one type to another in SQL syntax, and currently, there is no way to express this in EntitySpaces. Below is an example of how this will work.

        EmployeesCollection coll = new EmployeesCollection();
        coll.Query.Select
        (
            (coll.Query.LastName + " was hired on " +
                (string)coll.Query.HireDate).As("VirtualColumn")
        );
        coll.Query.Load();

        In the sample above the (string) cast will result in the appropriate SQL being generated for the type of the database being accessed, for SQL this would be either the CAST or CONVERT function for instance to convert the SQL datetime to a varchar for concatenation.

        EntitySpaces DataProvider Enhancements

        Do not confuse these DataProviders with esMetadataEngine providers. EntitySpaces DataProviders are the providers used by EntitySpaces during runtime to access a database, not the providers used during code generation. These are the enhancements planned for ES2008.

        • IBM DB2 Express support.
        • VistaDB 3.3x support with VistaDB Stored Procedure Generation.
        • SQL CE Desktop Support.
        • 3rd Party Support will be enabled.

        Summary

        We know this is a lot to tackle for ES2008 and that is why we have chosen to roll this out in two releases rather than a bunch of smaller ones. We will be doing a lot of blogging on this, dive much further into various pieces, and hopefully elicit some feedback from our customer base. Also, we will publish a detailed roadmap for ES2008 in a few weeks.

        EntitySpaces

        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

        posted on Saturday, January 19, 2008 6:45:09 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Thursday, December 06, 2007

        mono

         

        EntitySpaces, LLC is offering $1,000 U.S. dollars to the first person or company to successfully create an EntitySpaces application that runs under Mono version 1.2.5.1 or higher and does so within the constraints of the rules outlined below. We will also make a follow up blog post announcing the winner which could help push traffic to your site if you are interested (and make you famous for at least 15 minutes).

        The Rules

        1. The Application or Website must use Mono version 1.2.5.1 or higher.
        2. The Application must use EntitySpaces 2007 v1119 or higher.
        3. The Application must insert, update and delete data from the database using our standard EntitySpaces generated classes via the Save() method.
        4. The Application must use the EntitySpaces DynamicQuery API to perform a join and display the results.
        5. The Application must be created as an image in the "VMware Virtual Image" file format as found on http://www.mono-project.com/Downloads so that we can run it out of the box with no modifications.
        6. The image mentioned above in rule 5 must be submitted on a CD. 
        7. All submissions become the property of EntitySpaces, LLC and we reserve the right to make them available for marketing purposes.
        8. Your Submission must be received by January 31st, 2008 (only the first working solution submitted by January 31st, 2008 will receive the $1,000 U.S. dollars prize money).

        If you are interested write to support@entityspaces.net and we can tell you where to forward your submission.

        Most likely this application will use MySql or VistaDB as those are two of the databases we support that run under Mono (others we support might also run under Mono). Also, you might need to use the configless connection support for EntitySpaces configuration information. If you run into issues we are willing to work with you, however we are fairly confident that our assemblies are mono compliant. Of course, the nicer the UI the better, but the idea is to show off EntitySpaces running under Mono.


        kick it on DotNetKicks.com 

        EntitySpaces

        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

        posted on Thursday, December 06, 2007 6:15:10 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Saturday, December 01, 2007
        image

         

        Our mid-December maintenance release for v1119 offers a new class, the esEntityCollectionView. The esEntityCollectionView acts like the ADO.NET DataView class only for EntitySpaces Collections. This new class will allow you to have multiple views on the same collection each with a different sort and filter acting independently of other views. Also, the esEntityCollectionView class does not effect the Sort or the Filter properties on the collection itself. This means that you can use a collection as a cache and have various views on it displayed throughout your application. You can use the foreach syntax against the esEntityCollectionView class as well as the indexer (the foreach syntax is faster).

        The esEntityCollectionView class uses the .NET Generic syntax mechanism. We really haven't needed to create many "generic" classes since we use code generation techniques to create our classes. It is too bad Microsoft didn't stick with the term "Template class" from the C++ world because this more clearly defines what the "generic" mechanism does. The compiler see's the "generic" class and literally generates a class (behind the scenes) for each type it encounters. So, you can think of a generic class as a template that is code generated at compile time, and since we code generate everything we haven't needed to use generics that often.

        The new esEntityCollectionView is very useful, but it will not assume full power until EntitySpaces 2008 which will add full binding support to the esEntityCollectionView class. However, the LowLevelBind method is implemented which will let you bind directly to the underlying DataView.

        Let's look a sample to get a feel for how to use this new class. In this case we create a collection and load all of the records, then we create two views on the collection and filter different ways and use the foreach syntax to enumerator over the collection. Notice both views operate independently of on another. If there was a sort or filter directly on the collection the views would be unaffected as well.

        EmployeesCollection coll = new EmployeesCollection();
        coll.LoadAll();

        esEntityCollectionView<Employees> view1 = new esEntityCollectionView<Employees>(coll);
        esEntityCollectionView<Employees> view2 = new esEntityCollectionView<Employees>(coll);

        view1 .Filter = "LastName = 'Griffin'";
        view2 .Filter = "LastName <> 'Griffin'";

        foreach (Employees emp in view1 )
        {
            string s = emp.LastName;
        }

        foreach (Employees emp in view2 )
        {
            string s = emp.LastName;
        }

        // Show how to use the indexer ...
        Employees e = view2 [10] as Employees;

        We are sure that when EntitySpaces 2008 comes out you will find the esEntityCollectionView classes to be extremely useful. Not only will we build full data binding into it (as exists on the esEntityCollection) but thread synchronization too. The esEntityCollectionView class is perfect for use on cached collections. We are also implementing lots of tweaks/fixes as we gather them from the forums as well for our mid-December release which will include the esEntityCollectionView class.


        kick it on DotNetKicks.com

        EntitySpaces

        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

        posted on Saturday, December 01, 2007 11:03:56 AM (Eastern Standard Time, UTC-05:00)  #    Comments [1]
         Tuesday, November 20, 2007

        Now that EntitySpaces 2007.1.1119.0 has been released we thought we would start a series of blog posts that highlights some of API enhancements. The most obvious place to begin is the Dynamic Query API as that is what many of our customers work in every day. We start off with some simple queries and work up to more complex queries.

        Query - Simple select with where clause

        Here is a simple query that brings back only the FirstName column for only those records that begin with the letter "M". Notice we use the % sign to indicate any characters after. You also use the % signs for all other supported databases. The EntitySpaces data providers will adjust accordingly for all other databases. Also, notice that we are using the built in query object on the collection itself. We recommend that you use this syntax always when there is no join involved.

        EmployeesCollection coll = new EmployeesCollection ();
        coll.Query.Select(coll.Query.FirstName);
        coll.Query.Where(coll.Query.FirstName.Like("M%");
        if(coll.Query.Load())
        {
            // at least one record was loaded
        }

        The resulting SQL:

        SELECT [FirstName]  FROM [Northwind].[dbo].[Employees] WHERE [FirstName] LIKE @FirstName1

        Query - Arithmetic operators and complex where clause with AND/OR

        This query shows off some of the natural language features of the EntitySpaces Dynamic Query API. Notice the use of the + operator to concatenate the FullName and LastName and providing the new derived column with an alias. Also notice the Where clause and it's use the | operator. You can use & for AND and | for OR and you can use ( ) for precedence.

        EmployeesCollection coll = new EmployeesCollection ();
        coll.Query.Select((coll.Query.LastName + "," + coll.Query.FirstName).As("FullName"));
        coll.Query.Where(coll.Query.City == "Indianapolis" | coll.Query.Region == "Northeast");
        if(coll.Query.Load())
        {
            // at least one record was loaded
        }

        The resulting SQL:

        SELECT ([LastName]+','+[FirstName]) AS 'FullName'  FROM [Northwind].[dbo].[Employees] WHERE ([City] = @City1 OR [Region] = @Region2)

        Query - Aggregates with OrderBy and GroupBy

        This query shows off some of the natural language features of the EntitySpaces Dynamic Query API. Notice the use of the + operator to concatenate the FullName and LastName and providing the new derived column with an alias. Also notice the Where clause and it's use the | operator. You can use & for AND and | for OR and you can use ( ) for precedence. Also, we had to use two calls to OrderBy because of the dynamic column created by the alias, however, you can pass multiple columns in like this -> coll.Query.OrderBy(coll.Query.ProductID.Descending, coll.Query.CategoryID.Ascending)

        OrderDetailsCollection coll = new OrderDetailsCollection ();
        coll.Query.Select
        (
            coll.Query.ProductID,
            (coll.Query.Quantity * coll.Query.UnitPrice).Sum().As("TotalPrice")
        );
        coll.Query.GroupBy(coll.Query.ProductID);
        coll.Query.OrderBy(coll.Query.ProductID.Ascending);
        coll.Query.OrderBy("TotalPrice", esOrderByDirection.Ascending);
        if(coll.Query.Load())
        {
            // at least one record was loaded
        }

        The resulting SQL:

        SELECT [ProductID],SUM(([Quantity]*[UnitPrice])) AS 'TotalPrice'  FROM [Northwind].[dbo].[Order Details] GROUP BY [ProductID] ORDER BY [ProductID] ASC,[TotalPrice] ASC

        Query - Join Syntax

        Notice the syntax here is a little different. When creating join based queries you do not use the embedded query object on the collection, you create your own and be sure to give it an alias. When you are not creating a join use the embedded query object as the examples above show. Also, in join scenarios you can select all from a particular column by passing the query into the select statement as follows -> Select(cust, order.OrderId) in this example the select will be Customer.*, Order.OrderId.

        CustomerQuery cust = new CustomerQuery ("c");
        OrderQuery order = new OrderQuery ("o");
        OrderItemQuery item = new OrderItemQuery ("oi");

        cust.Select(cust.CustomerName, (item.Quantity * item.UnitPrice).Sum().As("TotalSales"));
        cust.InnerJoin(order).On(order.CustID == cust.CustomerID);
        cust.InnerJoin(item).On(item.OrderID == order.OrderID);
        cust.GroupBy(cust.CustomerName);
        cust.OrderBy("TotalSales", esOrderByDirection.Descending);

        CustomerCollection coll = new CustomerCollection ();
        coll.Load(cust); // Notice we load the query via the Collection.Load() method

        The resulting SQL:

        SELECT c.[CustomerName],SUM(oi.[Quantity]) AS 'TotalSales'
        FROM [ForeignKeyTest].[dbo].[Customer] c
        JOIN [ForeignKeyTest].[dbo].[Order] o ON (o.[CustID] = c.[CustomerID])
        JOIN [ForeignKeyTest].[dbo].[OrderItem] oi ON (oi.[OrderID] = o.[OrderID])
        GROUP BY c.[CustomerName]
        ORDER BY TotalSales DESC

        Miscellaneous Tips and Tricks

        • You can trick a query object and force it to load from a database view instead of the table as follows

        query.es.QuerySource = "SomeView";

        • Top, CountAll, Distinct, PageNumber, PageSize, LastQuery are all available in the coll.query.es data member.

        EntitySpaces

        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

        posted on Tuesday, November 20, 2007 12:14:19 AM (Eastern Standard Time, UTC-05:00)  #    Comments [1]
         Sunday, November 18, 2007

        I made a blog post a while ago in a thread entitled "Microsoft ruined data binding in ASP.NET 2.0 when they dropped component support from the design surface" and thought it worthy of a follow up.

        ICustomTypeDescriptor

        In order to allow strongly typed entities to tack on dynamic properties (extra columns brought back via a dynamic query) for data binding in ASP.NET data grid scenarios you must implement the ICustomTypeDescriptor interface. Since our latest release (v1119) supports joins it is now common to bring back extra columns for display purposes in EntitySpaces. Well, we implemented the ICustomTypeDescriptor interface on our esEntity class and it worked perfectly in ASP.NET, however, testing then showed it broke data binding in certain Windows.Forms scenarios. Why? There is a BUG in the Microsoft.NET Framework. It's not like bugs are not found in EntitySpaces of course, this is merely an explanation of how we have arrived to this point.

        We have a few ways to work around the issue. One is to use our Collection.LowLevelBind() method and the other is adding properties to your entity (not very attractive). Our esDataSource control allows you to bring back extra columns and it binds just fine, there is a "LowLevelBind" method on the esDataSource for just this scenario. This only effects ASP.NET as Windows.Forms uses ITypedList which works like a champ (in hierarchical mode also).

        HierarchicalDataSourceControl

        The new HierarchicalDataSourceControl binding set of interfaces proved utterly incapable of displaying a hierarchical object model. We had it "kind of working" when we realized that this new binding model only supported a single parent/child relationship. This means it cannot display the EntitySpaces hierarchical object model. So, we withdrew the implementation of this feature. Scott Piegdon has a code sample on CodeProject, you can see his response to my "Ya, Butt" comment which validated my suspicions (nice article by the way).

        Summary

        Again, the new Microsoft ASP.NET data binding has proven to be flawed. It is next to impossible to support both ASP.NET and Windows.Forms binding with the same codebase due to a serious bug in the .NET Framework. Also, the HierarchicalDataSourceControl implementation suffers from a lack of foresight by its designers.

        And finally (whining here) this all worked in the Microsoft .NET 1.x framework, see Part One as to how we got to where we are. The same ITypedList implementation worked for both ASP.NET and Windows.Forms. However, it was swapped out for some crazy DataSource model that is clearly geared for heavily reflected architectures. Well, EntitySpaces didn't take the bait. We are still 100% reflection free. We still run in "Medium Trust" and yes, we support the DataSource control but not the HierarchicalDataSourceControl. We have a plan to work around this issue entirely in a future release.

        EntitySpaces

        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

        posted on Sunday, November 18, 2007 9:24:47 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]

        The official EntitySpaces 2007.1.1119 Release (Trial Version) is now available now on our home page. Sunday night we will post the Developer and Source downloads. The release notes can be found here. Please, if you find anything report it right away. We are very pleased with this release and we hope you will be too.  We recommend you uninstall your current trial before installing.

        - The EntitySpaces Team 

        posted on Sunday, November 18, 2007 12:00:57 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Saturday, November 10, 2007

        Our next beta will sport "pure" WCF client side proxies. These proxies allow the client side of a WCF conversation to seemlessly  communicate with your heavier server proxies without the need for EntitySpaces on the client side. Our new client side proxies are very lightweight, strongly typed, and match your server side. The first scenario below showing EntitySpaces on both sides of the conversation is of course still possible, however, we have added the "EntitySpaces on the Server Only Model" which we will discuss in further detail now.

        For those interested in our new client side proxies there is a new template that you will need to run to create them. These generated proxies would be placed in a tiny class library and used by the client to communicate with your server.

        Your client side proxies will look like this, first, the collection class.

        Notice that the collection is a partial class. This will allow you to add functionality if needed. Also notice that there is no link to EntitySpaces whatsoever. You serialize from your Server Side Proxy and deserialize into your Client Side Proxies.  Now let's take a look at the entity class (which is also contained in the collection).

        Again the single entity client side proxy has no link to EntitySpaces yet you can deserialize your heavier server side proxies into these tiny lightweight proxies on the client side. Notice the partial class definition as well. The row state is maintained for you as well. All you need to do is modify your data on the client side and ship it back to the server.

        Here is a simulated converation between the server and client side proxies.

        In the above sample we are serializing from the server proxy into a string which simulates your packet being sent over the wire to the client. Next we deserialize into our lightweight client proxy, change the employee's FirstName, and then ship it back over the wire to the server to be saved. The nice thing is that when you deserialize on your server you merely grab the true Employee business object from the proxy and save it, it's so easy.

        EntitySpaces

        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

        posted on Saturday, November 10, 2007 10:56:44 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Sunday, October 21, 2007

        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.

        EntitySpaces

        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

        posted on Sunday, October 21, 2007 8:41:22 PM (Eastern Standard Time, UTC-05:00)  #    Comments [1]
         Tuesday, October 16, 2007

        EntitySpaces

        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

        posted on Tuesday, October 16, 2007 11:33:51 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Sunday, October 07, 2007

        Okay, two posts back-to-back on Hierarchical Binding in the same day. Using the standard DataGrid in my previous post I was pretty unimpressed (nothing against Microsoft, this feature isn't something they focus on). However, I downloaded the DXperience v2007 Vol 2 by Developer Express and did a simple binding test. Now I see the power of hierarchical binding. 

        Take a look my DevExpress XtraGrid showing my EntitySpaces hierarchical object model. The image below shows me drilling down from an Employee into an Order and finally into the OrderDetails collection, notice the tabs for other collections which are peers of each other (on the same level).


        Take a look at the design support image below. You can customize each sub collection including what columns to display and so on, there is also a flag that will indicate that you want to control what sub-collections you want to be shown. Thus you have total control over the data that is displayed.


        We will also be posting a sample using the Telerik Windows.Forms suite soon as well, as we are big fans of Telerik as well. 

        EntitySpaces

        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

        posted on Sunday, October 07, 2007 11:31:29 AM (Eastern Standard Time, UTC-05:00)  #    Comments [3]

        I'm still not sure how useful this feature is or how it can be "tamed". I've been playing around with this via the old DataGrid control and it seems to work pretty well. However, nothing I do in the TableStyles seems to limit or control what is displayed? I simply load a collection and bind it to the DataGrid and it shows the entire hierarchical model by default and nothing I do seems to limit it. It's been a long time since I played around with hierarchical grids as IMHO they really aren't a great way to convey information.

         

         

        So far this is for Windows.Forms only as all this work is done in ITypedList and ASP.NET 2.0 doesn't support this interface any longer (don't even get me started). We will be focusing next on our esDataSource control which will be receiving some major enhancements including hierarchical support and will be using it's own AppDomain to prevent it from locking DLLs. When all done, the esDataSource should be able to find your ASP.NET DLL automatically, no more browsing to it. I've downloaded one of the major Windows.Forms commerical grid suites and will be trying it out as well.

        This will be in our next beta release coming soon ...  Comments welcome and encouraged, especially from the expert hierarchical "GridBinders" lurking about ...

        EntitySpaces

        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

        posted on Sunday, October 07, 2007 10:02:13 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Tuesday, October 02, 2007

        EntitySpaces "Hierarchical" Skypecast

                       This is scheduled for October 04, 17:30 (5:30 EST Time)

        This is our first Skypecast, hopefully it will be productive. The Skypecasts feature of Skype are still in beta so hopefully this will work as planned. We are only going to talk about Hierarchical Databinding, Serialization and improvements related to our esDataSource. This is your chance to have some input on how these features will be implemented. If all goes well we might turn this into a bi-weekly EntitySpaces architecture discussion.

        Click on the image above or HERE to join ...

         

         

        posted on Tuesday, October 02, 2007 8:43:53 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Sunday, September 30, 2007

        This is merely a heads-up post for our users. The new EntitySpaces Beta is now available for download. The Trial version as well as the Developer version and Source are all available for download. Our revamped ASPX templates, now referred to as GridLoaders, are included in the trial. The old ASPX pages are no longer shipped, if you have them and are using them you do not have to switch over to the new GridLoaders.

        The new DynamicQuery improvements are significant in this release. It is not the goal of this release to be able to perform every query possible, but it should go a long way toward improving your productivity.

        Here are the new features included in this release.

        • The DynamicQuery API now supports InnerJoin, LeftJoin, RightJoin and FullJoin
        • The Collection classes now have a method called LowLevelBind() which will bind to the low level DataTable, useful when bringing back extra columns that are not in your entity.
        • The DynamicQuery API now supports Arithmetic Expressions using +  -  *  /  %
        • The DynamicQuery API now supports the C# natural language operators & (and) as well as | (or). VB users can use And and Or
        • The ASPX Suite(S) have been enhanced and are now referred to the "GridLoaders", their is a PDF on your menu after installation.
        • The is now an esDataSource sample (C# and VB) located in the EntitySpaces directory after install
        • There are three new starter templates in the EntitySpaces.Example.Templates namespace for those wishing to create templates.

        EntitySpaces

        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

        posted on Sunday, September 30, 2007 6:34:01 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Thursday, September 27, 2007

        Mike Griffin, creator of MyGeneration and EntitySpaces, talks with Carl and Richard about EntitySpaces, a persistence layer and business object system for the Microsoft .NET 2.0 Framework, as well as his experiences with LINQ and other technologies.


        Mike Griffin co-authored and founded MyGeneration Software with Justin Greenwood in late 2003 to early 2004. MyGeneration is now right at the top in CNET download.com’s .NET Utility category.


        But, it wasn’t always that way. MyGeneration opened with a meager offering that supported SQL Server and Oracle, and only supported VBScript and Jscript. Since then, it has grown to support 13 databases, added support for both C# and VB.NET, has a huge online community sharing templates via the MyGeneration Online Template library, and has been featured in several magazines. The MyGeneration Source code has now been released on SourceForge.NET under the BSD license.


        Mike also created dOOdads, a .NET architecture that became very popular and helped fuel the desire for MyGeneration. Mike created the MyMeta metadata engine for MyGeneration and there is no better metadata engine for the Microsoft .NET Framework.


        In 2005, Mike started working on a new architecture, one that would be sold as a commercial offering and take advantage of the features in .NET 2.0, and thus EntitySpaces was born. Creating a new offering that would be commercial was more than a one person project, so Mike set out to find some key resources and he found them.


        Mike has proven that he can build communities around products and energize others to rally around them. Mike is a senior architect with Leaf Software Solutions.


        Show #276 | 9/27/2007 (67 minutes)

         

        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

        posted on Thursday, September 27, 2007 6:41:56 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Wednesday, September 26, 2007

        On October 13th in Indianapolis, Indiana I'll be in the TridgeAlliance booth handing out EntitySpaces glossies and talking to people about EntitySpaces. I might be giving a "chalk talk" or a "Lunch & Learn Session" on EntitySpaces as well, I'm not sure on that yet. Next year for sure we will have our own booth. Anyway, if you're near Indy you might want to check this out, registration is filling up, there are already near 400 registrants. 

        IndyTechFest
        http://www.indytechfest.com/

        If you're there you can find me in the TridgeAlliance booth.

        EntitySpaces

        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

        posted on Wednesday, September 26, 2007 6:29:25 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Wednesday, September 19, 2007

        I just had to make another post, this is so much fun. Writing queries in our enhanced dynamic query language is totally awesome, and so powerful. I'm writing some unit tests to go into our massive NUnit test suite and just had to post these ...

        public void JoinWithArithmeticExpressionOrderByCalulatedColumn()
        {
            // Notice I create a calulated columns based on the TotalSales, then Order by it descending
            CustomerQuery cust = new CustomerQuery("c");
            OrderQuery order = new OrderQuery("o");
            OrderItemQuery item = new OrderItemQuery("oi");

            cust.Select(cust.CustomerName, (item.Quantity * item.UnitPrice).Sum().As("TotalSales"));
            cust.InnerJoin(order).On(order.CustID == cust.CustomerID);
            cust.InnerJoin(item).On(item.OrderID == order.OrderID);
            cust.GroupBy(cust.CustomerName);
            cust.OrderBy("TotalSales", esOrderByDirection.Descending);

            CustomerCollection coll = new CustomerCollection();
            coll.Load(cust);
        }

        The SQL produced:

        SELECT c.[CustomerName],SUM(oi.[Quantity]) AS 'TotalSales'
        FROM [ForeignKeyTest].[dbo].[Customer] c
        JOIN [ForeignKeyTest].[dbo].[Order] o ON (o.[CustID] = c.[CustomerID])
        JOIN [ForeignKeyTest].[dbo].[OrderItem] oi ON (oi.[OrderID] = o.[OrderID])
        GROUP BY c.[CustomerName]
        ORDER BY TotalSales DESC

        The result set is CustomerName / TotalSales sorted in decending order by TotalSales ...

        Another query I wrote merely concatenated the Employee FirstName and LastName columns, and upper cased them.

        public void ArithmeticConcatenationNoJoinWithSubOperator()
        {
            EmployeeCollection coll = new EmployeeCollection();
            EmployeeQuery q = coll.Query;

            q.Select( (q.LastName + "," + q.FirstName).ToUpper().As("FullName") );
            q.OrderBy(q.LastName.Ascending);

            coll.Query.Load();
        }

        I've seen many of our competitors query languages, I think by far EntitySpaces has the cleanest, most straight-forward syntax, by light years in most cases. We've got some really cool stuff coming, hang on ...

        EntitySpaces

        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


        kick it on DotNetKicks.com
        posted on Wednesday, September 19, 2007 7:47:35 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Tuesday, September 18, 2007

        The EntitySpaces Dynamic Query API will soon be sporting Join’s and Arithmetic Expressions. The syntax is so elegant even LINQ enthusiasts will take pause. Let’s take a look at how you would do a join using the enhanced EntitySpaces DynamicQuery. Note that we are using all of your existing objects to build the query.

        Performing Joins …

        CustomersQuery cust = new CustomersQuery ("c");
        OrdersQuery orders = new OrdersQuery ("o");
        OrderDetailsQuery details = new OrderDetailsQuery ("d");

        cust.Select(cust.ContactName, details.Quantity.Sum().As("TotalQuantity"));
        cust.InnerJoin(orders).On(cust.CustomerID == orders.CustomerID);
        cust.InnerJoin(details).On(orders.OrderID == details.OrderID);
        cust.Where(cust.ContactName.Like("%Mike%"));
        cust.GroupBy(cust.ContactName);

        CustomersCollection coll = new CustomersCollection ();
        coll.Load(cust);    // Load it …

        Now that is a pretty sweet syntax …

        Of course, RightJoin, LeftJoin, and FullJoin are also supported. The nice thing about this approach is that you are spoonfed the syntax via intellisense, no need to stop and create a view (although you can if you want to and generate your business entities off of the view). The "o", "c" and "c" shown above are merely the aliases used when building the SQL.

        Arithmetic Expressions

        You can now use arithmetic expressions in your query's. Notice how you can use the natural language syntax with * / + - and %. Take a look at this sample …

        CustomersQuery cust = new CustomersQuery ("c");
        OrdersQuery orders = new OrdersQuery ("o");
        OrderDetailsQuery details = new OrderDetailsQuery ("d");

        cust.Select(cust.ContactName, (details.Quantity * details.Price).Sum().As("TotalPrice"));
        cust.InnerJoin(orders).On(cust.CustomerID == orders.CustomerID);
        cust.InnerJoin(details).On(orders.OrderID == details.OrderID);
        cust.Where(cust.ContactName.Like("%Mike%"));

        CustomersCollection coll = new CustomersCollection ();
        coll.Load(cust);    // Load it …

        How Does this Effect Binding?

        Your EntitySpaces collections will now provide a new method named LowLevelBind(). Normally, you bind directly to the properties in your EntitySpaces entities. However, when joins are in play you are bringing back columns that aren’t in your entities. Thus, the LowLevelBind will bind directly to the underlying DataTable. The are other ways of course using EntitySpaces but we wont cover those in this post.

        grid.DataSource = coll.LowLevelBind();

        Can I still Save an Entity that was Built off a Join?

        The answer is "yes". Of course, it will only save to the main table, in the above case the Customer table.
        We already have this implemented and are hoping to have a beta out with joins and arithmetic expressions around October 1st, 2007.

        These new features will be available for all of the many databases supported by EntitySpaces.

        EntitySpaces

        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

        posted on Tuesday, September 18, 2007 11:22:28 AM (Eastern Standard Time, UTC-05:00)  #    Comments [2]
         Friday, September 14, 2007

        Our fall ES2007 release is slotted to add these new or enhanced features.

        • ASPX Templates (enhanced not new)
        • Constructors in your Custom Classes
        • Hierarchical DataBinding
        • Hierarchical Serialization
        • Cascading Deletes (Hierarchical)
        • New Stored Procedure Template - (generates invoking code doesn't create objects)
        • Ability to Save without transactions (useful when importing)
        • Many other items from our tracking system

        Our first ES2007 fall beta is slotted for October 15th, 2007. Our ES2008 Q1 roadmap will be published soon as well.

        EntitySpaces

        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

        posted on Friday, September 14, 2007 8:04:22 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Thursday, August 30, 2007

        Well, the Rodney Dangerfield of software engineering is actually getting some recognition, although I'm not an MVP I do play one on the Internet ...

        I've been asked by the .NET Rocks guys to do a show on MyGeneration and EntitySpaces and I am pretty excited about it. There's a lot to talk about. I'm not sure how much time I'll have but I'll try to relay our vision for EntitySpaces 2008 as well. Hopefully you will gain some insight as to how Scott, David, and myself operate and how EntitySpaces runs behind the scenes.

        We'll be recording the the show on Tuesday, September 4th and its scheduled for publication on September 11. We will post again and let you know the show is up and online ...


         
        The Internet Talk Show for Developers ...
        .NET Rocks!

         

        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


        kick it on DotNetKicks.com
        posted on Thursday, August 30, 2007 7:58:57 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Tuesday, August 21, 2007

        The EntitySpaces persistence layer and business object architecture for Microsoft .NET now fully supports PostgreSQL 8.2. Using PostgreSQL on .NET has never been easier.

        The EntitySpaces 2007 v0819 (beta) for PostgreSQL successfully passes our massive NUnit test suite including both the stored procedure and dynamic SQL modes. There is a new template that will generate your stored procedures if you desire to use stored procedures with your EntitySpaces PostgreSQL implementation.

        See the Release Notes for more information on setup. You'll need the Npgsql .NET provider for PostgreSQL and MyGeneration. See our Home Page and grab the latest Trial version. It has the PostgreSQL support.

        EntitySpaces

        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

        posted on Tuesday, August 21, 2007 10:34:09 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Saturday, July 14, 2007

        Some of our exploratory work for EntitySpaces 2008 has led us to consider releasing our own pure ASP.NET code generation system, after all, ASP.NET pages are basically templates in that they allow you to toggle in and out of literal content and C# or VB.NET code. We have a prototype of this working already in-house. The UI in the prototype shown below is real and is served up via MyMeta of MyGeneration. The master template also calls a series of sub-templates to generate the mock EntitySpaces classes.

        If you are an EntitySpaces fan you will recognize this screen, however, it is now a web page. The "Generate" button executes any number of sub-templates implemented as user controls or ASCX files. Sub-templates are quite simple to implement. Here is a sample of our mock esEntity.ascx page. 


        <%@ Control Language="C#" AutoEventWireup="true"%>
        <%@ Import Namespace = "MyMeta" %>

        <%
        //-----------------------------------------------------
        // Gotta love it, full intellisense and you can debug
        // your templates like a normal web site
        //-----------------------------------------------------

        MyMeta.dbRoot MyMeta = (MyMeta.dbRoot)this.input["MyMeta"];
        table = (ITable)this.input["ITable"];
        %>
        public class <%=table.Name%>
        {
        <%foreach (IColumn col in table.Columns) {%>
        public <%=col.LanguageType%> <%=col.Name%> { get; set; } <%}%>
        }


        This generates a simple mock class.

        public class Categories
        {
            public int CategoryID { get; set; }
            public string CategoryName { get; set; }
            public string Description { get; set; }
            public byte[] Picture { get; set; }
        }

        There are some real advantages to this approach. The first major advantage to this approach is the built in Intellisense both for MyMeta and for all of your other .NET namespaces as well. The second advantage is the ease of debugging. All you need to do is click the green arrow while in Visual Studio or Visual Web Developer 2005 Express Edition and you're debugging. You do not need to have IIS installed on your machine to use it either. Finally, you could even host this new code generation system on a server on your network and all of your development team could access it there.

        EntitySpaces LLC is soon going to be opening up to facilitate 3rd party enhancements. We are going to be publishing the source code for one of our data providers as an example. This will allow 3rd party's to create data providers for database systems not currently supported by EntitySpaces, we will also supply guidelines for direction as well. We are also going to be opening up a template sharing area that will allow our customers to publish templates for the EntitySpaces architecture.

        This new ASP.NET generation system (as yet unnamed) would also make it very easy for EntitySpaces developers to tweak templates and create and publish their own thus helping foster a wider reaching community. We really like the idea of this ASP.NET generator, it's so easy to use and debug. However, we need your feedback, please post your comments on this Thread in our forums.

        EntitySpaces

        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

        posted on Saturday, July 14, 2007 9:59:39 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Sunday, July 08, 2007

        Our Trial Version is available for those looking for a great architecture for .NET. Also, for customers, EntitySpaces Developer is available as well as the source code, if you have purchased that.

        New Installs: The latest MyGeneration (1.2.0.7 or higher) should be installed first, and then closed, before installing EntitySpaces Developer or Trial.

        1. You can download MyGeneration 1.2.0.7 HERE
        2. The updated VistaDB 3.0 MyMeta plugin for MyGeneration can be found HERE. Simply unzip into your MyGeneration folder.

        EntitySpaces 2007 is a full install. You do not need an earlier version installed. To generate against MySQL, MyGeneration requires that MySql.Data.dll be copied to the MyGeneration Program Folder. After installing, please see the "Getting Started" PDF that is added to your EntitySpaces Start Menu folder.

        Below are the release notes for EntitySpaces 2007.0.0709:

        • Added new "Proxy/Stub" tab to generated master templates.
        • Added support for Windows Communication Foundation (WCF) Databinding.
        • Upgraded to VistaDB Build 30.
        • Made the List<> operator implicit/widening for Collections.
        • Added Ignore Schema/Catalog checkboxes to MetadataMap template.
        • Added ability to set connection on esUtility.
        • Added esUtility to the EntitySpaces.Core.CE project.
        • Added new method to esEntityCollection named CreateColumnsForBinding() which can be called when a collection contains no data before data binding.
        • Enhanced Oracle Stored Procedure Templates - Concurrency Update/Delete. You need to regenerate Oracle stored procedures, and run the updated scripts.
        • Enhanced INotifyPropertyChanged logic to support WPF/XAML binding.
        • Fixed parameter issue with LoadDataSet.
        • Added [CLSCompliant(false)] to those variables that aren't compliant to get rid of warnings (just a naming convention thing).
        • Improved performance of string property settors.
        • Fixed parameter issue for SqlCe Float data type.
        • EntitySpaces Developer install now includes EntitySpacesDemo and VistaDB Compact Framework Demo. The \Runtime folder is not included. Just change the references so they point to your \Redistributables, or \Redistributables\Ce folder.
        • Fixed issue in Combine method for empty collections.
        • Fixed issue for Sql Server dynamic inserts for tables that have both an identity key column and a uniqueidentifier default newid() column.
        • Fixed issue with LoadByPrimaryKey parameter name for primary key columns with spaces in the name.

        EntitySpaces

        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


        kick it on DotNetKicks.com
        posted on Sunday, July 08, 2007 8:54:58 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Thursday, June 14, 2007

        Epoxy is a REST/POX webservice API that extends the EntitySpaces Architecture. If you are unfamiliar with what REST/POX is I would recommend checking out the excellent series over at Softies On Rails. This addition is meant to empower the creation of massively public http API's for any application that you develop with the EntitySpaces Architecture. Why would you want to expose your EntitySpaces objects via REST/POX and not just provide the defacto SOAP service API? Well, lets face it not everyone is living in the .NET world. Don't you want all your cool ruby coding friends to be able to consume your services easily? Of course you do, not to mention the 100's of other geeks that will write clients if only you allow them to do it in the language of their choice without jumping through a lot of hoops. For a more authoritative answer on when to use REST/POX instead of or in conjunction with SOAP, check out what Don Box has to say about it.

        So now that we all agree that this is indeed something very useful, lets get down to implementation. We chose to use the new WCF REST/POX facilities to create our services. Below is a sample of our Service Contract

        [ServiceContract]
        public interface IUniversalContract
        {
            [OperationContract(Action = "*", ReplyAction = "*")]
            Message ProcessMessage(Message input);
        }

        As you can see our interface consists of one Operation Contract which simply takes a Message as an input. The implementation of the interface is where the rubber hits the road. Below is a sample implementation of the above defined interface using the Employees class generated from the Northwind sample database.

        public Message ProcessMessage(Message request)
        {
            Message response = null;

            //The HTTP Method (e.g. GET) from the incoming HTTP request
            //can be found on the HttpRequestMessageProperty. The MessageProperty
            //is added by the HTTP Transport when the message is received.
            HttpRequestMessageProperty requestProperties =
                (HttpRequestMessageProperty)request.Properties[HttpRequestMessageProperty.Name];

            //Here we dispatch to different internal implementation methods
            //based on the incoming HTTP verb.
            if (requestProperties != null)
            {
                if (String.Equals("GET", requestProperties.Method,
                    StringComparison.OrdinalIgnoreCase))
                {
                    response = GetEmployee(request);
                }
                else if (String.Equals("PUT", requestProperties.Method,
                    StringComparison.OrdinalIgnoreCase))
                {
                    response = UpdateEmployee(request);
                }
                else if (String.Equals("POST", requestProperties.Method,
                    StringComparison.OrdinalIgnoreCase))
                {
                    response = AddEmployee(request);
                }
                else if (String.Equals("DELETE", requestProperties.Method,
                    StringComparison.OrdinalIgnoreCase))
                {
                    response = DeleteEmployee(request);
                }
                else
                {
                    //This service doesn't implement handlers for other HTTP verbs (such as HEAD), so we
                    //construct a response message and use the HttpResponseMessageProperty to
                    //set the HTTP status code to 405 (Method Not Allowed) which indicates the client
                    //used an HTTP verb not supported by the server.
                    response = Message.CreateMessage(MessageVersion.None, String.Empty, String.Empty);

                    HttpResponseMessageProperty responseProperty = new HttpResponseMessageProperty();
                    responseProperty.StatusCode = HttpStatusCode.MethodNotAllowed;

                    response.Properties.Add( HttpResponseMessageProperty.Name, responseProperty );
                }
            }
            else
            {
                throw new InvalidOperationException( "This service requires the HTTP transport" );
            }

            return response;
        }

        As you can see the above maps various http verbs to our CRUD methods for our objects. Using the new EntitySpaces WCF support the WCF serialization worked like a charm.

        Endpoints are very important in a REST'ful API, so its worth covering briefly how the WCF implementation handles this. For the context of this post my virtual directory locally is ServiceHost. The actual service file will be called employee.svc in this sample. This relates directly to the address you will use to interact with the API over HTTP.

        **Note if you want this to work you must have WCF installed, be using EntitySpaces Developer 0614 or higher and configure IIS for WCF REST/POX operations.

        In our sample to get a list of all employees you would hit

        http://localhost/servicehost/employees.svc/employees/

        this would produce the following XML

        <ArrayOfanyURI xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays"
            xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <anyURI>http://scattorshot/servicehost/employees.svc/employees/1</anyURI>
            <anyURI>http://scattorshot/servicehost/employees.svc/employees/2</anyURI>
            <anyURI>http://scattorshot/servicehost/employees.svc/employees/3</anyURI>
        </ArrayOfanyURI>

        As you can see it provides you with a list or URI's for each employee in the list. You can also perform an HTTP POST to this address to add a new employee. You may retrieve a single employee with an EmployeeID of 1 by performing an HTTP GET to the below address

        http://localhost/servicehost/employees.svc/employees/1

        this would produce the following XML

        <Employees>
            <EmployeeID>1</EmployeeID>
            <LastName>Davolio</LastName>
            <FirstName>Nancy</FirstName>
            <Title>Sales Representative</Title>
            <TitleOfCourtesy>Ms.</TitleOfCourtesy>
            <BirthDate>1948-12-08T00:00:00</BirthDate>
            <HireDate>1992-05-01T00:00:00</HireDate>
            <Address>507 - 20th Ave. E. Apt. 2A</Address>
            <City>Seattle</City>
            <Region>WA</Region>
            <PostalCode>98122</PostalCode>
            <Country>USA</Country>
            <HomePhone>(206) 555-9857</HomePhone>
            <Extension>5467</Extension>
            <Photo>
                FRwvAAIAAn....the long base64 encoded string
            </Photo>
            <Notes>
                Education includes a BA in psychology from Colorado State University in 1970. 
                She also completed "The Art of the Cold Call."  Nancy is a member of Toastmasters International.
            </Notes>
            <ReportsTo>2</ReportsTo>
            <PhotoPath>http://accweb/emmployees/davolio.bmp</PhotoPath>
            <esRowState>Unchanged</esRowState>
        </Employees>

        After performing the HTTP GET and retrieving the desired employee resource you could modify it, and then perform an HTTP PUT to the same endpoint to update the employee. In order to delete an employee you would perform an HTTP DELETE to the above address to delete the resource. This is how your endpoints relate to your HTTP verbs, and is at the very heart of the REST style architecture.

        So now you not only have the option to expose your EntitySpaces objects via SOAP services but REST/POX as well. We will be providing the full source code for the sample services as well as a small Windows Form client to consume the service. Choice is always a good thing, and this is certainly no exception.

        EntitySpaces

        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

        EntitySpaces.RestPox.zip (93.44 KB)
        posted on Thursday, June 14, 2007 8:29:15 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
        EntitySpaces.RestPox.zip (93.44 KB)
         Saturday, June 09, 2007

        The Windows Communication Foundation (WCF) has some interesting challenges when it comes to serialization. The model chosen by Microsoft does not work out-of-the-box and doesn't obey attributes such as [XmlIgnore] and alike. So, while you're classes might serialize perfectly in SOAP scenarios you'll be scratching your head when it comes to WCF serialization (in most cases). Of course, EntitySpaces supports binary serialization and you can certainly very easily use our binary serialization for WCF remoting when you are in control of both the client and server.

        EntitySpaces is sporting a new tab on the "Generated Master" template in our upcoming ES2007 maintenance release. This release will most likely arrive on June 23rd, however, an internal beta will be provided for those doing WCF now, no public beta will be posted. If you are interested in working with our WCF support please email us support@entityspaces.net

        So, if you are doing WCF programming this new release is definitely for you. 

         


        Using the Employees table from Microsoft's Northwind database let's take a look at how to use the EntitySpaces WCF proxy stub classes. You can use the same proxy stub class on both the server and the client side. The proxy stub classes will automatically be placed in your generated "single file" during the code generation process. Two class will be created:

        1. EmployeesProxyStub
        2. EmployeesCollectionProxyStub

        These are both lightweight intelligent wrappers that cause your EntitySpaces objects to be serialized correctly when used in WCF communications scenarios. This post is only going to cover the EmployeesProxyStub class, the EmployeesCollectionProxyStub will be covered in a follow up post. However, the collection proxy stub code has already been written and tested.

        The EmployeesProxyStub

        This is the wrapper for your single entity classes. You can use the proxy stub class to return data from the server to the client simply by executing this code.

         

        public EmployeesProxyStub SomeMethod(int id)
        {
            Employees employee = new Employees();
            employee.LoadByPrimaryKey(id);
            return new EmployeesProxyStub(employee);
        }

         

        The XML will look something like this. Notice that only the non-null columns are returned. This is because we checked the "EmitDefaultValue=False" checkbox on the template, otherwise there would have been place holder elements in the XML for those columns that were null.

         

        <Employees xmlns="http://tempuri.org/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <EmployeeID>257</EmployeeID>
            <LastName>Goo</LastName>
            <FirstName>foo</FirstName>
            <esRowState>Unchanged</esRowState>
        </Employees>

         

        This is an example of the generated proxy stub class. 

         

        [DataContract(Namespace = "http://tempuri.org/", Name = "Employees")]
        [Serializable]
        public class EmployeesProxyStub
        {
            public EmployeesProxyStub(Employees obj)
            {
                this.entity = obj;
            }

            [DataMember(Order = 1, EmitDefaultValue = false)]  // EmitDefaultValue -> see checkbox above
            public System.Int32? EmployeeID
            {
                get
                {
                    if (this.Entity.es.IsDeleted)
                        return (System.Int32?)this.Entity.
                            GetOriginalColumnValue(EmployeesMetadata.PropertyNames.EmployeeID);
                    else
                        return this.Entity.EmployeeID;
                }
               set { this.Entity.EmployeeID = value; }
            }

            [DataMember(Order = 2, EmitDefaultValue = false)]  // EmitDefaultValue -> see checkbox above
            public System.String FirstName
            {
                get
                {
                    if (this.Entity.es.IsDeleted)
                        return null;
                    else
                        return this.Entity.FirstName;
                }
                set { this.Entity.FirstName = value; }
            }

            // and more properties are in here ....

            [DataMember(Order=19)]
            public string esRowState  // Present only if "Include Added/Modified/Deleted" is clicked
            {
                get
                {
                    return this.Entity.es.RowState.ToString();
                }

                set
                {
                    switch (value)
                    {
                        case "Unchanged":
                            this.Entity.AcceptChanges();
                            break;

                        case "Added":
                            break;

                        case "Modified":
                            this.Entity.AcceptChanges();
                            this.Entity.es.RowState = DataRowState.Modified;
                            break;

                        case "Deleted":
                            this.Entity.AcceptChanges();
                            this.Entity.MarkAsDeleted();
                            break;
                    }
                }
            }

            public Employees Entity
            {
                get
                {
                    if (this.entity == null)
                    {
                        this.entity = new Employees();
                    }

                    return entity;
                }

                set
                {
                    this.entity = value;
                }
            }

            [NonSerialized]
            public Employees entity;

        }

         

        Now let's receive our Employees packet on the client, modify it, and send it back to the server.

         

        EmployeesProxyStub proxy = call SomeMethod(); ...
        Employees emp = proxy.Entity;  // grab the true Employees object now

        emp.FirstName = "ES Rocks!";

        call SendDataBackToClient(proxy);

         

        The Server will now receive this XML packet. Notice that the esRowState is now Modified. The esRowState is interpreted in the set accessor of the proxy stub in the esRowState property to ensure that the entity is in the proper state after deserialization.

         

        <Employees xmlns="http://tempuri.org/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <EmployeeID>257</EmployeeID>
            <LastName>Goo</LastName>
            <FirstName>ES Rocks!</FirstName>
            <esRowState>Modified</esRowState>
        </Employees>

         

        On the server you would deserialize just as we did on the client and then call Save(). Very simple. We are thinking of adding another checkbox in the template so that the proxy stubb class will only send dirty columns back when modified. For Deleted records only the primary key(s) are sent with an esRowState value of Deleted. Again, you can simply call save, no MarkAsDeleted() call is necessary, it's already been done for you.

        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

        posted on Saturday, June 09, 2007 11:20:47 AM (Eastern Standard Time, UTC-05:00)  #    Comments [10]
         Friday, June 08, 2007

        Venexus, Inc., a leading Business Service Provider, has released Venexus Search Engine 2.0, a new version of its full-blown search engine for web sites and portals that use the DotNetNuke Web Application Framework.

        The latest release of Venexus Search also utilizes the new version of the EntitySpaces architecture, EntitySpaces 2007. EntitySpaces 2007 supports .Net Medium Trust operation. This opens the door for many users who may be using shared hosting and are currently limited by their hosting providers to medium trust environments. "EntitySpaces has allowed us to quickly absorb data schema changes and guarantees that our clients receive the quality software they demand through rigorous unit testing of both the EntitySpaces assemblies and generated code," said Scott Schecter, CTO of Venexus. "This flexibility has made EntitySpaces an invaluable tool in our development process, and is central to our agile methodologies."

        Read the entire PR Newswire - Press Release ...

        About Venexus, Inc.
        Venexus, Inc. is a Business Service Provider (BSP) that develops and integrates business processes. Venexus provides a rare synthesis of "best of breed" technology, value-added offerings and highly desirable pricing to small and medium sized businesses throughout the United States. Venexus is a leading provider of DotNetNuke solutions and support. Venexus provides full lifecycle support of DotNetNuke with core competencies that include the planning, development, and implementation of DotNetNuke portals, skins, and modules.

        For more information, please visit http://www.venexus.com

        posted on Friday, June 08, 2007 11:21:56 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Monday, June 04, 2007

        CodeSmith and EntitySpaces 2008

        EntitySpaces 2008 will greatly expand the reach of the EntitySpaces Architecture for the Microsoft .NET Framework by supporting both MyGeneration and CodeSmith. Our decision to support CodeSmith by no means indicates we are abandoning MyGeneration. MyGeneration will continue to be supported by EntitySpaces. We understand code generator loyalty, and we love MyGeneration. But, CodeSmith has its fervent followers, too. EntitySpaces 2008 will open up a new market for EntitySpaces and will give current EntitySpaces users a choice of generator.

        As of EntitySpaces 2008, the EntitySpaces Architecture will be a very viable choice for the CodeSmith Community. Supporting CodeSmith will have the added advantage of allowing users to generate their EntitySpaces architecture(s) from within Visual Studio 2005 via CodeSmith’s Microsoft Visual Studio 2005 integration.

        Supporting both MyGeneration and CodeSmith, as this post will outline, can be accomplished quite elegantly, and even allow for greater customization by the EntitySpaces Team.

        One Architecture - Two Code Generators

        The approach is straightforward. A master template will be created for each code generator. The master template will use the native user interface techniques of the given code generator to gather the user input. Next, the master template will launch the metadata sub-template which will extract the metadata using the MyGeneration MyMeta API or the CodeSmith SchemaExplorer API and create the EntitySpacesMetadata.xml file. The master template will then create an instance of the EntitySpacesPlugIn and populate it with the user’s selections and also provide it with a path to the EntitySpacesMetadata.xml file. Finally, the master template will launch a series of sub-templates just as EntitySpaces 2007 does now. The sub-templates will use only the EntitySpacesPlugIn which will run in both code generators. The only data the sub-templates will access will be the user input (which will be stored in our plug-in) and the intermediate metadata XML file. The sub-templates have no user interface nor will they call into the native code generator API. This approach will ensure that 90% or more of the code generation process will be the same regardless of what code generator is being used.

        A few diagrams might help visualize how this will be accomplished.

         

         

        The Metadata Sub-template creates the EntitySpacesMetadata.xml file which is then used, in conjunction with the EntitySpacesPlugin, by the common sub-templates.

         

         

        Summary 

        Our decision to support both MyGeneration and CodeSmith is not something that we have taken lightly. It has been seriously discussed for some time now. However, we did not want to cloud the EntitySpaces 2007 release with this announcement. Now, the time has come to let the cat out of the bag. However, EntitySpaces 2007 is by no means going to sit idle. We will be publishing a roadmap that will take ES2007 through the remainder of this year in just a few weeks. We can say now that hierarchical data binding and other very important features will make it into a follow on ES2007 release.

        Move over .netTiers and make room for your new neighbor, EntitySpaces 2008.

        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

        posted on Monday, June 04, 2007 6:32:40 AM (Eastern Standard Time, UTC-05:00)  #    Comments [2]
         Monday, May 28, 2007

        The EntitySpaces 2007 (ES2007) Architecture for the Microsoft .NET Framework was released to production on May 28th, 2007.

        The EntitySpaces team would like to thank both our customers and those evaluating EntitySpaces for working hand in hand with us on the ES2007 release. The first ES2007 beta was posted on March 4th and thus began the customer feedback / defect reporting cycle with new versions following quickly as advancements were made. You have truly helped us to make EntitySpaces 2007 a very solid offering for those developing for the Microsoft .NET Framework. We are particularly pleased with some of the mobile development that is beginning to take root. We strive hard through our forums to hear you and allow you to shape the architecture you have invested in. We also work very hard to provide high quality support on our forums and to make ourselves available to our customers.

        ES2007 is a major advancement over it's predecessor (1.5.3) released on December 30th, 2006, these are just some of the new features.

        EntitySpaces 2007 Major New Features:

        • Medium Trust Support
        • ASP.NET Data Binding Support via the esDataSource Control
        • Two Way Data Binding through INotifyObjectChanged
        • Very Good .NET Compact Framework Support for Mobile Devices
        • SQL CE and VistaDB support
        • Improved Transaction support via esTransactionScope
        • Improved DynamicQuery support
        • Built in paging support for Oracle, MySQL and Microsoft SQL 2005

         

        For a mere $149 per developer seat you can transform your .NET development environment. Click HERE to view our pricing page. 

        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 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

        posted on Monday, May 28, 2007 5:50:58 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Sunday, May 20, 2007

        Or how to write a complete master detail view in 2 lines of code!

        In my previous article I showed how it was possible to write a complete Windows Mobile 5 application in a ridiculously small amount of code. Using the full power of the Resco controls and the simplicity of the EntitySpaces architecture this can be simplified even more.

        AdvancedList

        The top half of our form uses the Resco AdvancedList control. This shows a complete list of all the rows in the Surveys collection. An un-selected row displays the contents of the column 'Name', a selected row expands to display two lines and now includes the column 'Address' in the second row.

        Screen Shot of the Resco AdvancedList Designer in action

        The definition of this behavior is carried out at design time. Within the code all we have done is instantiated the 'Surveys' EntitySpaces collection  and attached it to the AdvancedList using the collection as the datasource for the control.

        this.advancedList1.DataSource = surveys;

        The cell 'Address' we have created in the 'Selected' template has its CellSource set to Address, normally this property combination in the properties dialogue is collapsed and the ColumnName and SourceType are set correctly to their appropriate values by default.

        DetailView

        Recalling my previous article we used the Resco DetailView control to display the full details of the record. Most of the work required to achieve this was done in 3 lines of code.

        ((Resco.Controls.DetailView.ItemComboBox)this.detailView1.Items["HType"]).DataSource = types;
        ((Resco.Controls.DetailView.ItemComboBox)this.detailView1.Items["HType"]).DisplayMember 
        = HTypesMetadata.PropertyNames.Htype;
        ((Resco.Controls.DetailView.ItemComboBox)this.detailView1.Items["HType"]).ValueMember 
        = HTypesMetadata.PropertyNames.Id;

        It is in fact possible to use the design time capability of the Resco control to eliminate all but the line which does the primary datasource binding, thus reducing this to just 1 line of code!

        In the screen-shot above you can see the combobox properties being set using the DetailView designer.

        In conclusion we have demonstrated some of the power of EntitySpaces when used in conjunction with sophisticated but easy to use Resco Controls. This approach can obviously be extended to any third party controls that properly support data binding in this way. Remember we have built a fully functional Master-Detail application without ever writing any SQL code at all !


        Robert Campbell ecommnet Robert Campbell
        ecommnet ltd., Bewick House, Horsley Business Centre, Horsley, Newcastle Upon Tyne, NE15 0NY UK
        www.ecommnet.co.uk  www.offexploring.com  www.autobestbuy.co.uk


        posted on Sunday, May 20, 2007 4:23:34 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Tuesday, May 15, 2007

        This is our first user supplied EntitySpaces blog post. We hope to do more of these in the future as we have some customers doing some pretty cool stuff with the EntitySpaces architecture. A special thank you goes out to Robert Campbell of ecomment ltd. See Robert's bio at the end of this post. - The EntitySpaces Team.


        In this article we’ll develop an application for a Windows Mobile ("WM5") platform device. While the application is just an example, and some would argue an incomplete one at that, we will be able to see all the necessary steps to get started with EntitySpaces (“ES”). We’ll also see how to use data source binding on a couple of 3rd party controls. You can also see a FLASH DEMO as well.

        Getting Started

        Prerequisites: What you need

          • Microsoft SQL Server Compact Edition
          • Microsoft SQL Server 2005
          • MyGeneration Version 1.2.0.6
          • EntitySpaces 2007 Beta v0.0507
          • Visual Studio 2005 with Windows Mobile 5 SDK installed
          • Resco AdvancedList.NET. See http://www.resco.net/products/

        Create a new VS Project for Windows Mobile 5

        In Visual Studio (“VS”), Clicking ‘File’ > ‘New’ should produce the New Project dialog below . I’ve selected ‘Windows Mobile 5.0 Pocket PC’, ‘Device Application’, and changed the Name to ‘Demo’.

        Clicking OK at this point should result in a new project called Demo with a single blank form.

        The interesting things to notice here are the default references VS implements because we’ve targeted the WM5 platform.

        Create a Database

        Creating a database file for use in our application is relatively simple if MS SQL Server has been installed properly.

        In VS, Click the project icon in the solution tree (shown above as ‘Demo’), Right-Click, and Click ’Add’ > ’New Item...’. Select ‘Database File’ in the Add New Item dialog.

        I changed the Name of the database file to Demo.sdf.

        Click ‘Add’, and the standard VS Data Source Configuration Wizard pops up.

        We’ll not need this as we’re going to use ES!!

        Click ‘Cancel’ instead.

        Double-Click the database file that appeared in the Project Solution Explorer tree.

        The Server Explorer pane should now appear in your VS IDE.

        If the connection to the database is closed (indicated by the little red ’x’ next to the Demo.sdf database icon), Right–Click and Clicking ’Refresh’ should restore it.

        We can now build the database proper.

        Right-Click on the Tables icon. Click ‘Create Table’. This will present a familiar New Table Dialog.

        In this screenshot I’ve created a table called Survey and added the 5 columns.

        Note the Id column is a Unique Identifier, is set as the Primary Key, is a ‘RowGuid’, and it’s practical to set the default value for the column as (newid()).

        Create a second table which will be used as a related table. In this demo we’re going to use a table called HTypes (house types) for our survey.

        We need to relate the two tables with some foreign key constraints. In SQL server ‘proper’ this is easily done with the relationship diagram tool in VS. However, with SQL CE or ‘Compact Edition’ as it’s now called, that’s not possible. We’ll have to do this programmatically with a TransactSQL Query.

        SQL Reference (SQL Server Compact Edition) 

        http://msdn2.microsoft.com/en-us/library/ms173372.aspx

        I usually have to resort to the Microsoft SQL Server Management Studio to run this query as the VS component doesn’t support the ‘ALTER’ command (Anyone have any idea why? Or, indeed, why the Management Studio doesn’t support the ability to ‘Open’ tables?)

        To add a constraint to the Survey table, we need to run this query:

        ALTER TABLE [Survey] ADD CONSTRAINT [FK_Survey_HTypes] FOREIGN KEY([HouseType]) REFERENCES [HTypes] ([Id])

        Note, in this simplified demo, I have just taken the defaults for the behavior for this constraint. A lot of this will depend on your real application. I’m no DB expert, and this is an ES demo.

        At this point we have:

        • A WM5 VS project shell.
        • An SQL-CE database with tables and FK Table Constraints.

        Let’s add two folders to our VS project for the files generated in the next section. Click the Project icon in the solution tree. Right-Click and Click ’Add New Folder’. Add a folder called ‘Generated’ and another called ‘Custom’.

        Note the highlighted Project Folder property. You’ll need this information in the next section. The next step is to produce the ES generated classes.

        MyGeneration

        Start MyGeneration, and select ‘Edit’ > ‘Default Settings...’.

        Click ‘Microsoft SQL CE’ from the ‘Driver’ dropdown. The easiest place to get the Connection String is by copying it from the properties dialogue of the Demo.sdf file in VS, and pasting it in the text box here. Click ‘SqlServerCe’ in the ‘DbTarget’ dropdown. Optionally, click your preferred language in the ‘Language’ dropdown, in this case, ‘C#’.

        Click ‘Test Connection’ to confirm a valid connection can be established.

        Click the Templates Tab of the dialogue.

        All we really need to change here is the Default Output Path.

        Copy the Project Directory path that was noted in the previous screenshot, and paste it to the Default Output Path here. The template will automatically find the Generated and Custom directories.

        Click OK. This should start the connection to your database.

        You should now be able to select and expand the MyMeta tree to show the database we have created in all its glory.

        Go Generate!

        Select the Template browser from the icons at the top of the left hand side of the MyGeneration IDE. Expand the EntitySpaces folder and the C# folder below that.

        We’re going to run two templates:

        • Custom Classes Master (C#)
        • Generated Classes Master (C#)

        We’ll Double-Click a template to load it, and click the green ‘go’ arrow to generate. Let’s start with the Custom Classes.

        Custom Classes Template

        Note the template has automatically selected the \Custom\ folder.

        The Namespace defaults to ‘BusinessObjects’. Change this to ‘Demo’.

        Ctrl-Click both tables to select them in the Select Tables window. Click the OK button/bar.

        If everything goes according to plan, the output will be shown in the output tab / window.

        Generated Classes Template

        Double-Click on the Generated Classes Master template and Click the green ‘go’ button again.

        This dialogue has two tabbed sections.

        For the Basic Information tab, make the same edits as for the Custom Classes template. Again, the Output Path should be automatically filled in for you.

        Click the Advanced Options tab.

        On this tab we need to check the options as shown:

        Important: The Ignore Schema, Ignore Catalog, and Target Compact Framework boxes need to be checked.

        Click OK.

        Again, if it’s worked, the output should show in the pane on the right.

        We’re done with MyGeneration, either close or minimize the application.

        Incorporating the generated code into the VS project

        Go back to VS, and Click the ‘Refresh’ icon. Click the ‘Show All Files’ icon.

        We now can see our generated files in both directories but grey’d out. As yet, they’re not part of the project.

        Highlight them all using the usual Shift-Click and/or Ctrl-Click techniques. Right-click one of the highlighted files, and Click ‘Include In Project’.

        Hey! Just before you go clicking ‘Build’, we need to do one more thing. Add the ES references to the project.

        To do so, Click the References node in the solution tree, Right-Click and Click ‘Add Reference...’.

        At this point, the current documentation suggests that the ES DLLs will be there ready to select. In my case, they were not, so Click the Browse tab and drill down to the CE directory in the place where EntitySpaces is installed. The default, and in my case, is:

        C:\Program Files\EntitySpaces\Redistributables\CE

        The Add Reference dialogue should look like this:

        We need to Ctrl-Click Core.Ce, Interfaces.Ce, LoaderMT.Ce, and SqlClientProvider.Ce. Then, Click OK.

        Your Solution tree should now look like this:

        Quick! Click ‘Build’ before you collapse in anticipation!

        ‘Build Succeeded’

        “Ah”, you cry, “It looks great, but doesn’t do anything!”

        Wait… there’s more....


        Adding some code!

        Program.cs

        The application needs to have added the medium trust loader, and, because we need a configless implementation in WindowsCE, Program.cs needs to look something like this.

        using System;
        using System.Collections.Generic;
        using System.Windows.Forms;
        using EntitySpaces.Interfaces;
        using EntitySpaces.LoaderMT;
        
        namespace Demo
        {
            static class Program
            {
                /// <summary>
                /// The main entry point for the application.
                /// </summary>
                [MTAThread]
                static void Main()
                {
                    // --- Manually register a connection (DO THIS ONE TIME ONLY) ---
                    esConnectionElement conn = new esConnectionElement();
                    conn.ConnectionString = @"Data Source=\program files\Demo\Demo.sdf;";
                    conn.Name = "Demo";
                    conn.Provider = "EntitySpaces.SqlClientProvider.Ce";
                    conn.ProviderClass = "DataProvider";
                    conn.SqlAccessType = esSqlAccessType.DynamicSQL;
                    conn.ProviderMetadataKey = "esDefault";
                    conn.DatabaseVersion = "2005";
        
                    // --- Assign the Default Connection ---
        
                    esConfigSettings.ConnectionInfo.Connections.Add(conn);
                    esConfigSettings.ConnectionInfo.Default = "Demo";
        
                    // --- Register the Loader ---
        
                    esProviderFactory.Factory = 
        new EntitySpaces.LoaderMT.esDataProviderFactory(); Application.Run(new Form1()); } } }

        Form1.cs

        Our ‘spec’ calls for a form that displays a grid with all the survey results, so we should add a grid. We’re going to use a 3rd party specialist grid, the Resco AdvancedList, and a panel to display the record with all its detail. Here, I’ve used the Resco DetailView.

        Initializing our form

        Of the many things to do to the form, the first is to add the two ES collections by dragging the icons from the toolbox to the form. Using this method, all the necessary defaults are created and end up in the designer.cs file.

        I’ve also done a similar thing with the two Resco controls; the advanced list and the detail view.

        I've created a method to initialize the form:

        private void init()
        {
            // The Grid is populated with the collection of surveys
            // just get everything; 
            if (surveys.LoadAll())
            {
                this.advancedList1.DataSource = surveys;
                this.advancedList1.Refresh();
            }
           else 
           {
                MessageBox.Show("can't load survey data");
           }
        }

        The record detail is displayed in a control called DetailView, We need to populate the combobox on the related field, load the collection, and bind it to the ComboBox

         

        private void init()
        {
            // The Grid is populated with the collection of surveys
            // just get everything;                           
            if (surveys.LoadAll())
            {
                this.advancedList1.DataSource = surveys;
                this.advancedList1.Refresh();
            }
            else 
            {
               MessageBox.Show("can't load survey data");
            }
        
            if (types.LoadAll())
            {
                //This sets the DataSource of the ComboBox to the collection
                ((Resco.Controls.DetailView.ItemComboBox)this.detailView1.Items["HType"]).DataSource 
        = types;
        ((Resco.Controls.DetailView.ItemComboBox)this.detailView1.Items["HType"]).DisplayMember
        = HTypesMetadata.PropertyNames.Htype;
        ((Resco.Controls.DetailView.ItemComboBox)this.detailView1.Items["HType"]).ValueMember
        = HTypesMetadata.PropertyNames.Id; this.detailView1.Refresh(); } }

        By the time we exit this method, we've done everything to populate the grid, and related fields, in the record detail display... in 12 lines of code... and NO SQL or recordset/dataset stuff to remember.


        Display the Record Detail

        Using the AdvancedList ("AL") to allow a user to select a record to display, we have a method showDetails. This method uses the Id of the record as its parameter. This is usually called by a row select event handler on the AL.

        private void showDetails(Guid rowToEdit)
        {
            s = new Survey();
            s.LoadByPrimaryKey(rowToEdit);
            this.detailView1.DataSource = null;
            this.detailView1.DataSource = s;
        
            this.detailView1.Refresh();
        }
        
        

        The method simply creates a new Survey entity, and loads it with the record data using the ES LoadByPrimaryKey() method. This binds the resulting object to the DetailView control through the assignment of the DataSource.

        The ES entity ‘s’ is visible across the form.

        If the user selects another row in the grid, we need to detect if they have made any changes to the current record, and save it.

        private void askSave()
        {
            if (s.es.IsDirty)
            {
                DialogResult result = MessageBox.Show("Save changes?", "ES Test App", 
        MessageBoxButtons.YesNo, MessageBoxIcon.Question,
        MessageBoxDefaultButton.Button1); if (result == DialogResult.Yes) { s.Save(); this.surveys.LoadAll(); this.advancedList1.DataSource = this.surveys; this.advancedList1.Refresh(); } } }

        The 1st thing the askSave method does is to determine if the data has been altered using the property of the underlying entity. if (s.es.IsDirty)

        Having determined it is, and that the user indeed wants to save it, it’s a simple matter to call the Save() method on the entity itself. After which, a call to reload the surveys collection and a refresh of the AdvancedList grid is all that’s required.


        Adding a new record

        Adding a new record is easy, too. I have an event attached to an AddNew menu item that looks like this.

        private void AddNew_Click(object sender, EventArgs e)
        {
            Survey s = new Survey();
            s.AddNew();
            showDetails((Guid)s.Id);
        }
        
        

        The ES AddNew() method is called to create a new entity and the Guid is passed to showDetails() to display it for editing.

        Note: The AddNew() method is overloaded in the Custom Class to generate the Guid immediately rather than relying on the default mechanism in the database.

        public partial class Survey : esSurvey
        {
            public override void AddNew()
            {
                base.AddNew();
                this.Id = Guid.NewGuid();
            }
        }
        

        Conclusion

        And... there you have it; a VS WM5 solution, an SQL Ce database, some easily generated ES BusinessObjects, a couple of Resco controls, and a few lines of code, all blended into a working application. After you've done it once, you can probably do your next project in less time than it took you to read this. Enjoy! 


         

        Robert CampbellRobert Campbell was educated in Newcastle Upon Tyne University in Agricultural Engineering, worked in manufacturing for 15 years before moving into IT in the mid 80's, and worked for a variety of consulting organizations before setting up ecommnet in 1998 at the start of the dot.com boom to specialize in security and web based applications development. ecommnet is now specializing in mobile applications development and security, Web 2.0 and identity management. ecommnet are NOKIA Enterprise Solutions Certified Mobility Partners.

        ecommnet ltd., Bewick House, Horsley Business Centre, Horsley, Newcastle Upon Tyne, NE15 0NY
        DDI: +44 8451-740-633, T:+44 1661 854 492 F :+44 1661 854 632 M:+44 7801 270 264

        posted on Tuesday, May 15, 2007 5:17:08 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Thursday, May 03, 2007

        First, a special thank you goes out to our customer base and to those exploring EntitySpaces 2007 via the trial version. You have been very cooperative in providing us feedback and helping us to test the EntitySpaces 2007 beta. In large part, the EntitySpaces roadmap is forged by customer feedback on our forums. On our forums not only will you receive stellar support but you can have a direct impact on the future of EntitySpaces. So, if you're not registered we encourage you to do so. EntitySpaces 1.5.3 is currently shipping, however, if you are starting a new project you will definitely want to use ES2007.


        The Schedule

        May  7th - Beta v0507 will be released
        May 21st - Beta v0521 will be released
        May 28th - EntitySpaces 2007 Officially Released


        Also, we have been ensuring that no customers who have purchased EntitySpaces have their download abilities cut-off even though their one year anniversary date may have expired. No EntitySpaces customers will have their accounts expire before June 4, 2007. This will ensure that you have sufficient time to download ES2007 and even snag a possible quick release if needed, that's a pretty fair deal. We are confident that you will want to renew.


        The EntitySpaces Team
        --

        EntitySpaces LLC
        Persistence Layer and Business Objects for Microsoft .NET
        http://www.entityspaces.net

        posted on Thursday, May 03, 2007 10:18:20 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Saturday, April 28, 2007

        The esDataSource in this weekends beta can automatically handle sorting for all databases and paging for those databases which have built in paging support (SQL 2005, Oracle and MySQL). If you have been experimenting with our esDataSource we encourage you to upgrade this weekend when the new beta becomes available.

        The sample ASP.NET web form below uses Northwind's Employees table and takes advantage of the built in paging capablities of EntitySpaces which in SQL 2005 uses the ROW_NUMBER function. Why Microsoft chose this syntax over the MySQL syntax for paging is hard to fathom. However, you wont have to worry about that as EntitySpaces takes care of this for you. The nice thing about the web form below is that it required almost no coding whatsoever and handles sorting and paging automatically. The TextBox is populated with the text from the EntitySpaces esDynamicQuery.es.LastQuery property each time data is fetched from the database so we can see the actual query.

        The page above can also edit, delete, and save the data without writing any code as well. And more importantly, the GridView was setup entirely in design mode. The esDataSource runs just fine in Medium Trust mode as well, you'll find most DataSourceControls do not as they use heavy reflection unlike the EntitySpaces DataSource which uses NO REFLECTION.

        So how did we build it?

        Let's start from the beginning.

        Add the esDataSource assemblies to your project

        1. EntitySpaces.Web.dll
        2. EntitySpaces.Web.Design.dll

        Getting esDataSource in your Toolbox

        After adding the two assemblies mentioned above (or projects if you have purchased the source code) you should be able to recompile and see the esDataSource show up on your toolbox. If you do not see it you might have to close and reopen Visual Studio. If you still do not see the esDataSource in your Toolbox you can always right mouse on your Toolbox and choose Add Tab to add a new tab. Once you have given your tab a name "right mouse" on the tab and select Choose Items  and browse to the EntitySpaces assemblies folder and click on the EntitySpaces.Web.dll. The assemblies can be found here:

        The Trial Version Assemblies
        C:\Program Files\EntitySpaces\EntitySpacesDemo\EntitySpacesDemo\Runtime

        The EntitySpaces Developer Assemblies
        C:\Program Files\EntitySpaces\Redistributables

        Design Time Setup 

        This is what our final page looks like in design time, notice we have our esDataSource control and a TextBox on the form. The entire page took less than 5 minutes of setup and design time.

        Choosing columns

        Notice in the image below that we have pointed to our class library named BusinessObjects.dll as the assembly that contains the EntitySpaces collection(s) we desire to use. You might not have to do this depending on how your project is setup. If you have a traditional .NET 1.1 type of "Project" based web solution then you will probably see your esEntityCollections without browsing to an assembly. However, if you have your esEntityCollection in a class library you will need to browse to that assembly or DLL. Reflection is used to populate this information however this reflection is in the EntitySpaces.Web.Design.dll which is not used at runtime. This brings up a tricky issue regarding new .NET 2.0 file based projects. "What assembly do we load?"  Well, for now our recommendation is for you to launch your web application without debugging it and browse to the app_code.dll. You will find it here: 

        C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\esdatabinding\8a81ff31\51684664\App_Code.fbpesify.dll

        Kind of cumbersome we admit, in the above path esdatabinding is the name of the webapplication and you just kind of guess Angry on the other two, it's pretty easy though as there are only like one or two folders in those directories. It's well worth it however considering the time you can save.

        Tying the GridView to the esDataSource

        Right mouse on your GridView and choose "Show Smart Tag". Set the esDataSource and the DataSource and in this sample we enabled all of the other options. 

        After this you can go into the normal GridView designer dialogs and reorder the columns and set other properties.

        Implementing a few key esDataSource Properties and Events

        If you select your esDataSource and look at the properties you can set the AutoPaging and AutoSorting properties to True. However, you will need SQL 2005, Oracle, or MySQL in order for AutoPaging to work.

        Now let's hook up some events.

        We only truly need two events, the esCreateEntity and esSelect. For a grid that doesn't allow editing then only the esSelect event is needed. The esPostSelect event is needed to populate the TextBox with the esDynamicQuery.es.LastQuery text which will be explained below.

        First, since we have decided to use Paging we need to tell the esDataSource how many rows are in the data that we are browsing. Don't let the code below confuse you. All we are doing here is using our single entity, Employees to get the total row count and assign it the esDataSource.TotalRowCount property, we only have to do this one time. If we add or delete rows of course we should adjust it. We also set the default sorting on the grid which is important as well. Remember, using the built in paging of the database itself means we don't actually return all of the rows, we only return as many rows as we show on each page, this is why this type of paging is very fast even with mega resultsets.

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                Employees emp = new Employees();
                emp.Query.es.CountAll = true;
                emp.Query.es.CountAllAlias = "Count"
                if (emp.Query.Load())
                {
                    esDataSrc.TotalRowCount = (int)emp.GetColumn("Count");
                }

                gridView.Sort(EmployeesMetadata.PropertyNames.LastName, SortDirection.Ascending);
            }
        }

        esSelect

        Okay, Let's look at what is required for our esDataSrc_esSelect event which is used to provide the data for the esDataSource.

        protected void esDataSrc_esSelect(object sender, esDataSourceSelectEventArgs e)
        {
            EmployeesCollection coll = new EmployeesCollection();

           // Assign the esDataSourcSelectEvenArgs Collection property
            e.Collection = coll;
        }

        Yes, it's that easy. You can have a fully sortable, pageable grid with no more than those few lines of code.

        Notice that all had to do was create our collection and assign it to the esDataSourceEventArgs.Collection property. We don't use any Where condition in this example. However, if we did need to use them we would simply use the coll.Query.Where() method to assign them. However, and this is important. If you set the esDataSource to use either AutoPaging or AutoSort you DO NOT load the collection via Query.Load() or LoadAll(). The reason is that the esDataSource itself is going to apply the OrderBy properties for sorting  and or PageSize/PageNumber properties for paging and then call Query.Load() on your collection.

        esCreateEntity

        If you allow editing in your grid then you need to provide the esCreateEntity event, here is our esDataSrc_esCreateEntity event.

        protected void esDataSrc_esCreateEntity(object sender, esDataSourceCreateEntityEventArgs e)
        {
            Employees entity = new Employees();

            if (e.PrimaryKeys == null)
                entity.AddNew();
            else
           
            entity.LoadByPrimaryKey((int)e.PrimaryKeys[0]);

            // Assign the Entity
            e.Entity = entity;
        }

        esPostSelect

        Finally, we want to display the actual query that is run each time the esDataSource populates the grid for curiousity reasons. Since we don't call Query.Load() ourselves we need to implement the esPostSelect event and gain access the loaded collection there.

        protected void esDataSrc_esPostSelect(object sender, esDataSourceSelectEventArgs e)
        {
            this.txtLastQuery.Text = e.Collection.es.Query.es.LastQuery;
        }

        That's it. Those four methods are all that is required to make our page handle sorting, paging, editing, modifying and save the data.

        Don't worry, if you're not using a database that provides built in paging you can still do paging, but you will have to provide custom paging logic, however, the esDataSourceSelectEvenArgs does provide you with the PageNumber and PageSize prefilled in, you just have to fetch the data correctly.

        esDataSource "State"

        The esDataSource now makes it very easy for you to deal with postbacks. There is a property named "State" which is a Hashtable that you can use to store things in (not just strings either, anything that is serializable). The nice thing is the Hashtable (esDataSource.State) lives accross postbacks. This can be handy when you desire to trap the gridView_SelectedIndexChanged event and pass the id or id(s) to another esDataSource to use, an example would be a FormView or DetailsView control.

        protected void gridView_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.esDataSrc.State["EmployeeID"] = this.gridView.SelectedDataKey.Value;
        }

        This is a glimpse of what is coming in this weekends ES 2007 beta. Also, for Windows.Forms we now fully support the INotifyPropertyChanged event which you can choose on the Generated Template's "Advanced Tab".

        Upon release of the official EntitySpaces 2007 there will a very complete PDF manual documenting our esDataSource control.

         

        The EntitySpaces Team
        --

        EntitySpaces LLC
        Persistence Layer and Business Objects for Microsoft .NET
        http://www.entityspaces.net



        posted on Saturday, April 28, 2007 10:03:08 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Saturday, April 14, 2007

        Our next EntitySpaces 2007 beta is at the door. In this beta we will have Medium Trust support and a few nice tweaks concerning finding our assemblies in the Visual Studio references dialogs. The EntitySpaces assemblies can now be installed in the GAC if you so desire.


        Assemblies

        Before installing EntitySpaces 2007 Beta v0.0415 we want you to uninstall any prior beta and then completely delete your EntitySpaces folder if you can. We strongly advise this so that our new installation layout doesn't intermix with your current files as the folder layout has changed somewhat.

        If you accept the default path during installation the EntitySpaces assemblies will be found here:

        • C:\Program Files\EntitySpaces\Redistributables
        • C:\Program Files\EntitySpaces\Redistributables\CE

        The installer will also ad a few registry entries that cause the EntitySpaces assemblies to show up when you choose "Ad Reference" in Visual Studio, no need to browse. However, we do not install the EntitySpaces assemblies into the GAC during installation. You can do this of course for your installations as you roll out your application but there is no need, the ability is there of course.

        Here is what you will see when you choose Add Reference in a non-Compact Framework application.


        You might notice a few new assemblies, we'll get to those in a moment. The nice thing is there is no more browsing for these even though they are not installed in the GAC.

        If you are working on a Compact Framework application here is what you will see when you choose "Add Reference" from within Visual Studio.
         


        The ability to have your assemblies show up in the reference dialog requires that we make a registry entry. The installer has a checkbox for this that is "on" by default, you can uncheck it if you prefer to browse to your assemblies.

         

        Medium Trust

        You probably noticed a few new assemblies above, specifically the "loaders". The loaders enumerate through all of your registered connection entries loading the appropriate EntitySpaces Providers to support each connection. There are two forms of the loader. The non-medium trust and the medium trust version. No matter which type of loader you use you will only need to ship the data providers that you actually use. Here are the two loaders.

        • EntitySpaces.LoaderMT = medium trust (no reflection)
        • EntitySpaces.Loader     = (uses reflection, the way ES has always been up until this point)

        It is our recommendation that you USE the medium trust loader. It is faster and will work in any environment. Your application will now require a one time call to assign the proper loader at program startup. Here is how we recommend that you do this in your code.

        This is how our EntitySpaces Demo Application initializes the Loader (Windows Forms App)
         

        namespace EntitySpacesDemo
        {
           static class Program
           {
              [STAThread]
              static void Main()
              {
                
        esProviderFactory.Factory =
                    new EntitySpaces.LoaderMT.esDataProviderFactory();

                 Application.EnableVisualStyles();
                 Application.SetCompatibleTextRenderingDefault(false);
                 Application.Run(new Demo());
              }
           }
        }

         

        For an ASP.NET the best approach is probably to add a "Global Application Class" or Global.asax file. Here is an example" 

        <%@ Application Language="C#" %>

           <script runat="server">

              void Application_Start(object sender, EventArgs e)
              {
                 EntitySpaces.Interfaces.esProviderFactory.Factory =
                    new EntitySpaces.LoaderMT.esDataProviderFactory();

              }

           </script>

        If you are using the configless support (as do our DotNetNuke users) then you want to assign your loader after your connections are registered.

         

        The EntitySpaces Team
        --
        EntitySpaces LLC
        Persistence Layer and Business Objects for Microsoft .NET
        http://www.entityspaces.net/

        posted on Saturday, April 14, 2007 9:38:10 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Sunday, April 08, 2007

        Our next beta will have, among other things, paging built right into the EntitySpaces architecture. The EntitySpaces dynamic query API has two new properties, StartRow and PageSize. Here is a very simple dynamic query that uses these two new properties. This feature will be built into all providers for databases that support some sort of built in paging. The example below uses the EntitySpaces.SqlClientProvider and only works on SQL 2005 as it takes advantage of the new ROW_NUMBER() function in SQL 2005.  

        EmployeesCollection coll = new EmployeesCollection();
        coll.Query.Select(coll.Query.LastName, coll.Query.FirstName);
        coll.Query.OrderBy(coll.Query.LastName, esOrderByDirection.Ascending);
        coll.Query.es.StartRow = 25;
        coll.Query.es.PageSize = 10;
        if(coll.Query.Load())
        {
             Console.WriteLine(coll.Query.es.LastQuery);

        Notice that we print the Query's LastQuery property. EntitySpaces always provides the raw text back from a query for debugging purposes. Let's take a look at the SQL generated and executed by EntitySpaces. 

        WITH [withStatement] AS
        (
            SELECT [LastName],[FirstName] , ROW_NUMBER() OVER( ORDER BY [LastName] ASC) AS ESRN FROM [Northwind].[dbo].[Employees]
        )
        SELECT [LastName],[FirstName] FROM [withStatement] WHERE ESRN BETWEEN 25 AND 34

        Now that we have paging built into the EntitySpaces architecture our new esDataSource control for ASP.NET will expose a PageSize property that you can set. The esDataSource control will then perform all of the paging logic for you automatically. You will be able to build sortable pages that can add, edit, and delete and page through data in a matter of minutes.

         

        The EntitySpaces Team
        --
        EntitySpaces LLC
        Persistence Layer and Business Objects for Microsoft .NET
        http://www.entityspaces.net/

        posted on Sunday, April 08, 2007 7:35:34 PM (Eastern Standard Time, UTC-05:00)  #    Comments [3]
         Sunday, March 11, 2007

        Work is coming along quite nicely on our ASP.NET Design Time support for EntitySpaces 2007. Below is a screen shot of the EntitySpaces ASP.NET design time dialog that will allow you to setup your databinding mappings for grids, detail forms, and other controls in ASP.NET. Notice the image shows a GridView being bound to our new esDataSource control right within Visual Studio.

          

        The esDataSourceDesigner control uses reflection to locate all of the classes derived from the EntitySpaces esEntityCollection class. However, the esDataSource uses NO reflection. The design time support is in a separate assembly that does not need to be present for runtime and therefore has no bearing on our medium trust support. The design time dialog will allow you to choose which collection to use in your binding. After choosing the desired collection you can then choose which columns to display.  Once you select "Ok" the grid will then add the columns you have chosen as bound columns and also populate the grid with some design time only data so you can see the layout.


        The above image is what you will see when you select the "Columns" property in the GridView's options dialog. You can then further customize the order and all of the "normal things" in here as well. Also, Below you can see the DataKeyNames dialog being used to pick the primary keys in the grid.

        And finally, EntitySpaces has taken a wiser path than some of the other implementations. The suggested approach by Microsoft is that folks build their queries in the dialog for updates, selects, deletes and so on? Thus, we would have had to have come up with some crazy "text based" query mechanism that is the equivalent of our dynamic query API. This is a non-starter. Instead, we provide a few key events that are called at the appropriate times that will allow you to use our familiar dynamic query API in code (as it should be).
         

        Our esDataSource_Select even is used to create our CatagoriesCollection and then load it any way we see fit. We set the esDataSourceSelectEventArgs Collection property to our loaded collection.


        protected void esDataSource_Select(object sender, EntitySpaces.Web.esDataSourceSelectEventArgs e)
        {
            CategoriesCollection cats = new CategoriesCollection();
            cats.Query.Where(cats.Query.CategoryName.Like("%Candy%"));
            cats.Query.Load();

            e.Collection = cats;
        }


        There is currently only one other event that needs hooked up and that is the CreateEntity event. However, we are providing many more events that will allow you to fully customize everything if you desire to. However, you will only need to handle two or three events to have a fully editable grid or other control working with add/edit/delete functionality. This will be included in our next EntitySpaces 2007 beta. There are a few issues of course still that we are still working out but our thinking is this is really going to power-up your ASP.NET development.

        The EntitySpaces Team
        --
        EntitySpaces LLC
        Persistence Layer and Business Objects for Microsoft .NET
        http://www.entityspaces.net/
        posted on Sunday, March 11, 2007 12:18:55 PM (Eastern Standard Time, UTC-05:00)  #    Comments [3]
         Saturday, March 03, 2007

          


        EntitySpaces 1.6 has been renamed EntitySpaces 2007. This does not imply that we have adopted a 1 year release schedule by any means. Our versioning will be as follows. An assembly version of 2007.4.0804 is broken down as follows; 2007 is the year, 4 is the release, 0804 represents August 4th. However, we will no longer refer to our releases by the assembly versions, instead, if the assembly version is 2007.4.0804 we will refer to it as "EntitySpaces 2007 v4". Each new release will bump the assemblies accordingly. We feel that this is a much better way of communicating our release numbers while at the same time providing some context on the age of any given release.

        There is one exception to our new versioning convention and this will occur during beta releases. Upon our first release of the EntitySpaces 2007 beta the assembly versions will be 2007.0.0304 where 2007 is the year, 0 is the release, 0304 is March 4th. We will refer to this as EntitySpaces 2007 Beta v0.0304. During beta releases the release number will not be incremented, only the date portion will be. If the next beta were to be released on March 21st the assembly versions will be 2007.0.0321 and we will refer to this as EntitySpaces Beta 2007 v0.0321.  The official release of EntitySpaces 2007 will be EntitySpaces 2007 v1.

         

         

        The EntitySpaces Team
        --
        EntitySpaces LLC
        Persistence Layer and Business Objects for Microsoft .NET
        http://www.entityspaces.net/

        posted on Saturday, March 03, 2007 4:30:07 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Sunday, February 25, 2007

        Another area of enhancement is complete, and that is our improvements to the EntitySpaces Dynamic Query API. We took some steps not covered in this blog post to hide extraneous items from the intellisense when building Dynamic Query's via intellisense. We have also opened the door to all kinds of SubOperators, some simple samples are shown below, of course these work on all of the EntitySpaces data providers as well. It is our hope that during our 1.6 beta our users will suggest more SubOperators, and as long as they apply across most databases there's a good chance they will make the release.

        So here's the Sneak Peak ...


        Notice the ToLower() SubOperator and the As() aliasing mechanism. These are both new to the 1.6 DynamicQuery Mechanism.

        Employees emp = new Employees();
        emp.Query.Select(emp.Query.LastName.ToLower().As("LastNameLower"));
        emp.Query.Where(emp.Query.EmployeeID == 1);
        emp.Query.Load();

        Generates ...

        SELECT LOWER([LastName]) AS 'LastNameLower' FROM [Employees] WHERE ([EmployeeID] = @EmployeeID1)



        Notice the LTrim and Substring SubOperators as well as the As aliasing mechanism

        Employees emp = new Employees();
        emp.Query.Select(emp.Query.LastName.LTrim().Substring(0,1).As("FirstInitial"));
        emp.Query.Where(emp.Query.EmployeeID == 1);
        emp.Query.Load();

        Generates ...

        SELECT LTRIM(SUBSTRING([LastName],0,1)) AS 'FirstInitial' FROM [Employees] WHERE ([EmployeeID] = @EmployeeID1)



        Finally, the Aggregates underwent a breaking change, it will be very easy to upgrade these and we felt it important to have our Aggregates conform with the rest of the syntax. We apologize for the breaking change but felt it important to make this change now. We feel that when you look at the two syntax's shown below you will agree the 1.6 syntax is superior and really shines with intellisense.

        1.5.3 Syntax
        emp.Query.Select(emp.Query.LastName.Count("TheCount", true));

        1.6.0 Syntax
        emp.Query.Select(emp.Query.LastName.Count().Distinct().As("TheCount"));



        The SubOperators that will be available in the 1.6 March 4th beta are as follows:

        • ToUpper
        • ToLower
        • LTrim
        • RTrim
        • Trim
        • Substring

        There are many more that can be implemented, the architecture is now in place to support them and the syntax nests properly as you can see in the Substring example above. Something we've been thinking about that won't make our 1.6 Release but will find it's way onto an upcoming Roadmap is SubSelects. We already support the IN in the where clause of course. We're not sure on the syntax but perhaps something like this:

        Future Roadmap ....

        Customers cust = new Customers();
        Employees emp = new Employees();

        emp.Query.Select(emp.Query.EmployeeID, emp.Query.FirstName);
        emp.Query.Where(emp.Query.EmployeeID.In
        (
             emp.Query.SubSelect(cust.Query.Location == "Indianapolis");
        )
        emp.Query.Load();


        The EntitySpaces Team
        --
        EntitySpaces LLC
        Persistence Layer and Business Objects for Microsoft .NET 2.0
        http://www.entityspaces.net/

        posted on Sunday, February 25, 2007 8:06:30 PM (Eastern Standard Time, UTC-05:00)  #    Comments [2]
         Friday, February 16, 2007

        We are working hard on our upcoming 1.6 release and we are very excited about it. EntitySpaces 1.6 is going to deliver a truly amazing set of features. The EntitySpaces esTransactionScope class is being greatly enhanced to provide even more power and flexibility for your enterprise level development projects. Before we begin, however, a little background is in order.

        Before the Microsoft .NET Framework was released most of my development (Mike) involved creating COM+ object models on top of SQL Server using C++. These objects models would then be consumed by VBScript programmers to create corporate websites. This might date me a little but I was there when OLE 1.0 was released. Later, when NT Service Pack 4 was released MTS became a serious technology and it really got interesting. Finally, it was all rolled into Windows NT itself as COM+. I designed many large Distributed Network Architectures (DNA) using COM+ to protect several concurrent SQL Servers / MSMQ servers which then delivered packets to EIA brokers, all in a single distributed transaction. It was the stuff dreams are made of. If it's one thing I know, it's that the transaction is the heart of any architecture and should be front and center in your ORM solution. In the end, before the dawn of .NET, I was using the Active Template Library (ATL) in combination with the Standard Template Library (STL) to create incredibly high performing distributed network architectures. Indeed, ATL and STL in the right hands was a deadly weapon.

        When Microsoft .NET was released I created dOOdads (back in the leather helmet days). I used COM+ as my inspiration. There was no way I was going to do what most of the industry was doing and that was passing Transactions and Connections around all throughout my API, it had to be seamless. Thus, I used Thread Local Storage (TLS) and stuffed the Transaction into a slot on the thread. Then, down low in the architecture the base classes simply enlisted into the transaction, if there was an ongoing transaction. To the programmer it's magic.

        If you are familiar with the TransactionScope class in the Microsoft .NET System.Transactions namespace then you will be very comfortable with the EntitySpaces esTransactionScope class. The really cool thing about the .NET TransactionScope is how it uses the "using" syntax to control the transactions "scope" or lifetime. EntitySpaces runs fine using the .NET TransactionScope, however the System.Transactions.TransactionScope class can add some significant overhead if you are not in need of distributed transactions. The .NET TransactionScope is a truly amazing work of art itself in the way it can promote local lightweight transactions to distributed transactions when another resource is enlisted. However, there is a certain amount of overhead when using the .NET TransactionScope class and most hosting companies will not allow you use the .NET TransactionScope class as it enlists the Distributed Transaction Coordinator (DTS). 

        In summary, the esTransactionScope class uses Thread Local Storage (TLS) to avoid intrusion and takes advantage of the the "using" syntax to control a transactions "lifetime". The esTransactionScope fills a very noticeable void in the Microsoft .NET Framework, and that is an elegant solution for ADO.NET connection based transactions.

        Currently, in our 1.5 release esTransactionScope can be nested as follows:

        using (esTransactionScope scope = new esTransactionScope())
        {
            Employees emp = new Employees();
            emp.LoadByPrimaryKey(1);
            emp.FirstName = "Joe";
            emp.Save();
        
            Customers cust = new Customers();
            // ...
            cust.Save();
        
            scope.Complete();
        }


        In the code above, both the Employees and Customer Save methods also use the esTransactionScope, they can be nested just fine. Only when the final outer scope.Complete() is executed is the transaction truly committed. However, there are times when you might want to write to a SQL table during an exception possibly caused by a rolled back transaction, for instance, to record the callstack information. Or you might just otherwise need to break out of an ongoing transaction. You might even want to have a nested transaction that acts as it's own root transaction much like a COM+ requires new transaction. We have added this granular level of control in the enhanced 1.6 esTransactionScope class. The ability to nest all of these different types at your leisure greatly enhances your power to accomplish what you need to with EntitySpaces. In our 1.6 release the esTransactionScope accepts an optional parameter on it's constructor, and that is the esTransactionScopeOption enum.

        public enum esTransactionScopeOption
        {
            // Summary:
            //     A transaction is required by the scope. It uses an ongoing transaction if
            //     one already exists. Otherwise, it creates a new transaction before entering
            //     the scope. This is the default value.
            Required = 0,
            //
            // Summary:
            //     A new transaction is always created for the scope.
            RequiresNew = 1,
            //
            // Summary:
            //     Any ongoing transaction is suppressed when creating the scope. All
            //     operations within the scope are done without a transaction.
            Suppress = 2,
        }


        The following code snippet shows how you can nest and control the transactions at a very granular level. However, our recommendation is to run with Required for all nested transactions. You must be careful not to create deadlocks. The default isolation level of esTransactionScope is Serializable, which offers the most protection.

        using (esTransactionScope rootTrans1 = new esTransactionScope())
        {
            using (esTransactionScope noTrans = new esTransactionScope(esTransactionScopeOption.Suppress))
            {
                // Anything done in here runs without a transaction because of the "Suppress"
                esUtility util = new esUtility();
                int count = (int)util.ExecuteScalar(esQueryType.Text, "Select Count(*) From Employees");
        
                using (esTransactionScope scope = new esTransactionScope())
                {
                    // This transaction scope uses the default is Required, therefore it enlists in "rootTrans1"
                    Employees emp = new Employees();
                    emp.LoadByPrimaryKey(1);
                    emp.FirstName = "Joe";
                    emp.Save();
        
                    using (esTransactionScope rootTrans2 = new esTransactionScope(esTransactionScopeOption.RequiresNew))
                    {
                        // This is a new root transaction and doesn't partake in "rootTrans1"
                        Employees emp1 = new Employees();
                        emp1.LoadByPrimaryKey(2);
                        emp1.FirstName = "Sam";
                        emp1.Save();
        
                        // Since this was a RequiresNew tranaction, the true commit is done here
                        rootTrans2.Complete();
                    }
        
                    // Doesn't commit yet, as "rootTrans1" is the root
                    scope.Complete();
                }
        
                noTrans.Complete();
            }
        
            // Commits the rootTrans1 and any nested transactions
            rootTrans1.Complete();
        }

        If you were paying attention to the above code you might have noticed the new esUtility class, this class allows you to execute any SQL without using a specific EntitySpaces Collection or Entity, thus the name, esUtility. This is just a sneak peak and we will post many more of these to give you insights into our next release.


        The EntitySpaces Team
        --
        EntitySpaces LLC
        Persistence Layer and Business Objects for Microsoft .NET 2.0
        http://www.entityspaces.net/

        posted on Friday, February 16, 2007 9:52:19 PM (Eastern Standard Time, UTC-05:00)  #    Comments [3]
         Thursday, February 01, 2007

        On February 10, 2007 Jaime (Cano) Noriega will be holding a session at the South Florida .NET Code Camp titled "Data the Easy Way". Jaime's presentation will be featuring EntitySpaces and how it applies to Winforms, ASP.Net, and Compact Framework. The code camp is being held at Devry University in Miramar, FL so if you get a chance register and attend the conference. You can see the Agenda HERE

        --
        EntitySpaces LLC
        Persistence Layer and Business Objects for Microsoft .NET 2.0
        http://www.entityspaces.net

        posted on Thursday, February 01, 2007 10:00:02 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Friday, December 22, 2006

        The estimated date for the EntitySpaces 1.6.0 release is March 15th, 2007. This date is only an estimate but it is our intended goal to hit that release date. There will be a full beta period before the release and all customers will be able to participate. There are numerous fixes and small items in our tracking system not listed here that will make it into this release. We are showing just the major features here.

        Data Binding

        This is going to be the main focus of the EntitySpaces 1.6.0 release. We will be adding design time data binding to our ASP.NET support. We will also be testing using the .NET GridView, the Telerik r.a.d.grid, Infragistic’s WebGrid, and a few others. We will test in both Windows Forms and ASP.NET environments.

        We will implement the Microsoft .NET DataSourceControl class for EntitySpaces to allow for ASP.NET design time support to make things even easier. Two-way data binding will also be supported. EntitySpaces will also support the .NET DetailsView/FormView controls.  Finally, hierarchical data binding will be supported so that you can drill down through the hierarchical data model in your grid, if your grid supports hierarchical data binding.

        Samples of EntitySpaces being used in all of the above environments will be made available for download as well. These data binding enhancements represent a major chunk of work and are no small undertaking.

        Hierarchical Improvements

        The hierarchical data model currently only saves from the top down. Our plan is to remove this constraint from the hierarchical model and make it so that it doesn’t matter where you jump into the tree, or whether your traverse it up or down. It will always save correctly no matter what node you call Save on.

        Also, added to the hierarchical templates will be an exclude table list. This list  will allow you to exclude certain tables from the model.  If any foreign keys link to a table in the exclude list that entry will not be created, thus, you control what tables are referenced in the hierarchical model.

        Medium Trust Support

        We will be adding support for running in medium-trust mode which is important when running under certain hosting environments.

        Optional Base Class

        There will be a checkbox on the master templates that will allow you to slice in your own class between your generated class and the esEntity or the esEntityCollection class. This will allow you to include core functionality across all of your classes within a single base class.

        Query API Enhancements

        Enhancements to the QueryAPI such as StartsWith, EndsWith, RTrim, LTrim, Trim, Upper, Lower, Row + Top/Limit (MySql, Oracle, and SQL 2005’s ROW_NUMBER will work via these).

        Utility Class

        There will be a new utility class that will allow you to inherit from or use it directly to call miscellaneous stored procedures and such that really are system wide and don’t make sense in any of your custom classes.

        Stored Procedure Based Entities

        At this point the plan is to create read-only entities using stored procedures as the source, this has been asked for by lots of folks and we will be asking for input on this before we implement.

        Webservices

        Publish Full Xml and Binary WebServices Examples

        posted on Friday, December 22, 2006 6:16:25 PM (Eastern Standard Time, UTC-05:00)  #    Comments [2]
         Saturday, December 02, 2006
        The EntitySpaces team decided to take a slight detour from its upcoming 1.6.0 release and add support for the Compact Framework to its popular architecture, which is a persistence layer and business object system for Microsoft .NET 2.0. Support for the Compact Framework paves the way for VistaDB 3.0 and the Microsoft SQL Compact Edition well in advance of their official releases. Both VistaDB 3.0 and the Microsoft SQL Compact Edition are still in CTP mode. EntitySpaces classes are generated from your database schema using download.com's #1 download in the .NET development category, MyGeneration, using the EntitySpaces template suite.

        EntitySpaces LLC has created a sample application using a very powerful combination of its EntitySpaces architecture in conjunction with VistaDB 3.0, and running both under the Windows Mobile 5.0 Smartphone emulator. Setting up the demo solution was very simple. First, references to the EntitySpaces.Core.Ce and EntitySpaces.Interfaces.Ce assemblies were added. Next, a reference to the EntitySpaces.VistaDB.Ce data provider was added. Finally, the VistaDB Northwind.vdb3 database was added to the project and its "Build Action" was set to "Content" to ensure that the database is copied along with the other assemblies to the proper folder when the simulator is launched. To see the solution in Visual Studio click HERE.


        Click here for a larger view The next step was to write the code to connect to the VistaDB Northwind database. To accomplish this, the new configless execution feature provided by the recent EntitySpaces 1.5.2 release was used. The trick was actually figuring out how to get the correct path to the database while running in the simulator. You can see how this was accomplished in the first line of the following code snippet.

            string cnString = ("Data Source =" + (System.IO.Path.GetDirectoryName
             (System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) +
             "\\Northwind.vdb3; Open Mode = ExclusiveReadWrite"));
        
            // What the heck let's register a connection
            esConnectionElement conn = new esConnectionElement();
            conn.ConnectionString = cnString;
            conn.Name = "VistaDb";
            conn.Provider = "EntitySpaces.VistaDBProvider.Ce";
            conn.ProviderClass = "DataProvider";
            conn.SqlAccessType = esSqlAccessType.DynamicSQL;
            conn.ProviderMetadataKey = "esDefault";
            esConfigSettings.ConnectionInfo.Connections.Add(conn);
        
            // Assign the Default Connection
            esConfigSettings.ConnectionInfo.Default = "VistaDb";


        The only option on the opening Menu brings the user to a form which contains a DataGrid bound directly to an EntitySpaces EmployeesCollection object loaded with all of the employees in the database. Note that you can use the EntitySpaces collections in design time mode directly on the form itself, this can be seen HERE. The EntitySpaces dynamic query mechanism was used to limit the columns brought back from the database to only those needed to operate the DataGrid. These included the EmployeeID, FirstName, and LastName columns. Finally, the DataGrid TableStyles collection was used to set the EmployeeID column's width to zero so that it would not be visible. The only thing left to do is fetch the data and assign the EntitySpaces collection directly to the DataGrid.DataSource property.

        The developer will never need to use any ADO.NET code, or any specific VistaDB code to accomplish this task. In fact, the developer could easily swap out the EntitySpaces VistaDB provider and exchange it for the EntitySpaces Microsoft SQL CE provider, and run the same exact binary code. The EntitySpaces architecture itself is tested using NUnit against all five supported databases using the same exact binary code. No recompilation necessary. The code used to fetch the data and bind to the DataGrid is shown below and taken from the FormGrid class in the demo.

         

        Click here for a larger view     private void PopulateGrid()
            {
                EmployeesCollection empColl = new EmployeesCollection();
                empColl.Query.Select
                    (
                        empColl.Query.EmployeeID,
                        empColl.Query.FirstName,
                        empColl.Query.LastName
                    );
                empColl.Query.Load();
        
                this.theGrid.DataSource = empColl;
            }

        It really is that simple. Next, the "Edit Record" menu item needs to be handled in order to navigate to the editing form. To accomplish this the hidden EmployeeID needs to be grabbed, and passed to the "FormEdit" page based on the selected row at the time the "Edit Record" menu item is clicked.

            private void menuItem_EditRecord_Click(object sender, EventArgs e)
            {
                int index = this.theGrid.CurrentRowIndex;
                int id = (int)this.theGrid[index, 0];  // index is the row
                                                       // zero = the first column
                FormEdit form = new FormEdit(id);
                form.Show();
            }

        It is on the editing page where users can modify, delete, and add new records. Remember from above that the EmployeeID is passed to the FormEdit page. The constructor for the FormEdit page is very easy to implement using EntitySpaces architecture. Here, instead of the EmployeesCollection, the Employees class is used to load the correct record. The Employees class is used to hold a single record, whereas, the EmployeesCollection holds a set of Employees classes. The record is loaded using the LoadByPimaryKey method as shown in the code snippet below. Finally, the labels and textbox controls are populated with the data from the EntitySpaces Employees object. 


         

        Click here for a larger view

         

         

            public FormEdit(int employeeID)
            {
                InitializeComponent();
        
                Employees emp = new Employees();
                if (emp.LoadByPrimaryKey(employeeID))
                {
                    this.lblID.Text = emp.str.EmployeeID;
        
                    this.txtFirstName.Text = emp.FirstName;
                    this.txtLastName.Text  = emp.LastName;
                }
                else
                {
                    this.lblError.Text = "Employee not found";
                }
            }

        On the editing screen shown on the left Margaret's first name has been changed to "Mary" and then saved using Save on the menu. The ability to add and delete records is in the EntitySpaces Mobile demo too but not shown here. Pressing close will return the user to the DataGrid form reflecting any edits that may have occurred. The image on the right reveals that not only was Margaret's name changed to Mary, but "Mike Griffin" was added to the database as well. The grid is refreshed in the Activated event of the FormGrid class. 

        It should be clearly seen how easy EntitySpaces can be used to work with the Compact Framework. Click here for a larger viewWhile creating the demo we were very impressed with VistaDB 3.0. VistaDB has some features that we found make it very attractive. First, VistaDB has some nice advantages over the Microsoft SQL Compact Edition. The VistaDB Namespace doesn't change when moving to the Compact Framework. The Microsoft Compact Edition, however, uses SqlCeClient instead of SqlClient, which makes it more difficult for developers to maintain a single codebase. The EntitySpaces architecture conveniently hides these low level issues from the developer, thereby isolating code from such provider quirks. Also, the same VistaDB database (the exact same physical file) will run on all environments with no loss of features or a lesser SQL syntax when running under the Compact Framework.

        Having said that, the EntitySpaces Architecture does support the Microsoft SQL Compact Edition fully, and we will publishing the same demo application shown here for it very soon. We are just putting a few finishing touches on the EntitySpaces provider for the Microsoft SQL Compact Edition. The SQL supported under the Microsoft SQL Compact Edition is different than what is allowable under Microsoft SQL 2005. The EntitySpaces user of course will never realize these differences and that is one of the main strengths of EntitySpaces.

        The EntitySpaces Mobile demo will be available for download Monday December 4th by 8:00 AM EST time. A link will be posted on this page.

         

         

         

         

         

         


        - The EntitySpaces Team

        posted on Saturday, December 02, 2006 10:08:43 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Saturday, November 25, 2006

        Venexus Inc., decided to build a full blown search engine for DotNetNuke. Not one that would just index a single DNN site, but one that would allow you to index all portals in a DNN installation AND information from external sites. And how would external site indexing best be handled? via RSS feed aggregation of course. Seamus is the first of the two modules that make up the Venexus Search Engine. SEAMUS = Search Engine Aggregation Module Utilizing Syndication.

        A Quote from the Venexus blog posting written by Venexus CEO Jeff Smith

        " We started with traditional DotNetNuke module development…until EntitySpaces was released. I’m an old ASP/VB developer and personally, it took me a bit to get my head wrapped around how ES worked, but once I figured it out, I was hooked. ES saves the day by automagically generating all the CRUD (create, read, update, delete). While very similar to the logic of a BusinessController and InfoObject, ES uses Collections and Entities. But, where I found ES the most useful is the Dynamic Queries you can write directly into the business logic.

        Sure, I have used DAL Builder Pro, which was a huge time saver, but EntitySpaces made me to never want to develop any other way. Plus, last I checked, DAL Builder Pro was still only for DNN 3 development. The ease of generating the DAL and the ability to easily Regenerate the DAL if the database schema changes, makes ES the tool of choice for all of our module development. I cannot even begin to count the hours I have previously spent hand coding changes in a DAL due to spec changes. Oh how I wish I had all those hours back!

        With the new DNN admin grid templates, it is just ridiculous how much code is generated before having to write the first line. The new template will generate an editable grid of the table(s), with sorting, paging, and search. If you are interested in .Net development (this is not just a DNN tool, it works for all .Net 2.0 development and using C# or VB.Net), you must check it out. "

        read more on the Venexus blog ...

        Venexus Inc., is a leading Business Service Provider, creates customized, easy to use DotNetNuke modules for corporate portals.

        posted on Saturday, November 25, 2006 11:48:11 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Wednesday, November 22, 2006

        The EntitySpaces team has been hard at work. We just pushed up a new 1.5.2 beta with lots of great new features such as: a new provider for VistaDB, the ability to programmatically set a default connection which facilitates configless operations, and full support for the DotNetNuke object qualifier. However, we have also been investing a great deal of time on our documentation. We have been using NDoc thus far, but with the recent melt down we began keeping an eye on Sandcastle waiting for the product to mature to a level that we felt comfortable with in order to ship it with EntitySpaces. We also found a very helpful tool cleverly entitled SandcastleGUI. Well, rejoice all ye users the time has come. Let me give you a quick peek at the new documentation. Click on one of the thumbnails below for a full size version.

        The new documentation will ship with our 1.5.2 release and the improvements in both presentation and content should make using EntitySpaces even easier(is that even possible?;). We hope you find the new documentation useful, and as always ping us with any suggestions, comments, or questions.

        posted on Wednesday, November 22, 2006 10:21:04 AM (Eastern Standard Time, UTC-05:00)  #    Comments [3]
         Sunday, November 19, 2006

        The EntitySpaces 1.5.2 Bets is now available for download. Below are the enhancements and fixes added to this release:

        • Full support for VistaDb 3.0
        • Compact Framework Providers for both Microsoft SQL Server and VistaDb
        • Full compliance with the DotNetNuke {objectQualifier} when using dynamic sql or stored procedures.
        • EntitySpaces can now be run without a config file. This is intended to help facilitate modular software development, and removes the situation where your end users are required to enter config entries. Below is an example of how to set your default connection programmatically


        // Manually register a connection
        esConnectionElement conn = new esConnectionElement();
        conn.ConnectionString = "User ID=sa;Password=;Initial Catalog=Northwind;Data Source=localhost";
        conn.Name = "GroovySQL";
        conn.Provider = "EntitySpaces.SqlClientProvider";
        conn.ProviderClass = "DataProvider";
        conn.SqlAccessType = esSqlAccessType.DynamicSQL;
        conn.ProviderMetadataKey = "esDefault";conn.DatabaseVersion = "2005";

        // Assign the Default Connection
        esConfigSettings.ConnectionInfo.Connections.Add(conn);
        esConfigSettings.ConnectionInfo.Default = "GroovySQL";

        // Use the code as usual
        Employees e = new Employees();
        if (e.LoadByPrimaryKey(1))
        {
            e.Save();
        }

        int? i = e.EmployeeID;

        • Added [XmlIgnore] to hierarchical objects to prevent endless loops with self referencing relationships. This will be further refined again in our 1.6.0 release.
        • Added Lock/SyncLock in two places to protect static data

        This is a full beta and all providers are included.

        1. This beta requires the new MyGeneration beta available on the MyGeneration homepage.
        2. The EntitySpaces beta can be found in the trial forum HERE
        posted on Sunday, November 19, 2006 9:20:55 AM (Eastern Standard Time, UTC-05:00)  #    Comments [3]
         Thursday, November 09, 2006

        So, you must be thinking "What's this EntitySpaces 1.5.2 release? we thought 1.6.0 was next?". The truth is we weren't originally planning to do a 1.5.2 release but it became apparent that this release needs to happen for several reasons. One of the main driving factors for this release is VistaDB 3.0, we plan to fully support VistaDB 3.0 before its official release. It is our hope that upon the next release of the VistaDB CTP there will be no issues preventing us from releasing the EntitySpaces DataProvider for VistaDB, indeed all of the coding is done for it already. We know the VistaDB team is working hard on their next CTP. 

        Also, VistaDB runs under the Compact Framework and tonight we successfully compiled EntitySpaces under the Compact Framework as well. This means any device VistaDB runs on EntitySpaces will also. EntitySpaces should also now run under Mono but we have not tested that yet. About the only real problem encountered in getting EntitySpaces to compile under the Compact Framework was our custom configuration section logic and binary serialization. We will still maintain only one codebase and use #IFDEF's in our code to compile for the Compact Framework and without. We are focusing now upon getting EntitySpaces working clean on the Compact Framework. Part of this involves allowing EntitySpaces to run in configless mode which we will offer for both the Compact Framework and our main build. This will help those who might be developing for hosting environments and who need to have a hundred or so connections.

        Also, futher support for DotNetNuke including the DNN Object Qualifier and the ability to pull the the connection string directly from the DNN config file are in the works. Of course, there will be a few fixes to address some issues that have been reported as well.

        It is our thinking that the 1.5.2 release will be ship near the end of November or early December. Our 1.6.0 release is still all about ASP.NET DataBinding on steroids including hierarchical databinding. The EntitySpaces 1.6.0 roadmap should be published by the end of November and our thinking is that the 1.6.0 release will ship in early 2007. 

        - The EntitySpaces Team

         

        posted on Thursday, November 09, 2006 9:35:30 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Sunday, November 05, 2006

        This is the question that was posed on the DNN forums yesterday.

        Is it just me or are data providers done wrong?

        Hey all - I'm trying to understand the basic architecture of DNN and am wondering if I am off base with how I understand the data provider model to work.  From what I can tell EACH module has a specific data provider implementation in addition to the abstract dataprovider class.  Unless I'm missing something this seems really messed up - For instance I would LOVE it if DNN ran on MySql but it doesn't - so if someone wants to run a DNN site on MySQL, they would have to add MySql data providers in all modules?   If this is the case, this just seems horribly wrong - it would be MUCH better if we had the data providers centralized and then all modules would point to a generic common abstract class - so one could add/change data providers on the entire system without having to modify or add code to existing modules.  The way it stands right now, it seems like it'll take a hell of a lot of effort to get another provider simply because one would have to touch all the core modules.  Am I missing something?

        Bob


        Yes Bob, you're missing EntitySpaces. Well, I (Mike speaking here) wrote up a very nice and informative post letting Bob know that what he was describing was in fact EntitySpaces. It was a pretty involved post expanding on what Scott said and correcting a misconception on a subsequent post by another poster . Bob is obviously a very bright guy and asked the very question that all DNN developers should be asking. I went on to explain how our massive NUnit test suite executes against Microsoft SQL, Oracle, MySql, Microsoft Access and now VistaDB (not yet released but working). We use the same exact binary in this test suite against all of our supported databases. Imagine one code base with your modules running on all database systems. I also stated that it's too bad DNN itself doesn't run on EntitySpaces because its reach would be far wider and "would be DNN module developers" would have a very simple programming model instead of the rather clunky DNN DAL. Also, they would have at their fingertips Transactions, LINQ Support, serialization and far more customers to reach out too to make their ventures more profitable.

        The above isn't my exact statement, I didn't call the DNN DAL clunky in the post and it was at least 4 times as long as the text above explaining that EntitySpaces was exactly what Bob was in fact wanting in an architecture. My post was rejected with no explanation and without even a notification, this is their right of course. But that doesn't mean I have to let this go unnoticed. We are DNN fans and we won't be silenced. It makes me wonder if any of the younger new .NET portals are paying attention here.

        [UPDATE - Nov 6, 11:00 EST]
        Well, a day and half after my original post and after this blog post had gotten around the horn my original post on that thread somehow appeared, and for that I say thankyou to the DNN folks. Nonetheless, this post remains. However, We extend an open invitation to the DNN core team members and founder to speak with us about blowing the doors wide open for the DotNetNuke community, we believe it is within our power to help DotNetNuke do just that.

        posted on Sunday, November 05, 2006 9:45:40 PM (Eastern Standard Time, UTC-05:00)  #    Comments [6]
         Friday, November 03, 2006
        EntitySpaces has been reviewed by Mike Gunderloy, the editor of Larkware. You can see the review HERE or scroll down and see the review on the Larkware homepage.
        posted on Friday, November 03, 2006 11:37:54 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Tuesday, October 24, 2006
        This release is a minor upgrade to our 1.5.0 release and is based on user feedback.

        The following issues are addressed in the 1.5.1 release:

        • Fixed hierarchical presave/postsave key handling for Oracle Sequences and for Guid primary keys.
        • IBindingList.AddNew() calls esEntity.AddNew().
        • IBindingList.AddNew adds foreign key columns to ModifiedColumns
        • IBindingList.AddNew no longer throws an exception when adding to an empty DataGridView.
        • Accessing a Child Collection no longer causes Save() to throw exception for a new entity.
        • Databases with ternary and higher n-ary relationships will generate the necessary zero to many and many to one for each foreign key.
        • Added an option to esPlugin to append associative table name to ManyToMany relationships.

        http://www.entityspaces.net

        posted on Tuesday, October 24, 2006 9:18:01 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Wednesday, October 04, 2006

        FOR IMMEDIATE RELEASE

        Contact:sales@entityspaces.net

        EntitySpaces 1.5 has been released with support for Hierarchical Data Models and LINQ.

        The EntitySpaces architecture for .NET is a persistence layer and business object system for the Microsoft .NET 2.0 Framework.  EntitySpaces is database independent. The data providers are loosely coupled and allow you to use the same compiled code to access Microsoft SQL Server, Microsoft Access, Oracle, and MySQL, with VistaDB in the pipeline. EntitySpaces' business objects are generated from your database's metadata using MyGeneration, the highly downloaded, free code generator and OR Mapping tool.

        EntitySpaces has in its ancestry the popular dOOdads architecture, and the same lead architect. Features include serialization, dynamic queries, saving via stored procedures or dynamic SQL, transactions, and more. The templates included will generate business classes, ASP.NET Admin Grids, and DotNetNuke Admin Grids. Source code is available. EntitySpaces targets both ASP.NET and Windows.Forms projects. DotNetNuke module developers will find it to be an attractive alternative to the DotNetNuke DAL.

        EntitySpaces, LLC founding members include Mike Griffin, President and originating architect, Scott Schecter, and David Parsons. The team has a diverse background in technology solutions spanning more than 20 years. EntitySpaces is dedicated to providing affordable, easy-to-use, feature-rich developer tools with stellar support. Details, documentation, and a free, 45-day Trial Version may be found at:

        http://www.entityspaces.net

        # # #

        posted on Wednesday, October 04, 2006 12:56:07 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Saturday, September 09, 2006

        VistaDB 3.0 is the world's first fully managed and typesafe SQL database engine designed for the Microsoft .NET Framework, the Compact Framework, Mono, and Windows Vista. VistaDB enables .NET developers to build small yet robust fully managed WinForms and ASP.NET database applications that run on desktops, mobile devices and web servers.

        Key features include Microsoft SQL Server T-SQL syntax compatibility, a small 600KB single-file fully managed assembly with built-in ADO.NET Data Provider, full Unicode support, robust and secure data store with support for rich data types, large data capacity, high-speed data processing, easy Copy 'n Go!™ deployment, royalty free distribution and much more.


        As we finish up our EntitiySpaces 1.5.0 release we thought we would tell you about something coming up that we are very excited about. The EntitySpaces 1.6.0 release will be adding support for VistaDB 3.0. Soon, VistaDB customers will be able to, in a matter of minutes, generate a fully functional EntitySpaces object model on top of thier VistaDB database. This model will be fully hierarchical, support LINQ, Serialization, Transactions, WebServices, and provide them with a very powerful dynamic query syntax.  If you're a VistaDB fan keep your eye out for a very powerful EntitySpaces + VistaDB combination.

        posted on Saturday, September 09, 2006 6:21:45 PM (Eastern Standard Time, UTC-05:00)  #    Comments [1]
         Thursday, August 31, 2006

        Welcome to the EntitySpaces 1.5.0 Beta
        EntitySpaces Goes Hierarchical ....

        The beta is actually pretty solid. However, it is versioned 1.4.3 and available to customers only until the official 1.5.0 is released.

        These are our recommendations. Be sure to close MyGeneration and any of your Visual Studio solutions before installing.

        • We recommend you install right over the top of your current 1.4.2 release. You can always reinstall the 1.4.2 release if you need to.
        • Regenerate your Generated Templates using the "Generated Classes Master" template.
        • Next run the "EntitySpaces - Hierarchical" template, this will be located in the EntitySpaces->C#/VB->Generated namespace in the MyGeneration Template Browser. Select all of the tables in your database and generate.  This will create a new file called "EmployeeHierarchical.cs" or "EmployeeHierarchical.vb" for a table named Employee. Include these files in your solution, they should be generated into your generated folder with the rest of your classes.
        • Recompile and run ...

        There is a new template you can experiment with in the EntitySpaces->esPlugIn namespace named EntitySpaces - Set esPlugin Settings.  You can use this template to override the default setting for EntitySpaces. You will find this very useful to experiment with the naming conventions for the Hierarchical objects, see what you can come up with. Be sure to post any very good settings, we might adopt them as our shipping defaults.

        The Basic Tab


        The Hierarchical Tab



        You can change these settings and regenerate classes and see the effect, just hit OK to save your changes.

        In the next BETA release you will not have to run the EntitySpaces - Hierarchical template separately, it will be included in the master and there will be a checkbox to indicate whether or not you want to generated hierarchical code or not.

        Release Notes

        • Hierarchical support (C# and VB)
        • Both VB.NET and C# now support the new LINQ query syntax
        • Added CommandTimeout to the EntitySpaces config settings
          <add name="SQLDynamicTest" 
            providerMetadataKey="esDefault" 
            sqlAccessType="DynamicSQL" 
            provider="EntitySpaces.SqlClientProvider" 
            providerClass="DataProvider" 
            connectionString="Password=yadda" 
            commandTimeout="90" 
            databaseVersion="2005" />
        • Implemented dOOdads QuerySource trick 
          // Read from a view, save to the core table
          EmployeeCollection empColl = new EmployeeCollection();
          empColl.Query.es.QuerySource = "vEmployee";  // This is a view
          empColl.Query.Load();
          
          Employee emp = empColl[0] as Employee;
          emp.LastName = "ViewsRock";
          empColl.Save();
        • New template for esPlugin settings including hierarchical settings (shown earlier)
        • Added DetatchEntity/AttachEntity to esEntityCollection
        • Add MarkAllColumnsAsDirty to help move records from one database to another
        • Fixed template bug that generated an invalid comment when it contained a double-quote (")
        • The esEntity.Collection property is now public
        • Increased the performance of our Save() logic
        • esEntityCollection.IsDirty was incorrectly reporting true after Save, fixed
        • Added public class to each provider to fix Visual Studio designer bug

        Not in this BETA Version

        • Caching
        • AddNew fix, esEntityCollection.AddNew should call esEntity.AddNew
        • Many other enhancements will make it in before the final release.

        We need your input and mileage on this. Normally, our internal testing which is pretty extensive is enough for us to cut a new build, however, this is a major set of new functionality.

        - The EntitySpaces Team

         


        posted on Thursday, August 31, 2006 8:23:08 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Tuesday, August 15, 2006

        In anticipation of the hierarchical support to be released in EntitySpaces 1.5, we wanted to explain the relational object naming algorithm that we are using, what options will be available to you in the 1.5 release, and what we are planning for the future. We also would like your feedback on whether or not this implementation meets all your needs.

        Your first question is probably, "What the heck is a relational object name, and why does it need an algorithm?" Take this code which will be possible using Northwind for example:

        Employees emp = new Employees();
        emp.LoadByPrimaryKey(1);

        TerritoriesCollection terrColl = emp.Territories;

        The first two lines are pretty routine. That last line does an awful lot for one line of code. That line traverses from an individual entity (Employees) through a many-to-many associative table (EmployeeTerritories - completely transparent) and retrieves a collection (TerritoriesCollection) of just the Territories related to that Employee. In EntitySpaces 1.4 there is no Territories object in the Employees entity class. The templates for EntitySpaces 1.5 will automatically generate a new object in the Employees class called Territories. "Territories" is the relational object name.

        Your second question may be, "That seems pretty straight-forward. What's the big deal?" If you're a DBA or veteran coder that is familiar with complex databases, then you are already anticipating the problems that will arise if you need to generate unique names for all the relationships in a database. On the other end of the spectrum, you may be a programmer that understands parent and child relationships. You do not want to get a doctorate in hierarchical modeling. You just want relationships to work in your application. Out-of-the box, EntitySpaces 1.5, using the default settings, will generate hierarchical code that will work for 99.9% of real-world apps. It will be easy to use. And, it will offer some customization options to cover that additional 0.1% of the cases. This post is designed to give some insight into what the relational object names will be, how they will be generated, and why we chose that algorithm.

        A Schema for Hierarchical Testing

        Consider the tables and relationships in the schema diagram below. Most of you will recognize the similarity with Northwind. But, from a foreign key point of view, there are some significant differences. The schema is from the test database we are using for our hierarchical unit tests. It is specifically designed to stress test a full range of relationships and combinations of relationships. Here are some notable differences:

        1. Customer has a composite primary key, but it is not part of a many-to-many. We have better design choices today, but this situation is not uncommon in legacy databases.
        2. CustomerGroup links to Customer, but only uses part of Customer's composite primary key.
        3. Order links to Customer through a composite foreign key; CustID and CustSub.
        4. CustomerGroup and Group have a one-to-one relationship. This is unusual for a well normalized schema, but it is sometimes necessary. We have seen it in cases where a table ran up against a limitation in the database for the number of columns in a table. The columns had to be split into two tables with a one-to-one relationship.
        5. The self-referencing foreign key has been retained in the Employee table, but was renamed Supervisor instead of ReportsTo.
        6. There are two many-to-one foreign keys pointing from Customer to Employee; Manager and StaffAssigned. This is very common and tests possible naming ambiguity. If Customer had a relational object named Employee, you would not know which relationship it referred to.
        7. In the link between Order and Employee, the foreign column name is the same as the primary column name. This is quite common, and tests a possible point of naming collision.
        8. From a practical stand-point, there are two types of many-to-many relationships.
          • Simple cross-reference: This is illustrated by Employee - EmployeeTerritory - Territory. EmployeeTerritory has no user entered fields. The fields are all in the primary key. In this case, Employee will have a relational object named Territory and Territory will have a relational object called Employee. The EmployeeTerritory table is transparent in the EntitySpaces' hierarchical model. There are relational objects for EmployeeTerritory, but they are mainly there in case your schema changed (you added a non-key field to EmployeeTerritory) and it became a complex cross-reference.
          • Complex cross-reference: Order - OrderItem - Product is technically a many-to-many, but it has additional fields aside from the primary keys (e.g.; Quantity). EntitySpaces treats it as if it were two separate sets of relationships; Order - OrderItem and Product - OrderItem. The relational objects for both of these will be your primary working objects. We will show later how easy it is to access all the Product fields for each OrderItem of an Order. There is a relational object in Order named Product. But, again, it is primarily there to prevent break breaking changes during a regeneration of a changed schema.

         

        Generated Relational Object Names

        The table below contains the default names generated for each table above, the relationship it covers, and the return type. "Many To One" and "One To One" always return entities. "Zero To Many" and "Many To Many" always return collections. For the technically minded, there are dozens of combinations of cardinality, optionality, and direction which do not seem to be represented in the Relationship column. In reality, behind the scenes, EntitySpaces sub-groups everything into one of the four relevant categories it needs. And, to effectively use EntitySpaces you do not even need to be worried about those. They are pertinent to this discussion, but as a programmer, we will show later, how knowing the object you are in and the object you want to relate to, are the only two pieces of information you need to discover the power of hierarchical objects.

        Table Relational Object Names Relationship Return Type
        Employee CustomerAsStaffAssigned Zero To Many CustomerCollection
          CustomerAsManager Zero To Many CustomerCollection
          EmployeeAsSupervisorChildren Zero To Many EmployeeCollection
          EmployeeAsSupervisorParent Many To One Employee
          Territory Many To Many TerritoryCollection
          EmployeeTerritoryAsEmpID Zero To Many EmployeeTerritoryCollection
          OrderAsEmployeeID Zero To Many OrderCollection
        Customer OrderAsCustID Zero To Many OrderCollection
          CustomerGroupAsCustomerID Many To One CustomerGroup
          EmployeeAsStaffAssigned Many To One Employee
          EmployeeAsManager Many To One Employee
        Order OrderItemAsOrderID Zero To Many OrderItemCollection
          Product Many To Many ProductCollection
          CustomerAsCustID Many To One Customer
          EmployeeAsEmployeeID Many To One Employee
        OrderItem OrderAsOrderID Many To One Order
          ProductAsProductID Many To One Product
        Product OrderItemAsProductID Zero To Many OrderItemCollection
          Order Many To Many OrderCollection
        Territory Employee Many To Many EmployeeCollection
          EmployeeTerritoryAsTerrID Zero To Many EmployeeTerritoryCollection
        EmployeeTerritory EmployeeAsEmpID Many To One Employee
          TerritoryAsTerrID Many To One Territory
        CustomerGroup CustomerAsCustomerID Zero To Many CustomerCollection
          Group One To One Group
        Group CustomerGroup One To One CustomerGroup

         

        Usage Example:

        We have a collection of Orders (Lines 1 and 2 in the code below). We grab one (3). We need to change the CustomerName for the related Customer (5). We need to set the OrderDate (6). (Notice that we use the EntitySpaces' StringProperty (str) to convert the string to a date for us.) We want to set the UnitPrice for all the OrderItems related to this Order (7 - 13). The price we want to use is the base UnitPrice set in the Product file for the Product related to the OrderItem plus 10% (9, 10). We want to save all changes (14). This blog is about names, but that last line certainly deserves some special attention. "ord" is part of a collection ("ordColl") so we need to call save on the collection, not the entity. That one line saves the changed Customer, the changed Order, and all the changed OrderItems, and it is wrapped neatly in a transaction. Your changes commit or fail as a unit.

        1    OrderCollection ordColl = new OrderCollection();
        2    ordColl.LoadAll();
        3    Order ord = ordColl.FindByPrimaryKey(11);
        4   
        5    ord.CustomerAsCustID.CustomerName = "Test";
        6    ord.str.OrderDate = "1999-12-31";
        7    foreach (OrderItem item in ord.OrderItemAsOrderID)
        8    {
        9        item.UnitPrice = item.ProductAsProductID.UnitPrice.Value
        10          * (decimal)(1.1);
        11       Console.WriteLine(item.ProductAsProductID.ProductName
        12          + " - " + item.UnitPrice.Value.ToString());
        13   }
        14   ordColl.Save();

        A detailed examination of what is going on is the subject of another blog post. What we are interested in is more practical. As we are entering code, how do we know the relational object names that apply? I do not want to memorize hundreds of relations in dozens of tables. I do not care if it is one-to-many or a many-to-one, I need to get the Customer related to an Order. And, I need to know whether I am dealing with an entity or a collection. How does EntitySpaces 1.5 make my life easier? The answer resides in Intellisense. If the objects are intelligently named, they will be easy to find. Once found, Intellisense shows you what it is, and it will be easy to use. That brings us to our next subject...

        Why Those Names?

        Our goals for the generated relational object names were much the same as the goals stated in most naming guidelines. Sometimes seeking one goal will be in conflict with another, and compromises have to be taken. The one rule that cannot be compromised is that the names must be unique within the namespace and class. If the code will not compile, there is not much sense in continuing. Beyond that, here is what we aimed to achieve:

        • Readability - The names cannot be so big and cumbersome that the code becomes un-readable.
        • Understandability - You should be able to see the name and understand its function in relation to the class that contains it.
        • Usability - Without intimate knowledge of the database structure, you should be able to find what you want in Intellisense and use it properly.
        • Portability - This usually refers to portability between languages, case-insensitive languages in particular. But, we already give you the option of using the VB templates. Because we are generating names, by portability we mean the algorithm, too, has to be portable to a wide variety of database schema and still create unique names.

        Here are the default algorithms, starting with the simplest:

        • ForeignTableName - This is the simplest and clearest. In the very first piece of sample code at the start of the blog, you loaded an Employee. You know you need the territories for it, so next, in your IDE, you type "emp.ter". Intellisense pops up and you see "Territory". That looks good. Intellisense also shows that it is a TerritoryCollection. Now you know that you can foreach through it or bind it to a DataGridView. This algorithm only works for one-to-one and many-to-many. But, you do not need to worry about that.
        • ForeignTableName + "As" + ForeignColumnName - At line 5 of the code sample above, you want to change the related Customer's CustomerName. You type "ord.cus". Intellisense has popped up. You see "CustomerAsCustID". That must be it, but why not just "Customer"? That is because the algorithm used for one-to-many and many-to one has to account for multiple links between the same tables. Say, down the road, your database schema changed and an Order had a BillToCustomer and a ShipToCustomer. The column name is used as a tie breaker. This is seen in the ForeignKeyTest diagram with the two columns in Customer that are related to Employee. Intellisense shows you that both EmployeeAsStaffAssigned and EmployeeAsManager have return types of "Customer". This is another clue and also lets you know that they are entities. They can be treated like any other entity. The appended column names "StaffAssigned" and "Manager" let you choose the right object for your task.
          Let's look at the foreach in line 7. This falls under the same algorithm. You want to change each of the OrderItems related to the Order. You type "ord.ord" and see OrderItemsAsOrderID and that it returns an OrderItemCollection. Now you can loop through it like any other collection, but it will only touch those OrderItems that are related to "ord".
        • ForeignTableName + "As" + ForeignColumnName + "Parent"
        • ForeignTableName + "As" + ForeignColumnName + "Children" - These two work in tandem. They are necessary because of self-referencing foreign keys. The Supervisor column in Employee is both a one-to-many and a many-to-one on the same table. An additional tie breaker is needed. You type "emp.emp". Intellisense shows both EmployeeAsSupervisorChildren and EmployeeAsSupervisorParent. You need to make a decision. Fortunately, you have another piece of information in Intellisense. EmployeeAsSupervisorChildren is an EmployeeCollection, while EmployeeAsSupervisorParent is an Employee (a single entity). EmployeeAsSupervisorChildren is the collection of employees that this employee supervises. EmployeeAsSupervisorParent is the Employee (single entity) that supervises this employee. Your choice should be clear based on your intended use.

        Notice that the ForeignTableName is always there and always first. That is the key to finding it in Intellisense. You end up with either a collection or entity of just the related rows. You use them like any other EntitySpaces BusinessObject. They are lazy-loaded. (Retrieving all Orders does not automatically load all related OrderItems, Customers, etc.) Plus, you get the benefits of transactional saves. In the schema above, you can traverse all the way down from an Employee through Customer, Order, OrderItem, and Product. Or, you can head up the other way from Product. This is all most developers will need most of the time. But, what about those rare instances when a generated name collides with a Property that already exists in the class? That brings us to the next subject...

        Customizing the Generated Names

        In most cases, the defaults will suffice. But, what if the compiler says you have duplicate names? Or, what if your organization has Domain Specific Language policies? When you run the EntitySpaces' hierarchical template, you are presented with a few new fields that give you some flexibility on the generated names.

        The above image is from the EntitySpaces template UI for 1.5 which is currently in testing. It may change depending on your feedback from this post, but it shows the current defaults. "Table" and "Column" are derived from esPlugin "Entity" and "PropertyName", respectively. By default, this just trims illegal characters and PascalCases the foreign table and column names. The easiest way to get rid of compiler errors is to add a prefix. "Referenced" for One and "Referring" for Many will let you eliminate both suffixes. The disadvantage is that typing "emp.ord" is not going to find the Order object on an Employee entity. You will need to know to type "emp.ref". On the other hand, all referential objects will be lumped together in Intellisense. You may find it easier to deal with them that way.

        A really easy way to get all hierarchical objects in one area is to add a simple prefix like "fk" or "hier". FxCop will hate this, since Hungarian notation is definitely out. But, if you feel it abides by the four naming goals listed earlier, and makes you more productive, then we say go for it. On a side note, if your table and column names conform to Microsoft's guidelines, the default names will pass FxCop's naming rules. But, remember, if you have a column named "CustomerID', then FxCop will complain and suggest "CustomerId". If the column is "CustId", then FxCop will grouse about "Cust" not being in its dictionary and suggests not using abbreviations. You could go through your database and change the offending column and table names. Or, you could decide that FxCop is just quibbling and it is safe to ignore those apparent violations. 

        By default, the suffix is only appended to self-referencing foreign keys. This keeps the other names shorter. If you feel that a suffix would give the extra information you need to distinguish collections from entities, then removing the check will put the suffix on all generated names. It could, also, be used as another way to eliminate duplicate names for the compiler.

        This is a good point to talk about our future plans for hierarchical naming. Imagine a template UI that displayed all the relationships and the default object names. It let you Alias any or all the names with something of your own choosing and remembered your choices. That is the goal for a future release. If you have played with the ASP.NET Admin Grid template, or checked out the PDF instructions for it, you know how convenient being able to see the columns and the related fields can be. The UI code needs to be ported over from that template, and we would ideally prefer an approach that did not require setting up one table at a time. But, once 1.5 is out, and we have coded, tested, and released the requested features promised for 1.6, we intend to devote some time to this.

        We want your feedback.

        Between us, we have thousands of man-hours of practical experience with database coding going back over 20 years. But, we still learn something new almost daily. We are hoping our customers and other forum members will share their experience and help shape EntitySpaces. We know that the relational object names we are using are a bit on the ugly side. But, that is the compromise we chose to reach the goals set out earlier. If anyone has suggestions for improving these, we will gladly consider them. You can post your comments here or in the forums. We eagerly await your response...

        - The EntitySpaces Team

        posted on Tuesday, August 15, 2006 10:37:59 PM (Eastern Standard Time, UTC-05:00)  #    Comments [3]
         Friday, August 04, 2006

        We have released the first beta version of our EntitySpaces DotNetNuke ASCX Admin Grid Template Suite. Check out the demo here.

        Here is an overview of the features:

        • All of the databases supported by EntitySpaces should work with these templates
        • The ASCX controls generated build upon your already created EntitySpaces Classes
        • Both C# and VB.NET ASCX controls can be generated*
        • The look and feel of the ASCX controls are managed by a very simple style sheet
        • The generated ASCX controls use the new ASP.NET MultiView/View controls
        • Browse, Detail, Edit, and Search modes can be generated automatically
        • You control what columns to display and in what order
        • All column headers are clickable and sort the GridView(s)
        • Required fields use the ASP.NET RequiredFieldValidator control
        • Foreign Keys are mapped to Url's in detail mode and combo-boxes in edit mode
        • Relationships can be mapped to subgrids in detail mode

        *During the beta period there will only be a C# version. After user testing, if no issues arrise we will create the VB version. Both Versions will be available to all customers.

        Files

        The template is installed into the EntitySpaces\C#\Web and EntitySpaces\VB\Web folders respectively in MyGeneration. GridLoader.zip the DotNetNuke module that loads the generated ASCX controls is installed in Program Files\EntitySpaces\DotNetNuke\C# and Program Files\EntitySpaces\DotNetNuke\VB respectively.

        Usage

        1. Add the needed EntitySpaces assemblies, and web.config entries to your DotNetNuke portal. For detailed instructions on how to do this see here.
        2. Install the GridLoader.zip DotNetNuke module like you would any other. Because we are using the new dynamic compilation model of ASP.NET 2.0 you must also add the directoryName key to the codeSubDirectorySection of your web.config as seen below(this is only necessary if you are using the C# version). You will see a commented out example in the appropriate location of your web.config if you have never done this before.

          <codeSubDirectories>
               <add DirectoryName="GridLoader" />
          </codeSubDirectories>

        3. Generate your EntitySpaces classes for your tables/views just like normal and upload them to /App_Code/GridLoader/Custom and /App_Code/GridLoader/Generated
        4. Generate your ASCX controls and upload them to /DesktopModules/GridLoader/
        5. Think about how easy EntitySpaces makes your life and have a beer.

        You will find a new installer for this template suite on the downloads page under the products menu entry. This template suite will not be lincluded in the trial version of EntitySpaces. These templates are intended to provide the ability to administer databases over the web from within your DotNetNuke portal. This chore is typically overlooked although it is really very needed. Such admin screens can eat up quite a bit of development time and they are much easier to generate, and change when your database schema does. The demo module on our site is 100% generated no hand coding was done.

        These templates are not currently supported on the same level as the templates that generate the EntitySpaces classes. Work on the new features in the upcoming 1.5 release will take priority. That being said we will of course address an issues that might arise as time allows.

        See the PDF file that describes the usage of ASPX version of the template. All functionality and operations are exactly the same for the DotNetNuke ASCX version, with the exception of the "Use Master Pages"option.

        posted on Friday, August 04, 2006 12:43:23 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Thursday, August 03, 2006

        Vasilis of Think of Design and Scott rolled out the new EntitySpaces site design, and branding over the weekend, and we must say that we are very pleased with the results. The Think of Design team carefully listened to the design features we wanted and made useful suggestions to help us achieve the best online experience possible for our users. We would also add their prices are very reasonable, if you are looking for a one of DNN design we can without a doubt recommend their services. However the thing that impressed us the most was the after delivery service of Vasilis. After delivering the skin, logo, source files, etc he wanted to be involved with the application of the new design to the site, and made adjustments to get it just right for us. Let us know what you think of the new design, and a very special thank you to the Think of Design Team from all of us at EntitySpaces, you all rock;)

        posted on Thursday, August 03, 2006 9:11:12 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Tuesday, August 01, 2006

        EntitySpaces 1.4.2

        We have accumulated enough fixed and tested issues that we thought it was important to put out a maintenance release. The new downloads should be posted on Friday, August 4, 2006. We will announce their availability in the forums, once they are up. The following issues are addressed in this version:

        • Change Guid with default newid() to accept input for Saves for Microsoft SQL Server.
        • Add XML comment to LoadByPrimaryKey that warns if the template is run on a table with no primary key.
        • Trim invalid characters from aliases in esPlugin.
        • Add preliminary LINQ support.
        • AddNew rolls back for MySQL provider without error with InnoDb tables.
        • Error in MySQL stored procedure template comment if all fields are in the primary key.
        • IndexOutOfRangeException if the primary key(s) is(are) not the first column(s) in a table.
        • ASPX page template ignores Namespace.
        • Adding fks broke WebServices' serialization.
        • Do not over-write files when generating Custom Master classes.
        • Add using System.ComponentModel when not generating a single file.
        • Multi-line default values not generated correctly.
        • Remove Query.Load("OR") from compiled help and document Query.es.DefaultConjunction instead.
          The default conjunction for Query.Load() is "AND". You can change that with this:
          emps.Query.es.DefaultConjunction = esConjunction.Or;
          
        • Add QueryReset to Entities and EntityCollections.
          TestCollection collection = new TestCollection();
          
          // Get the LastName for active employees
          collection.Query.Select(collection.Query.LastName);
          collection.Query.Where(collection.Query.IsActive == true);
          collection.Query.Load();
          Assert.AreEqual(16, collection.Count);
          
          // These get added to the above.
          // Now we get LastName, FirstName
          // For active employees named "Costner"
          collection.Query.Select(collection.Query.FirstName);
          collection.Query.Where(collection.Query.LastName == "Costner");
          collection.Query.Load();
          Assert.AreEqual(3, collection.Count);
          
          // Reset the query and return all columns and all rows
          collection.QueryReset();
          collection.Query.Load();
          Assert.AreEqual(30, collection.Count);
          
        • Add Scale and Precision to esParameter for output parameters.
          public partial class AggregateTestCollection : esAggregateTestCollection
          {
              public void TestParamsWithScale()
              {
                  esParameter myParam = new esParameter("Salary", 12.34);
                  myParam.DbType = DbType.Decimal;
                  myParam.Precision = 18;
                  myParam.Scale = 2;
                  myParam.Direction = esParameterDirection.Output;
          
                  esParameters parms = new esParameters();
                  parms.Add(myParam);
                  parms.Add("FirstName", "Entity");
                  parms.Add("LastName", "Spaces");
                  this.ExecuteNonExec(esQueryType.StoredProcedure, "proc_esTestInsert", parms);
              }
          }
          

        EntitySpaces 1.5

        We have rescheduled the 1.5 release for the end of August. We understand that this delay is making it difficult, if not impossible, to fully evaluate the product. Installing the 1.4.2 maintenance release will assure that your Trial period does not run out before 1.5 is released. We are especially concerned for our existing customers who are counting on hierarchical support. But, we feel that meeting quality standards takes precedence over meeting deadlines. We will not release something with known bugs and "fix it as we go." When it is ready, 1.5 will be released only to our current customers as a Beta version. A Final version will be released for download by our customers, and as a Trial version to the general public, after we have received sufficient feedback, can be comfortable that it has been tested in a wide variety of environments, and have fixed any hidden issues. We appreciate your patience and believe it will be well rewarded, as the hierarchical API is shaping up very nicely.

        • Hierarchical support
        • Caching

        Future Enhancements

        We have not forgotten the other features requested. In fact, we are using a new issue tracking system that helps us keep tabs on over sixty items, from ObjectDataSource support to updateable Views. Rather than try to predict when these will be ready, our focus is on putting out a top-notch hierarchical release. As we get closer to delivering it, we will prioritize what we have and post a roadmap for 1.6 and beyond. The new system has already reduced the amount of administrative time we spend on tracking bugs and enhancements. That means more time is available to actually code on them :-)

        The EntitySpaces Team

        posted on Tuesday, August 01, 2006 1:21:27 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Sunday, June 18, 2006

        [Upated September 30, 2006]

        At first glance one might think that the new LINQ technology is a direct competitor to the EntitySpaces architecture; however that would not be a correct assumption. The LINQ Project is a codename for a set of extensions to the .NET Framework that encompass language-integrated query, set, and transform operations. It extends C# and Visual Basic with native language syntax for queries and provides class libraries to take advantage of these capabilities. EntitySpaces LLC has added the ability to use the LINQ syntax against EntitySpaces collections as of our 1.5 release.

        As LINQ nears its official release we will look at translating the LINQ IQueryable<T> expression trees into our query API. In fact, when LINQ is first released it will support SQL Server only and rumor has it that LINQ is still a year or more out though Microsoft hasn't stated a release date yet. 

        Have a look at this example: 

        EmployeesCollection coll = new EmployeesCollection ();
        coll.LoadAll();
        // All employees with "i" in the last name ordered by FirstName in decending order
        var emps = from e in coll
        where e.LastName.Contains("i") orderby e.FirstName descending select e; foreach(Employees emp in emps) { Console.WriteLine(emp .FirstName + ", " + emp.LastName); }

        It is even possible to derive your own result sets via the LINQ query against an EntitySpaces collection.


        EmployeesCollection coll = new EmployeesCollection();
        coll.LoadAll();

        // All employees with "i" in the last name ordered by FirstName in decending order
        var emps = from e in coll
                        where e.LastName.Contains("i") 

                        orderby
        e.FirstName descending
                        select
        new { e.FirstName, e.LastName };

        foreach(var dude in emps)
        {
            Console.WriteLine(dude.FirstName + ", " + dude.LastName);
        }

        Some links you'll find useful:
        Using LINQ with ASP.NET   (Part 1)
        Using DLINQ with ASP.NET (Part 2)

        posted on Sunday, June 18, 2006 12:47:42 AM (Eastern Standard Time, UTC-05:00)  #    Comments [2]
         Thursday, June 15, 2006

        We have had some issues come up that we thought should not wait until 1.5 is released. This maintenance release should hold you over until then. The DataGridView binding issues were the toughest nut to crack. And, unfortunately, those changes will require you to regenerate the Generated Master for your classes.

        NOTE: You must regenerate your generated classes with the Master Template

        EntitySpaces - Release Notes for 1.4.1 

        • Added “Use Schema” checkbox to SQL Server Stored Procedures template. Default is un-checked (dbo).
        • Changed MySQL Stored Procedure template delimiters from $$ to //.
        • Changed the esEntityCollection.Item Property so that it is no longer obsolete.
        • Fixed SqlClientProvider so that AnsiString output parameters now have the correct size property for computed columns.
        • Fixed bug in QueryBuilder for all 4 providers. If a Like() expression was used in the Where() clause before an Equal(bool) expression, then the parameter type for the boolean was set to a string.
        • Added two protected Methods to esEntityCollection:
          • AssignPrimaryKeys - Assigns the underlying DataTable's 'PrimaryKey' data member using the primary keys as defined in the collection's associated esColumnMetadataCollection.
          • RemovePrimaryKeys - Removes the DataTable's 'PrimaryKey' information by setting it to null. Call this to undo AssignPrimaryKeys().
        • Added three Properties to esEntityCollection:
          • AllowEdit - Default is true. Setting this to false prevents the user from editing a row in a DataGridView.
          • AllowNew - Default is true. Setting this to false prevents the user from adding new rows in a DataGridView.
          • AllowDelete - Default is true. Setting this to false prevents the user from deleting rows in a DataGridView.
        • Fixed esEntityCollection IBindinglList AddNew, ApplySort, and esEntity BeginEdit, CancelEdit, EndEdit, AddNew. This fixes the editing or clicking around in a DataGridView bug.
        • Fixed an issue where Extended Properties were not being included in the collection if MultiProviderMode was set to true.
        • Fixed DeleteAll() so that it honors the Filter(). Only records matching the Filter criteria will be deleted.
        • Fixed a problem that ocurred if your PrimaryKey column was not the first column in the table metadata.
        • Added a specific Exception for when you call Save on an entity that is part of a collection. You must call Save on the collection.


        EntitySpaces Trial Version: 

        • The SqlDemo has been replaced by a new and improved EntitySpacesDemo. A zipped version with the runtime references removed is available on the Documentation|Downloads page.


        Documentation: 

        • Added entries in compiled help for the new methods and properties.


        Note: See the Release Notes for 1.4.1 for detailed installation and upgrade insructions.

        posted on Thursday, June 15, 2006 12:03:31 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Monday, June 05, 2006

        We have released the first version of our EntitySpaces Template Suite for ASP.NET. Try the DEMO

        Here are the features:

        • All of the databases supported by EntitySpaces should work with these templates.
        • The ASPX pages generated build upon your already created EntitySpaces classes.
        • Both C# and VB.NET ASPX pages can be generated.
        • The look and feel of the ASPX pages are controlled by a very simple style sheet.
        • Master Pages are supported and optional (new with ASP.NET 2.0).
        • The generated ASPX pages use the new ASP.NET MultiView/View controls.
        • Browse, Detail, Edit and Search modes are supported.
        • You control what columns to display and in what order.
        • All column headers are clickable and sort the GridView(s).
        • Required fields use the RequiredFieldValidator control.
        • ForeignKeys are mapped to urls in detail mode and combo-boxes in edit mode.
        • Relationships can be mapped to subgrids in detail mode.

        Simply generate your ASPX pages. Add them to your solution. Finally, add these files to your project. (The templates are installed to the EntitySpaces.C#.Web and EntitySpaces.VB.Web folders in MyGeneration. The files below are under WebTemplates in your EntitySpaces program folder.)

        • es_stylesheet.css
        • question.gif
        • GridBase.cs  - C# projects only
        • GridBase.vb  - VB.NET projects only

        Both the installer and the DEMO site are available for download to all who have purchased EntitySpaces. See the download menu on the main EntitySpaces site. This new template suite will not be in the trial version. These templates are intended to provide the ability to administer databases over the web. This chore is typically overlooked although it is really needed. Such admin screens can eat up quite a bit of development time and they are much easier to generate. Other than the row of buttons at the top the demo site is 100% generated, no hand coding was done.

        These templates are not currently supported on the same level as the templates that generate the EntitySpaces classes. EntitySpaces will not be bogged down in supporting these or allow them to effect the timing of our 1.5 release which is fundamental to our long term strategy. That being said we will of course address issues over time and fix things as time allows.

        See the PDF file that describes the template(s) PDF

        posted on Monday, June 05, 2006 10:57:32 PM (Eastern Standard Time, UTC-05:00)  #    Comments [2]
         Sunday, June 04, 2006

        We have taken our soon to be released ASPX template suite and generated a site against the Microsoft SQL Northwind database. Nothing you will see on this site was hand coded (except for the row of buttons at the top and the URL link at the bottom - both on our master page). The ASP.NET templates are pretty sophisticated and are style sheet driven so please don't get hung up on the color scheme. We realize you probably wouldn't use these pages as your actual website but the ASP.NET pages do provide a nice admin system that sys-admins can use to administer your database and that developers can use during development. They also act as a very nice reference on how to use EntitySpaces in an ASP.NET application.

        The EntitySpaces ASP.NET templates support master pages (optional), use the new Multiview/View construct and the GridView, allow for sorting on the header columns, paging, sub grids, editing, searching, and more. We're only a matter of days until they are released at which point all customers will have access to the templates in the download area. The EntitySpaces ASP.NET templates will not be included in the trial version of EntitySpaces. The documentation and demo site of course will be open to everyone.

        Take a look http://www.entityspaces.net/thedemo/Employees_admin.aspx

        posted on Sunday, June 04, 2006 1:49:34 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Tuesday, May 23, 2006

        We just posted a video here to illustrate how simple it is to use EntitySpaces for module development on the DotNetNuke 4.x platform. This gets you up to where our standard code generation video starts with generating your EntitySpaces objects. We do plan to post an additional code generation video specifically for DotNetNuke in the near future, so stay tuned.

        posted on Tuesday, May 23, 2006 7:06:40 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Saturday, May 20, 2006

        EntitySpaces release 1.5 currently has a soft target date of July 30th, 2006. We will keep you posted as we get closer to release. The list below is what we are planning for 1.5. Of course, any bug fixes will be included. The ASPX template will be released as soon as it is available, possibly as early as mid-June.

        • Hierarchical support. This is the number 1 priority for this release. It is no small thing and will support many-to-one, one-to-many, and many-to-many relationships,  DataBinding Sub-Collections, and lazy loading. 
        • Caching. There has been a great deal of interest expressed in caching. This will eliminate unnecessary trips to the database while avoiding duplicate objects in memory. It will be well integrated with our hierarchical plans.
        • ASPX template. The template generates pages using the GridView control. This will be an amazing template with very sophisticated features:
          • Versions for both C# and VB output.
          • Sorting, filtering, searching, and editing.
          • Detail pages with hyperlinks to related objects.
          • DropDown ComboBoxes for lookups. You can choose the display column or even define your own concatenation of columns.
          • Paging with user definable number of line items per page.

        We have a growing wish list of items for inclusion in future releases. We have not prioritized them, yet, and some may never see the light of day, but feel free to comment on them and add your own:

        • Ability to load a table-based EntitySpaces object from a View. Similar to dOOdads.
        • Improved DataBinding.
        • Add a Clone method to the single entity.
        • Additional Providers.
        • Implement an .IsLoaded() method for entities and collections.
        • .NET Remoting.
        • WinForm templates.
        • Dynamic Query enhancements:
          • Support for common functions like UPPER() in WHERE clauses.
          • Support for JOINs.
        • Some tough ones. These are particularly thorny, especially in a multi-db environment, but we are still considering them as worth-while suggestions:
          • Updateable Views.
          • Add the ability for the EntitySpaces Dynamic Query API to do more than SELECT statements, such as INSERT, UPDATE and DELETE statements.
          • Add the ability to generate EntitySpaces objects from Stored Procedures (as opposed to just Views and Tables).

        If your pet feature has not made the list, do not be discouraged. Just let us know what you want in the forums or by commenting on this post. And, don't let that stop you from using EntitySpaces 1.4 right now. It can replace tens (even hundreds) of man-hours of repetitive drudgery with well-tested, high-quality code. You are free to concentrate on the aspects of a project that make it unique. Ask yourself, "What price would I pay if I could spend more time with my family and friends?" Then, let your conscience be the guide.

        The EntitySpaces Team


        posted on Saturday, May 20, 2006 8:37:34 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Saturday, May 13, 2006

         

        EntitySpaces 1.4 initially was targeted for May 31st, however, we had to make some adjustments. Hierarchical support is now the main focus of our next release (1.5). Also, the ASPX templates are still underway and will be released separately before the 1.5 release. We had also planned on doing some databinding work as well but that has been pushed to 1.5 as well. However, all that said this is a terrific release, we have some very good features, a few fixes, and even a new MySQL provider in 1.4. See the release notes below for the details.         


        ·          EntitySpaces 1.4

        o         Added templates to provide full VB.NET support

        §          Includes a full set of Custom, Generated, and MetadataMap templates.

        §          It is no longer necessary to pre-compile the generated code under C#.

        §          Note: If you are using VBExpress, we recommend opening your Project Properties, selecting the Application properties tab, and clearing the Root namespace that the IDE set by default. That way, when you add “Imports BusinessObjects” to your code, it will work as expected.

        o         Added an EntitySpaces provider for MySQL.

        §          Works with MySQL 4.x using DynamicSql mode.

        §          Works with MySQL 5.x and supports both DynamicSql and StoredProcedure modes, as well as Views.

        o         Added an EntitySpaces Template to produce MySQL 5.x stored procedures.

        o         Fixed stored procedure parameter name prefix handling for SQL Server, Oracle and Access.

        o         Fixed parameter name handling for column names with spaces.

        o         Added output parameter support to esParameters.         

        public string GetFullName(int employeeID)
        {
           
        esParameters parms = new esParameters();

           
        parms.Add("EmployeeID", employeeID);
           
        parms.Add("FullName", esParameterDirection.Output, DbType.String, 40);

           this.ExecuteNonExec(esQueryType.StoredProcedure, "proc_GetEmployeeFullName", parms);

           return parms["FullName"].Value as string;
        }

        o         Fixed an obscure bug in Transaction Manager. (Special thanx to Graham Scragg and Thomas Coats for working with us on this.)

        o         Improved Exception handling. We no longer wrap the exceptions which will make it much easier for you to see the real exception.

        o         Updated and improved compiled help.

         

         

        ·          DotNetNuke

        o         Includes an EntitySpaces ControlPanel module for DotNetNuke.

        §          Displays EntitySpaces assembly information.

        §          Allows you to upload/update EntitySpaces assemblies.

        §          Allows you to encrypt/decrypt connection information in config files.

        o         Added new template to create Sql scripts for DotNetNuke module development.


         

        ·          ASP.NET

        o         Includes ASP.NET code for an EntitySpaces ControlPanel.

        §          Displays EntitySpaces assembly information.

        §          Allows you to update EntitySpaces assemblies.

        §          Allows you to encrypt/decrypt connection information in config files.


         

        ·          EntitySpaces SqlDemo

        o         Includes code demonstrating encrypting/decrypting app.config connection information.

        o         Note: If SqlDemo is run from within Visual Studio, SqlDemo.vshost.exe.config gets encrypted. This file is only used by Visual Studio and should never be distributed with your application. To encrypt SqlDemo.exe.config, run SqlDemo.exe directly from the bin\Debug folder.


         

        ·          EntitySpaces Test Suite

        o         Updated the test fixtures and added NUnit projects to test the EntitySpaces provider for MySQL.

        o         Duplicated the C# tests in VB.

        Note: Installation instructions at the bottom of the Release Notes for 1.4 contain special instructions for MySQL users. They explain how add the required Language Mapping to MyGeneration.


        posted on Saturday, May 13, 2006 11:49:34 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Thursday, May 11, 2006

        Wow, so many good things to talk about for the upcoming EntitySpaces 1.4 drop. Another addition, is a complete template to generate DotNetNuke ready install scripts for any of your EntitySpaces business objects. It works just like any of our other stored procedure templates, and will allow you to generate a DNN ready script for all of your tables/stored procedures in one fell swoop. We previously mentioned that we will also be releasing native vb.net templates for ES with 1.4, so what are you waiting for DotNetNuke module developers? Quit wasting your time writing buggy, un-tested object persistence code and do it the easy way. ES 1.4 is scheduled to hit on Monday 05/15, get ready.

        posted on Thursday, May 11, 2006 9:31:07 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
        In order to facilitate further simplification of the setup/upgrading of EntitySpaces in your DotNetNuke portal or plain ol' ASP.NET application we are please to announce that we will also release the EntitySpaces Control Panel.


        This module/page will show you what EntitySpaces assemblies you have available and the versions of those assemblies. It will also allow you to upload assemblies when you are ready to update EntitySpaces. Lastly, and perhaps the coolest feature, is that this module will actually encrypt/decrypt the EntitySpaces connection info section of your web.config for you. We are just putting the finishing touches on the 1.4 drop and starting to package everything up for distribution, so you can expect to see this soon. We will have a DotNetNuke installable version, as well as an aspx page you can use in your ASP.NET projects. Winformers? Don't think we forgot to spread the love around, in the SqlDemo we have also added the encryption routines so that you can add this to your winform applications if you should so desire.


        posted on Thursday, May 11, 2006 9:29:56 AM (Eastern Standard Time, UTC-05:00)  #    Comments [2]
         Friday, April 21, 2006

        The target date for EntitySpaces release 1.4 is scheduled for May 31st, 2006. We cannot guarantee the May 31st date but we've been pretty good at hitting our goals. The list below is what we are planning for the 1.4 release.

        • MySQL - A MySql EntitySpaces provider for 4.x and 5.x will be available. The provider will support MySQL stored procedures and views for MySQL 5.x.
        • Hierarchical support will be added. This will be done via lazy load and support many-to-one, one-to-many, and many-to-many relationships.
        • DotNetNuke
          • DNN stored procedure and table creation templates will be complete
          • A full DotNetNuke module using EntitySpaces will be provided along with all of the source code.
        • DataBinding support will be improved
        • A template will be provided that will generate ASPX pages using the GridView control

        Of course, many other user suggested enhancements and bug fixes will make it into the 1.4 release. We have also purchased Demo Builder which is a great tool for making presentations. Scott will be making a series of presentations in fact on DotNetNuke and how to build modules using EntitySpaces that will come out before the 1.4 release.

        Don't let that stop you from buying 1.3 today, with the price of oil going up like it is it may cost us more to ship it to you .... So buy in now while it's cheap (that's supposed to be humor)

        posted on Friday, April 21, 2006 6:52:52 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Monday, April 17, 2006

        The EntitySpaces team has decided to give a free, one year, Professional version of the EntitySpaces architecture for .NET to the first three (accepted) DotNetNuke developers who build modules that use EntitySpaces. To be considered, you must send a proposal to support@entityspaces.net. Not all proposals will be accepted. We will be judging based on the following criteria:

        • Your proposal must describe how your DotNetNuke Module will use EntitySpaces to read and write to the database.
        • We must be able to host your module on our site, which means it will have to be a standard install.
        • The module must come with documentation that describes how you built it and you're experiences with EntitySpaces.

         

        The contest ends May 31, 2006, so send in your proposal, and get in the running for your free version of EntitySpaces. Applicants will need to use the trial version to develop their module.

        posted on Monday, April 17, 2006 10:29:52 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]

        We just released EntitySpaces 1.3, with lots of new features, and fixes here are the complete release notes:

        EntitySpaces - Release Notes for 1.3 

        • Fixed spaces in parameter names for SqlServer, Access, and Oracle.
        • Changes for text based Load(), ExecuteNonExec(), ExecuteReader(),  and ExecuteScalar() that handle both token {0} logic and named esParameter logic for SqlServer, Access, and Oracle.
        • Fixed Catalog|Schema naming in SqlServer and Oracle Enterprise  providers.
        • Fixed GUID (uniqueidentifier) handling in SQL Server, if the default is newid() they are marked as output parameters and automatically brought back in the object.
        • Added [Serialization] to the esStrings nested class in the esEntity generated classes so that Infragistics grids bind correctly.
        • Fixed error in the Dynamic SQL generation for Delete statements when composite primary keys were involved, this was fixed for Oracle, Sql Server and Access, it was using a comma where " AND " should have been.
        • The templates now inject the EntitySpaces version number into the header of the generated classes.
        • There is a new checkbox in the templates that allows you to ignore the schema and catalog in the metadata class and drive it entirely by the connection string. Checking this box is recommended if you are using SQL Server.
        • You can manually override the schema and provider in the connection string as follows:

        this.MyEmployeesCollection = new EmployeesCollection();
        this.MyEmployeesCollection.es.Connection.Catalog = "MyNorthwind";
        this.MyEmployeesCollection.es.Connection.Schema = "User";

        • Added  some key attributes on some of the properties. 
          1. esEntity.StringFormat  -  [BrowsableAttribute( false )]
          2. esEntity.SpecialBinder -  [BrowsableAttribute( false )]
          3. esEntity.strFomat - [NonSerialized]

        The Generated Entity & Collection Objects

          1. str -  [BrowsableAttribute( false )]
          2. Query -  [BrowsableAttribute( false )]
        • There are two new templates for DotNetNuke. We will be working hard in this area for the next release, any feedback on these templates by DNN folks is appreciated.



        NUnit Test Suite

        • Table with 'dot' in name 
        • Columns with spaces in name 
        • Columns with underscores in name. 
        • Token {0} and named esParameter logic 
        • Inserts/updates for table with memo field. 
        • Guid Primary Keys


        Documentation: 

        • Improved compiled help in esEntity and esEntityCollection areas. 
        • Tests Getting Started document.


        Installation: 

        New Installs:

        • Uninstall any Beta or Trial version before installing EntitySpaces.
        • Install the Binary first.
        • Source and Providers can be installed in any order after that. (They are separate downloads.)
        • You do not need to install 1.2 first.
        • The 1.3 downloads are full installs.

        Upgrades:

        • Upgrading does not require uninstalling 1.2.
        • You should install 1.3 over the top of your 1.2 installation.
        • Install the Binary first.
        • Source and Providers can be installed in any order after that. (They are separate downloads.)
        • You will need to regenerate your "Generated" classes after you install.

         

        If you are a DotNetNuke developer and you are looking for a kick ass O/R Mapping solution you should definately check it out. We have a free 45 day trial available to all registered users.

        posted on Monday, April 17, 2006 10:19:57 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]
         Sunday, March 19, 2006

        Oracle uses Sequences for auto-incrementing, however, unlike SQL Server you cannot assign them as a column property or a default value. Therefore the MyGeneration code generator has no idea that you want to use an Oracle Sequence as an identity column value. Take a look at the "SeqTest" table below, the ID column is defined as the primary key. We want to use the ID column as an Identity or AutoIncrement column and we also want to use our timestamp column for concurrency checking. Can EntitySpaces handle this? You bet.

        Take a look at our "SeqTest" Oracle table below.

        CREATE TABLE "TEST"."SeqTest"

            "ID" NUMBER
            "TimeStamp" NUMBER
            "Data" VARCHAR2(100),  

            CONSTRAINT "PK" PRIMARY KEY ("ID") VALIDATE ,

            CHECK ("ID" IS NOT NULL) VALIDATE ,

            CHECK ("TimeStamp" IS NOT NULL) VALIDATE ,

            CHECK ("Data" IS NOT NULL) VALIDATE

        )

         

        Our Oracle Sequence.

         

        CREATE SEQUENCE "TEST"."SEQ_ID" NOCYCLE NOORDER CACHE 20 NOMAXVALUE MINVALUE 1 INCREMENT BY 1 START WITH 1

         Below is an image of the MyMeta Browser open in MyGeneration with our SeqTest Selected. 

        Because Oracle has no real metadata itself to indicate the AutoIncrement column or Concurrency column information we need to store some user metadata in MyGeneration so that the EntitySpaces templates will know what to do. To do this we put a few name/value pairs in the MyGeneration User Metadata indicating that we want to use the "SEQ_ID" Oracle Sequence as our Identity or AutoIncrement Column value and to indicate that we want to use the TimeStamp column as our concurrency column. These entries are placed at the table level, in the user metadata simply by clicking on the table with the User Meta Data window and entering values similiar to those shown below.



        Let's examine these two name/value pairs:

        AUTOKEY:ID / SEQ_ID      = Treat the ID column as an AutoIncrement Column and use the SEQ_ID sequence to get the value.
        CONCURR:TimeStamp / 1  = Treat the TimeStamp column as a concurrency column and bump it's value by 1 upon each update.

        Now let's take a look at what effect these two name/value pairs have on our insert and update statements.

        The INSERT statement.
        Notice that the SEQ_ID sequence is used to populate the pID parameter's value and that the pID parameter is also declared as an OUT parameter so that it can be brought back after the insert statement completes. The pTimeStamp parameter is also assigned to 1 and declared as an OUT parameter for the same reason.

        CREATE PROCEDURE "TEST"."proc_SeqTestInsert"
        (

            pID OUT "SeqTest"."ID"%type,
            pTimeStamp OUT "SeqTest"."TimeStamp"%type,
            pData IN "SeqTest"."Data"%type
        )
        IS
            BEGIN

              SELECT SEQ_ID.NextVal INTO pID FROM DUAL;
              pTimeStamp := 1;

              INSERT INTO "SeqTest"
              (
                "ID",
                "TimeStamp",
                "Data"
              )
              VALUES
              (
                pID,
                pTimeStamp,
                pData
              );
           END;

        The UPDATE statement.
        This bumps the TimeStamp column by 1 but not before it compares the current TimeStamp value to make sure it hasn't changed since we last read the data (in the Where statement). The pTimeStamp parameter is also declared as an OUT parameter to ensure that the new value is brought back after the update is complete.

        CREATE PROCEDURE "TEST"."proc_SeqTestUpdate"
        (

            pID IN "SeqTest"."ID"%type,
            pTimeStamp IN OUT "SeqTest"."TimeStamp"%type,
            pData IN "SeqTest"."Data"%type
        )
        IS
            pConncurrency "SeqTest"."TimeStamp"%type := pTimeStamp;

            BEGIN
              UPDATE "SeqTest"
              SET
                "TimeStamp" = "TimeStamp" + 1,
                "Data" = pData
              WHERE "ID" = pID
                AND "TimeStamp" = pConncurrency;

              IF SQL%ROWCOUNT = 1 THEN
                 pTimeStamp := (pConncurrency + 1);
              ELSE
                 Raise_application_error(-20101, 'NO RECORDS WERE UPDATED');
              END IF;
            END;

        These are the stored procedures generated by the EntitySpaces Oracle stored procedure template, however the same holds true for the EntitySpaces dynamic sql generation, it works the same way.

         

        posted on Sunday, March 19, 2006 9:27:11 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]