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