Sunday, March 19, 2006

Oracle uses Sequences for auto-incrementing, however, unlike SQL Server you cannot assign them as a column property or a default value. Therefore the MyGeneration code generator has no idea that you want to use an Oracle Sequence as an identity column value. Take a look at the "SeqTest" table below, the ID column is defined as the primary key. We want to use the ID column as an Identity or AutoIncrement column and we also want to use our timestamp column for concurrency checking. Can EntitySpaces handle this? You bet.

Take a look at our "SeqTest" Oracle table below.

CREATE TABLE "TEST"."SeqTest"

    "ID" NUMBER
    "TimeStamp" NUMBER
    "Data" VARCHAR2(100),  

    CONSTRAINT "PK" PRIMARY KEY ("ID") VALIDATE ,

    CHECK ("ID" IS NOT NULL) VALIDATE ,

    CHECK ("TimeStamp" IS NOT NULL) VALIDATE ,

    CHECK ("Data" IS NOT NULL) VALIDATE

)

 

Our Oracle Sequence.

 

CREATE SEQUENCE "TEST"."SEQ_ID" NOCYCLE NOORDER CACHE 20 NOMAXVALUE MINVALUE 1 INCREMENT BY 1 START WITH 1

 Below is an image of the MyMeta Browser open in MyGeneration with our SeqTest Selected. 

Because Oracle has no real metadata itself to indicate the AutoIncrement column or Concurrency column information we need to store some user metadata in MyGeneration so that the EntitySpaces templates will know what to do. To do this we put a few name/value pairs in the MyGeneration User Metadata indicating that we want to use the "SEQ_ID" Oracle Sequence as our Identity or AutoIncrement Column value and to indicate that we want to use the TimeStamp column as our concurrency column. These entries are placed at the table level, in the user metadata simply by clicking on the table with the User Meta Data window and entering values similiar to those shown below.



Let's examine these two name/value pairs:

AUTOKEY:ID / SEQ_ID      = Treat the ID column as an AutoIncrement Column and use the SEQ_ID sequence to get the value.
CONCURR:TimeStamp / 1  = Treat the TimeStamp column as a concurrency column and bump it's value by 1 upon each update.

Now let's take a look at what effect these two name/value pairs have on our insert and update statements.

The INSERT statement.
Notice that the SEQ_ID sequence is used to populate the pID parameter's value and that the pID parameter is also declared as an OUT parameter so that it can be brought back after the insert statement completes. The pTimeStamp parameter is also assigned to 1 and declared as an OUT parameter for the same reason.

CREATE PROCEDURE "TEST"."proc_SeqTestInsert"
(

    pID OUT "SeqTest"."ID"%type,
    pTimeStamp OUT "SeqTest"."TimeStamp"%type,
    pData IN "SeqTest"."Data"%type
)
IS
    BEGIN

      SELECT SEQ_ID.NextVal INTO pID FROM DUAL;
      pTimeStamp := 1;

      INSERT INTO "SeqTest"
      (
        "ID",
        "TimeStamp",
        "Data"
      )
      VALUES
      (
        pID,
        pTimeStamp,
        pData
      );
   END;

The UPDATE statement.
This bumps the TimeStamp column by 1 but not before it compares the current TimeStamp value to make sure it hasn't changed since we last read the data (in the Where statement). The pTimeStamp parameter is also declared as an OUT parameter to ensure that the new value is brought back after the update is complete.

CREATE PROCEDURE "TEST"."proc_SeqTestUpdate"
(

    pID IN "SeqTest"."ID"%type,
    pTimeStamp IN OUT "SeqTest"."TimeStamp"%type,
    pData IN "SeqTest"."Data"%type
)
IS
    pConncurrency "SeqTest"."TimeStamp"%type := pTimeStamp;

    BEGIN
      UPDATE "SeqTest"
      SET
        "TimeStamp" = "TimeStamp" + 1,
        "Data" = pData
      WHERE "ID" = pID
        AND "TimeStamp" = pConncurrency;

      IF SQL%ROWCOUNT = 1 THEN
         pTimeStamp := (pConncurrency + 1);
      ELSE
         Raise_application_error(-20101, 'NO RECORDS WERE UPDATED');
      END IF;
    END;

These are the stored procedures generated by the EntitySpaces Oracle stored procedure template, however the same holds true for the EntitySpaces dynamic sql generation, it works the same way.

 

posted on Sunday, March 19, 2006 9:27:11 PM (Eastern Standard Time, UTC-05:00)  #   
 Saturday, March 04, 2006
Source code for EntitySpaces unit tests to be released.
posted on Saturday, March 04, 2006 12:48:16 AM (Eastern Standard Time, UTC-05:00)  #   
 Saturday, February 04, 2006

The EntitySpaces team welcomes you to the EntitySpaces project. The EntitySpaces architecture is maturing nicely. We hope that your experience with our latest beta is going well and we apologize for the weak documentation. We are working on providing NDoc help for our next release as well as more content. The EntitySpaces code has changed a lot under the hood in comparison to our earlier beta, and it has improved greatly. Our Data Binding support really improved and we now support both transaction models offered by the 2.0 .NET Framework. We have developed NUnit tests and are tracking what percentage of code coverage we have obtained.

We have also created our first DotNetNuke module using EntitySpaces and are quite pleased with how easy it was and how well it works. The GuestBook DotNetNuke module is available on our main menu. One of our goals is to provide a better data access strategy for the DotNetNuke community. We believe this will help the DotNetNuke community by opening up module development with a very simple and easy to use programming model. The EntitySpaces architecture provides transaction support, dynamic query support, and other features that are lacking in the DotNetNuke programming model. In fact, in our first beta, the EntitySpaces demo ran against three different databases, Microsoft SQL, Microsoft Access, and VistaDB. The demo switched between the three different databases at runtime via a drop down combobox showing the true ease of the provider independent nature of EntitySpaces. Finally, within a week or so we will most likely be using trac as our bug tracking system which will greatly help us improve the architecture and serve your needs. 

GuestBook.PNG

Over the next two weeks we will work hard to publish a pricing model. Our plan is to go with a yearly subscription model with varying levels of support and with and without source pricing. We will be revising our roadmap soon to incorporate when features like remoting and hierarchical support will be added as well as when other data providers will be brought online.
 
Welcome aboard. Our aim is to provide the best .NET architecture in the market with the richest feature set for its price and size.

The EntitySpaces team

posted on Saturday, February 04, 2006 10:35:49 AM (Eastern Standard Time, UTC-05:00)  #   
 Wednesday, January 18, 2006

On January 18, 2006 a filing was made for the formation of "EntitySpaces, LLC", a limited liability company. EntitySpaces, LLC is working hard to put together a commercial offering for the EntitySpacesTM .NET architecture. The first release of the EntitySpaces architecture is set to support Microsoft SQL Server, MySQL and Oracle. The EntitySpaces .NET architecture will be able to operate as an independent data provider for the popular DotNetNuke® Open Source Framework (operating outside of the current DotNetNuke DAL API).

Mike Griffin is the originating architect of the EntitySpaces .NET architecture and President of EntitySpaces, LLC. Mike is also co-author of the popular MyGeneration Code Generator / OR Mapping tool and the creator of the widely used dOOdads .NET architecture which is currently supported on eight DBMS systems. Joining Mike in forming EntitySpaces, LLC are Scott Schecter and David Parsons. Mike can be reached at mike.griffin@entityspaces.net

Scott Schecter brings a wealth of DotNetNuke experience to EntitySpaces, LLC. Scott is President of Schecter Technology Solutions and also a Programmer/Analyst for the Lycoming County Government in Pennsylvania. Additionally, Scott authored the MyGeneration Template Statistics module for DotNetNuke and is an experienced dOOdads user himself. Scott has designed DotNetNuke modules that use the dOOdads .NET architecture as the DAL for DotNetNuke and has delivered many successful projects using the dOOdads in both his own practice and for the County of Lycoming. Scott is also the author of NukeSyndicate, a rich media casting module for DotNetNuke. Scott can be reached at scott.schecter@entityspaces.net

David Parsons answered the challenge to create aggregate support for the dOOdads .NET architecture which was a great addition to dOOdads. David was also crucial in organizing an NUnit test suite to help test the rich dOOdads API on eight database systems in two native languages, C# and VB.NET. David has just recently created a very powerful plug-in for MyGeneration known as DnpUtils. The DnpUtils plug-in for MyGeneration has very powerful hierarchical API's for detecting relationships and other very useful features. David also maintains a number of MyGeneration Template Archives. David can be reached at david.parsons@entityspaces.net

EntitySpaces, LLC personnel have a diverse background that will be used to deliver the EntitySpaces .NET architecture and related services. EntitySpaces, LLC is made up of folks that know what it takes to not only create, write, and test an architecture but are also consumers themselves. EntitySpaces will continue the stellar support many are familiar with in conjunction with MyGeneration and the dOOdads .NET architecture.


On January 23, 2006 EntitySpaces, LLC officially became a legal entity.

posted on Wednesday, January 18, 2006 7:57:39 PM (Eastern Standard Time, UTC-05:00)  #