Saturday, March 03, 2007

  


EntitySpaces 1.6 has been renamed EntitySpaces 2007. This does not imply that we have adopted a 1 year release schedule by any means. Our versioning will be as follows. An assembly version of 2007.4.0804 is broken down as follows; 2007 is the year, 4 is the release, 0804 represents August 4th. However, we will no longer refer to our releases by the assembly versions, instead, if the assembly version is 2007.4.0804 we will refer to it as "EntitySpaces 2007 v4". Each new release will bump the assemblies accordingly. We feel that this is a much better way of communicating our release numbers while at the same time providing some context on the age of any given release.

There is one exception to our new versioning convention and this will occur during beta releases. Upon our first release of the EntitySpaces 2007 beta the assembly versions will be 2007.0.0304 where 2007 is the year, 0 is the release, 0304 is March 4th. We will refer to this as EntitySpaces 2007 Beta v0.0304. During beta releases the release number will not be incremented, only the date portion will be. If the next beta were to be released on March 21st the assembly versions will be 2007.0.0321 and we will refer to this as EntitySpaces Beta 2007 v0.0321.  The official release of EntitySpaces 2007 will be EntitySpaces 2007 v1.

 

 

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

posted on Saturday, March 03, 2007 4:30:07 PM (Eastern Standard Time, UTC-05:00)  #   
 Sunday, February 25, 2007

Another area of enhancement is complete, and that is our improvements to the EntitySpaces Dynamic Query API. We took some steps not covered in this blog post to hide extraneous items from the intellisense when building Dynamic Query's via intellisense. We have also opened the door to all kinds of SubOperators, some simple samples are shown below, of course these work on all of the EntitySpaces data providers as well. It is our hope that during our 1.6 beta our users will suggest more SubOperators, and as long as they apply across most databases there's a good chance they will make the release.

So here's the Sneak Peak ...


Notice the ToLower() SubOperator and the As() aliasing mechanism. These are both new to the 1.6 DynamicQuery Mechanism.

Employees emp = new Employees();
emp.Query.Select(emp.Query.LastName.ToLower().As("LastNameLower"));
emp.Query.Where(emp.Query.EmployeeID == 1);
emp.Query.Load();

Generates ...

SELECT LOWER([LastName]) AS 'LastNameLower' FROM [Employees] WHERE ([EmployeeID] = @EmployeeID1)



Notice the LTrim and Substring SubOperators as well as the As aliasing mechanism

Employees emp = new Employees();
emp.Query.Select(emp.Query.LastName.LTrim().Substring(0,1).As("FirstInitial"));
emp.Query.Where(emp.Query.EmployeeID == 1);
emp.Query.Load();

Generates ...

SELECT LTRIM(SUBSTRING([LastName],0,1)) AS 'FirstInitial' FROM [Employees] WHERE ([EmployeeID] = @EmployeeID1)



Finally, the Aggregates underwent a breaking change, it will be very easy to upgrade these and we felt it important to have our Aggregates conform with the rest of the syntax. We apologize for the breaking change but felt it important to make this change now. We feel that when you look at the two syntax's shown below you will agree the 1.6 syntax is superior and really shines with intellisense.

1.5.3 Syntax
emp.Query.Select(emp.Query.LastName.Count("TheCount", true));

1.6.0 Syntax
emp.Query.Select(emp.Query.LastName.Count().Distinct().As("TheCount"));



The SubOperators that will be available in the 1.6 March 4th beta are as follows:

  • ToUpper
  • ToLower
  • LTrim
  • RTrim
  • Trim
  • Substring

There are many more that can be implemented, the architecture is now in place to support them and the syntax nests properly as you can see in the Substring example above. Something we've been thinking about that won't make our 1.6 Release but will find it's way onto an upcoming Roadmap is SubSelects. We already support the IN in the where clause of course. We're not sure on the syntax but perhaps something like this:

Future Roadmap ....

Customers cust = new Customers();
Employees emp = new Employees();

emp.Query.Select(emp.Query.EmployeeID, emp.Query.FirstName);
emp.Query.Where(emp.Query.EmployeeID.In
(
     emp.Query.SubSelect(cust.Query.Location == "Indianapolis");
)
emp.Query.Load();


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

posted on Sunday, February 25, 2007 8:06:30 PM (Eastern Standard Time, UTC-05:00)  #   
 Friday, February 16, 2007

We are working hard on our upcoming 1.6 release and we are very excited about it. EntitySpaces 1.6 is going to deliver a truly amazing set of features. The EntitySpaces esTransactionScope class is being greatly enhanced to provide even more power and flexibility for your enterprise level development projects. Before we begin, however, a little background is in order.

Before the Microsoft .NET Framework was released most of my development (Mike) involved creating COM+ object models on top of SQL Server using C++. These objects models would then be consumed by VBScript programmers to create corporate websites. This might date me a little but I was there when OLE 1.0 was released. Later, when NT Service Pack 4 was released MTS became a serious technology and it really got interesting. Finally, it was all rolled into Windows NT itself as COM+. I designed many large Distributed Network Architectures (DNA) using COM+ to protect several concurrent SQL Servers / MSMQ servers which then delivered packets to EIA brokers, all in a single distributed transaction. It was the stuff dreams are made of. If it's one thing I know, it's that the transaction is the heart of any architecture and should be front and center in your ORM solution. In the end, before the dawn of .NET, I was using the Active Template Library (ATL) in combination with the Standard Template Library (STL) to create incredibly high performing distributed network architectures. Indeed, ATL and STL in the right hands was a deadly weapon.

When Microsoft .NET was released I created dOOdads (back in the leather helmet days). I used COM+ as my inspiration. There was no way I was going to do what most of the industry was doing and that was passing Transactions and Connections around all throughout my API, it had to be seamless. Thus, I used Thread Local Storage (TLS) and stuffed the Transaction into a slot on the thread. Then, down low in the architecture the base classes simply enlisted into the transaction, if there was an ongoing transaction. To the programmer it's magic.

If you are familiar with the TransactionScope class in the Microsoft .NET System.Transactions namespace then you will be very comfortable with the EntitySpaces esTransactionScope class. The really cool thing about the .NET TransactionScope is how it uses the "using" syntax to control the transactions "scope" or lifetime. EntitySpaces runs fine using the .NET TransactionScope, however the System.Transactions.TransactionScope class can add some significant overhead if you are not in need of distributed transactions. The .NET TransactionScope is a truly amazing work of art itself in the way it can promote local lightweight transactions to distributed transactions when another resource is enlisted. However, there is a certain amount of overhead when using the .NET TransactionScope class and most hosting companies will not allow you use the .NET TransactionScope class as it enlists the Distributed Transaction Coordinator (DTS). 

In summary, the esTransactionScope class uses Thread Local Storage (TLS) to avoid intrusion and takes advantage of the the "using" syntax to control a transactions "lifetime". The esTransactionScope fills a very noticeable void in the Microsoft .NET Framework, and that is an elegant solution for ADO.NET connection based transactions.

Currently, in our 1.5 release esTransactionScope can be nested as follows:

using (esTransactionScope scope = new esTransactionScope())
{
    Employees emp = new Employees();
    emp.LoadByPrimaryKey(1);
    emp.FirstName = "Joe";
    emp.Save();

    Customers cust = new Customers();
    // ...
    cust.Save();

    scope.Complete();
}


In the code above, both the Employees and Customer Save methods also use the esTransactionScope, they can be nested just fine. Only when the final outer scope.Complete() is executed is the transaction truly committed. However, there are times when you might want to write to a SQL table during an exception possibly caused by a rolled back transaction, for instance, to record the callstack information. Or you might just otherwise need to break out of an ongoing transaction. You might even want to have a nested transaction that acts as it's own root transaction much like a COM+ requires new transaction. We have added this granular level of control in the enhanced 1.6 esTransactionScope class. The ability to nest all of these different types at your leisure greatly enhances your power to accomplish what you need to with EntitySpaces. In our 1.6 release the esTransactionScope accepts an optional parameter on it's constructor, and that is the esTransactionScopeOption enum.

public enum esTransactionScopeOption
{
    // Summary:
    //     A transaction is required by the scope. It uses an ongoing transaction if
    //     one already exists. Otherwise, it creates a new transaction before entering
    //     the scope. This is the default value.
    Required = 0,
    //
    // Summary:
    //     A new transaction is always created for the scope.
    RequiresNew = 1,
    //
    // Summary:
    //     Any ongoing transaction is suppressed when creating the scope. All
    //     operations within the scope are done without a transaction.
    Suppress = 2,
}


The following code snippet shows how you can nest and control the transactions at a very granular level. However, our recommendation is to run with Required for all nested transactions. You must be careful not to create deadlocks. The default isolation level of esTransactionScope is Serializable, which offers the most protection.

using (esTransactionScope rootTrans1 = new esTransactionScope())
{
    using (esTransactionScope noTrans = new esTransactionScope(esTransactionScopeOption.Suppress))
    {
        // Anything done in here runs without a transaction because of the "Suppress"
        esUtility util = new esUtility();
        int count = (int)util.ExecuteScalar(esQueryType.Text, "Select Count(*) From Employees");

        using (esTransactionScope scope = new esTransactionScope())
        {
            // This transaction scope uses the default is Required, therefore it enlists in "rootTrans1"
            Employees emp = new Employees();
            emp.LoadByPrimaryKey(1);
            emp.FirstName = "Joe";
            emp.Save();

            using (esTransactionScope rootTrans2 = new esTransactionScope(esTransactionScopeOption.RequiresNew))
            {
                // This is a new root transaction and doesn't partake in "rootTrans1"
                Employees emp1 = new Employees();
                emp1.LoadByPrimaryKey(2);
                emp1.FirstName = "Sam";
                emp1.Save();

                // Since this was a RequiresNew tranaction, the true commit is done here
                rootTrans2.Complete();
            }

            // Doesn't commit yet, as "rootTrans1" is the root
            scope.Complete();
        }

        noTrans.Complete();
    }

    // Commits the rootTrans1 and any nested transactions
    rootTrans1.Complete();
}

If you were paying attention to the above code you might have noticed the new esUtility class, this class allows you to execute any SQL without using a specific EntitySpaces Collection or Entity, thus the name, esUtility. This is just a sneak peak and we will post many more of these to give you insights into our next release.


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

posted on Friday, February 16, 2007 9:52:19 PM (Eastern Standard Time, UTC-05:00)  #   
 Thursday, February 01, 2007

On February 10, 2007 Jaime (Cano) Noriega will be holding a session at the South Florida .NET Code Camp titled "Data the Easy Way". Jaime's presentation will be featuring EntitySpaces and how it applies to Winforms, ASP.Net, and Compact Framework. The code camp is being held at Devry University in Miramar, FL so if you get a chance register and attend the conference. You can see the Agenda HERE

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

posted on Thursday, February 01, 2007 10:00:02 PM (Eastern Standard Time, UTC-05:00)  #   
 Sunday, January 21, 2007

Simpler is better, and we have stream-lined it all, without sacrificing any of the capabilities or features of the EntitySpaces Architecture. In fact, everyone will gain from the new product and pricing model. Instead of three packages; Express, Professional, and Enterprise, with all their Data Provider specific variations, we will offer two products; EntitySpaces Developer and EntitySpaces Source. EntitySpaces Developer includes all the features found in the Express and Professional packages, plus it now includes ALL Data Providers. EntitySpaces Source is the same source code currently only available to Enterprise customers. It may be purchased along with Developer, or at a later date.

See our pricing page HERE and the impact on current customers HERE

     - The EntitySpaces Team
        http://www.entityspaces.net

 

 

posted on Sunday, January 21, 2007 1:38:32 PM (Eastern Standard Time, UTC-05:00)  #   
 Friday, December 22, 2006

The estimated date for the EntitySpaces 1.6.0 release is March 15th, 2007. This date is only an estimate but it is our intended goal to hit that release date. There will be a full beta period before the release and all customers will be able to participate. There are numerous fixes and small items in our tracking system not listed here that will make it into this release. We are showing just the major features here.

Data Binding

This is going to be the main focus of the EntitySpaces 1.6.0 release. We will be adding design time data binding to our ASP.NET support. We will also be testing using the .NET GridView, the Telerik r.a.d.grid, Infragistic’s WebGrid, and a few others. We will test in both Windows Forms and ASP.NET environments.

We will implement the Microsoft .NET DataSourceControl class for EntitySpaces to allow for ASP.NET design time support to make things even easier. Two-way data binding will also be supported. EntitySpaces will also support the .NET DetailsView/FormView controls.  Finally, hierarchical data binding will be supported so that you can drill down through the hierarchical data model in your grid, if your grid supports hierarchical data binding.

Samples of EntitySpaces being used in all of the above environments will be made available for download as well. These data binding enhancements represent a major chunk of work and are no small undertaking.

Hierarchical Improvements

The hierarchical data model currently only saves from the top down. Our plan is to remove this constraint from the hierarchical model and make it so that it doesn’t matter where you jump into the tree, or whether your traverse it up or down. It will always save correctly no matter what node you call Save on.

Also, added to the hierarchical templates will be an exclude table list. This list  will allow you to exclude certain tables from the model.  If any foreign keys link to a table in the exclude list that entry will not be created, thus, you control what tables are referenced in the hierarchical model.

Medium Trust Support

We will be adding support for running in medium-trust mode which is important when running under certain hosting environments.

Optional Base Class

There will be a checkbox on the master templates that will allow you to slice in your own class between your generated class and the esEntity or the esEntityCollection class. This will allow you to include core functionality across all of your classes within a single base class.

Query API Enhancements

Enhancements to the QueryAPI such as StartsWith, EndsWith, RTrim, LTrim, Trim, Upper, Lower, Row + Top/Limit (MySql, Oracle, and SQL 2005’s ROW_NUMBER will work via these).

Utility Class

There will be a new utility class that will allow you to inherit from or use it directly to call miscellaneous stored procedures and such that really are system wide and don’t make sense in any of your custom classes.

Stored Procedure Based Entities

At this point the plan is to create read-only entities using stored procedures as the source, this has been asked for by lots of folks and we will be asking for input on this before we implement.

Webservices

Publish Full Xml and Binary WebServices Examples

posted on Friday, December 22, 2006 6:16:25 PM (Eastern Standard Time, UTC-05:00)  #   
 Monday, December 11, 2006

Well, it has been almost a year since the last release of MyGeneration but it's finally here. If you want a 100% free, very nice code generator and ORM mapping tool try the new version of MyGeneration 

You can download it here ....

 Get it from CNET Download.com!

MyGeneration, Download.com's #1 Development Tool in the .NET Category.

posted on Monday, December 11, 2006 3:22:12 PM (Eastern Standard Time, UTC-05:00)  #   
 Saturday, December 02, 2006
The EntitySpaces team decided to take a slight detour from its upcoming 1.6.0 release and add support for the Compact Framework to its popular architecture, which is a persistence layer and business object system for Microsoft .NET 2.0. Support for the Compact Framework paves the way for VistaDB 3.0 and the Microsoft SQL Compact Edition well in advance of their official releases. Both VistaDB 3.0 and the Microsoft SQL Compact Edition are still in CTP mode. EntitySpaces classes are generated from your database schema using download.com's #1 download in the .NET development category, MyGeneration, using the EntitySpaces template suite.

EntitySpaces LLC has created a sample application using a very powerful combination of its EntitySpaces architecture in conjunction with VistaDB 3.0, and running both under the Windows Mobile 5.0 Smartphone emulator. Setting up the demo solution was very simple. First, references to the EntitySpaces.Core.Ce and EntitySpaces.Interfaces.Ce assemblies were added. Next, a reference to the EntitySpaces.VistaDB.Ce data provider was added. Finally, the VistaDB Northwind.vdb3 database was added to the project and its "Build Action" was set to "Content" to ensure that the database is copied along with the other assemblies to the proper folder when the simulator is launched. To see the solution in Visual Studio click HERE.


Click here for a larger view The next step was to write the code to connect to the VistaDB Northwind database. To accomplish this, the new configless execution feature provided by the recent EntitySpaces 1.5.2 release was used. The trick was actually figuring out how to get the correct path to the database while running in the simulator. You can see how this was accomplished in the first line of the following code snippet.

    string cnString = ("Data Source =" + (System.IO.Path.GetDirectoryName
     (System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) +
     "\\Northwind.vdb3; Open Mode = ExclusiveReadWrite"));

    // What the heck let's register a connection
    esConnectionElement conn = new esConnectionElement();
    conn.ConnectionString = cnString;
    conn.Name = "VistaDb";
    conn.Provider = "EntitySpaces.VistaDBProvider.Ce";
    conn.ProviderClass = "DataProvider";
    conn.SqlAccessType = esSqlAccessType.DynamicSQL;
    conn.ProviderMetadataKey = "esDefault";
    esConfigSettings.ConnectionInfo.Connections.Add(conn);

    // Assign the Default Connection
    esConfigSettings.ConnectionInfo.Default = "VistaDb";


The only option on the opening Menu brings the user to a form which contains a DataGrid bound directly to an EntitySpaces EmployeesCollection object loaded with all of the employees in the database. Note that you can use the EntitySpaces collections in design time mode directly on the form itself, this can be seen HERE. The EntitySpaces dynamic query mechanism was used to limit the columns brought back from the database to only those needed to operate the DataGrid. These included the EmployeeID, FirstName, and LastName columns. Finally, the DataGrid TableStyles collection was used to set the EmployeeID column's width to zero so that it would not be visible. The only thing left to do is fetch the data and assign the EntitySpaces collection directly to the DataGrid.DataSource property.

The developer will never need to use any ADO.NET code, or any specific VistaDB code to accomplish this task. In fact, the developer could easily swap out the EntitySpaces VistaDB provider and exchange it for the EntitySpaces Microsoft SQL CE provider, and run the same exact binary code. The EntitySpaces architecture itself is tested using NUnit against all five supported databases using the same exact binary code. No recompilation necessary. The code used to fetch the data and bind to the DataGrid is shown below and taken from the FormGrid class in the demo.

 

Click here for a larger view     private void PopulateGrid()
    {
        EmployeesCollection empColl = new EmployeesCollection();
        empColl.Query.Select
            (
                empColl.Query.EmployeeID,
                empColl.Query.FirstName,
                empColl.Query.LastName
            );
        empColl.Query.Load();

        this.theGrid.DataSource = empColl;
    }

It really is that simple. Next, the "Edit Record" menu item needs to be handled in order to navigate to the editing form. To accomplish this the hidden EmployeeID needs to be grabbed, and passed to the "FormEdit" page based on the selected row at the time the "Edit Record" menu item is clicked.

    private void menuItem_EditRecord_Click(object sender, EventArgs e)
    {
        int index = this.theGrid.CurrentRowIndex;
        int id = (int)this.theGrid[index, 0];  // index is the row
                                               // zero = the first column
        FormEdit form = new FormEdit(id);
        form.Show();
    }

It is on the editing page where users can modify, delete, and add new records. Remember from above that the EmployeeID is passed to the FormEdit page. The constructor for the FormEdit page is very easy to implement using EntitySpaces architecture. Here, instead of the EmployeesCollection, the Employees class is used to load the correct record. The Employees class is used to hold a single record, whereas, the EmployeesCollection holds a set of Employees classes. The record is loaded using the LoadByPimaryKey method as shown in the code snippet below. Finally, the labels and textbox controls are populated with the data from the EntitySpaces Employees object. 


 

Click here for a larger view

 

 

    public FormEdit(int employeeID)
    {
        InitializeComponent();

        Employees emp = new Employees();
        if (emp.LoadByPrimaryKey(employeeID))
        {
            this.lblID.Text = emp.str.EmployeeID;

            this.txtFirstName.Text = emp.FirstName;
            this.txtLastName.Text  = emp.LastName;
        }
        else
        {
            this.lblError.Text = "Employee not found";
        }
    }

On the editing screen shown on the left Margaret's first name has been changed to "Mary" and then saved using Save on the menu. The ability to add and delete records is in the EntitySpaces Mobile demo too but not shown here. Pressing close will return the user to the DataGrid form reflecting any edits that may have occurred. The image on the right reveals that not only was Margaret's name changed to Mary, but "Mike Griffin" was added to the database as well. The grid is refreshed in the Activated event of the FormGrid class. 

It should be clearly seen how easy EntitySpaces can be used to work with the Compact Framework. Click here for a larger viewWhile creating the demo we were very impressed with VistaDB 3.0. VistaDB has some features that we found make it very attractive. First, VistaDB has some nice advantages over the Microsoft SQL Compact Edition. The VistaDB Namespace doesn't change when moving to the Compact Framework. The Microsoft Compact Edition, however, uses SqlCeClient instead of SqlClient, which makes it more difficult for developers to maintain a single codebase. The EntitySpaces architecture conveniently hides these low level issues from the developer, thereby isolating code from such provider quirks. Also, the same VistaDB database (the exact same physical file) will run on all environments with no loss of features or a lesser SQL syntax when running under the Compact Framework.

Having said that, the EntitySpaces Architecture does support the Microsoft SQL Compact Edition fully, and we will publishing the same demo application shown here for it very soon. We are just putting a few finishing touches on the EntitySpaces provider for the Microsoft SQL Compact Edition. The SQL supported under the Microsoft SQL Compact Edition is different than what is allowable under Microsoft SQL 2005. The EntitySpaces user of course will never realize these differences and that is one of the main strengths of EntitySpaces.

The EntitySpaces Mobile demo will be available for download Monday December 4th by 8:00 AM EST time. A link will be posted on this page.

 

 

 

 

 

 


- The EntitySpaces Team

posted on Saturday, December 02, 2006 10:08:43 PM (Eastern Standard Time, UTC-05:00)  #