DBC in use

I am finally getting around to making use of Aabs.Dbc in my new open source porject Aabs.Norm. I figured that the best proving ground for a thing like this is a thing like that. That is, a highly complex, high performance application framework, that maintains a state in a variety of very complex ways, that uses polymorphism and .NET in sophisticated ways, and that will be adversely affected if the performance of Aabs.Dbc is poor at runtime.

Here’s an example of the interface to the core object – the Persistence Broker.

namespace Aabs.Norm.Core

{

    public interface IPersistenceBroker

    {

            [Requires("criteria != null")]

        PersistentObject RetrieveObject(Criteria criteria);

            [Requires("persistentObject != null")]

            [Ensures("$before(persistentObject) ==

                $after(persistentObject)")]

            [Ensures("persistentObject.IsPersistent == true")]

            [Ensures("(persistentObject.TimeStamp - DateTime.Now) < new TimeSpan($time_ms)")&#93;

            &#91;Ensures("$result != null")&#93;

            &#91;Ensures("$result.Count == 0")&#93;

        IList SaveObject(PersistentObject persistentObject);

            &#91;Requires("persistentObject != null")&#93;

            &#91;Ensures("$before(persistentObject) ==

              $after(persistentObject)")&#93;

            &#91;Ensures("$result != null")&#93;

            &#91;Ensures("$result.Count == 0")&#93;

            &#91;Ensures("persistentObject.IsPersistent == false")&#93;

        IList DeleteObject(PersistentObject persistentObject);

            &#91;Requires("criteria != null")&#93;

            &#91;Requires("criteria.ForClass != null")&#93;

            &#91;Ensures("$result != null")&#93;

            &#91;Ensures("$result.Count >= 0")]

        IList ProcessCriteria(Criteria criteria);

            [Requires("persistentObject != null")]

            [Ensures("$before(persistentObject) ==

              $after(persistentObject)")]

            [Ensures("$result != null")]

            [Ensures("$result.Name != persistentObject.

                GetType().Name")]

        ClassMap GetClassMapFor(PersistentObject persistentObject);

            [Requires("tableMap != null")]

            [Ensures("$result != null")]

            [Ensures("$result.Count >= 0")]

        IList GetReferrersTo(TableMap tableMap);

            [Requires("persistentObject != null")]

            [Ensures("$result != null")]

            [Ensures("$result.Count >= 0")]

        IList GetLinkedClassMaps(PersistentObject persistentObject);

            [Requires("classMap != null")]

            [Ensures("$result != null")]

            [Ensures("$result.Count >= 0")]

        IList GetLinkedClassMaps(ClassMap classMap);

            [Requires("classMap != null")]

            [Requires("propertyName != null")]

            [Requires("propertyName.Length > 0")]

            [Ensures("$result != null")]

            [Ensures("$result.Count >= 0")]

        IList IncomingConnectionsToAttribute(ClassMap classMap,

           string propertyName);

            [Requires("procedureName != null")]

            [Requires("procedureName.Length > 0")]

            [Requires("type != null")]

            [Requires("databaseName != null")]

            [Requires("databaseName.Length > 0")]

            [Requires("parameters != null")]

            [Requires("parameters.Count >= 0")]

            [Ensures("$result != null")]

            [Ensures("$result.Count >= 0")]

        IList ProcessStoredProcedure(string procedureName,

            Type type, string databaseName,

            NameValueCollection parameters);

            [Requires("procedureName != null")]

            [Requires("procedureName.Length > 0")]

            [Requires("type != null")]

            [Requires("databaseName != null")]

            [Requires("databaseName.Length > 0")]

            [Requires("parameters != null")]

            [Requires("parameters.Count >= 0")]

            [Ensures("$result != null")]

        string ProcessStoredProcedureRaw(string procedureName,

            Type type, string databaseName,

            NameValueCollection parameters);

        bool ProcessTransaction();

    }

}