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