AdFactum ObjectMapper .NET Blog

Official blog of the AdFactum ObjectMapper .NET

Archive for March, 2008

New Release – AdFactum ObjectMapper .NET 2.3.2619.0

Posted by Gerhard Stephan on 19th March 2008

This Release is a pure bug fixing Realease. It covers three major bug fixes.

At first, it fixes a memory leak that occures when calling the Method "BaseCache.ClearAllCaches". Because this is not obvious for all users, I have to explain that this method has been called every time the ObjectMapper class has been initialized with a version information greater than zero.

The second fix is a multithreading bug that causes the mapper to throw unmotivated Exceptions, like "NoPrimaryKeyFound" Exception and "CollectionHasBeenModified" Exception. But this only occured when using the ObjectMapper .NET in a strongly multithreaded environment.

The last fix, fixed the update and delete sql statements of dictionary types (e.g. SortedList and Hashtable). Due to that the link table had a wrong primary key definition and that caused the update of the link table to fail.

Hope you enjoy the new version.

Cheers
– Gerhard

Posted in Releases | No Comments »

Attribute: [Unicode]

Posted by Gerhard Stephan on 7th March 2008

For all databases that supports Unicode (e.g. Oracle and Microsoft SQL Server),  a string property can be tagged with the [Unicode] attribute. The AdFactum ObjectMapper .NET does therefore use the Unicode Data Types for the specific property.

Below you’ll find all supported datatypes that can be used with the Unicode attribute.

    public class UnicodeTestEntity : ValueObject

    {

        private char unicodeChar;

        private string unicodeString;

        private string unicodeMemo;

 

        /// <summary>

        /// Gets or sets the unicode char.

        /// </summary>

        /// <value>The unicode char.</value>

        [Unicode]

        public char UnicodeChar

        {

            get { return unicodeChar; }

            set { unicodeChar = value; }

        }

 

        /// <summary>

        /// Gets or sets the unicode string.

        /// </summary>

        /// <value>The unicode string.</value>

        [Unicode]

        [PropertyLength(30)]

        public string UnicodeString

        {

            get { return unicodeString; }

            set { unicodeString = value; }

        }

 

        /// <summary>

        /// Gets or sets the unicode memo.

        /// </summary>

        /// <value>The unicode memo.</value>

        [Unicode]

        [PropertyLength(int.MaxValue)]

        public string UnicodeMemo

        {

            get { return unicodeMemo; }

            set { unicodeMemo = value; }

        }

    }

 

 

Posted in Attributes | No Comments »

Attribute: [GroupBy]

Posted by Gerhard Stephan on 7th March 2008

The [GroupBy] attribute can be used to group properties by there value. This property can only be used in projection classes.

    /// <summary>

    /// Groups the time entries by their project id

    /// </summary>

    public class TimeEntryGrouping

    {

        private DateTime minDate;

        private string project;

 

        /// <summary>

        /// Gets or sets the min date.

        /// </summary>

        /// <value>The first date.</value>

        [ProjectOntoProperty(typeof(TimeEntry), "StartDate")]

        [Min]

        public DateTime MinDate

        {

            get { return minDate; }

            set { minDate = value; }

        }

 

        /// <summary>

        /// Gets or sets the project.

        /// </summary>

        /// <value>The project.</value>

        [ProjectOntoProperty(typeof(TimeEntry), "ProjectId")]

        [GroupBy]

        public string Project

        {

            get { return project; }

            set { project = value;  }

        }

    }

 

Select the grouping:

 

                List<TimeEntryGrouping> result =

                    new List<TimeEntryGrouping>(

                        new ListAdapter<TimeEntryGrouping>(

                    mapper.FlatSelect(typeof(TimeEntryGrouping))));

 

Posted in Attributes | No Comments »

Attribute: [Avg], [Count], [First], [Last], [Max], [Min] and [Sum]

Posted by Gerhard Stephan on 7th March 2008

This aggregation attributes can be placed on any projection property of a projection class.

    public class TimeEntryAggregation

    {

        private DateTime minDate;

 

        /// <summary>

        /// Gets or sets the min date.

        /// </summary>

        /// <value>The first date.</value>

        [ProjectOntoProperty(typeof(TimeEntry), "StartDate")]

        [Min]

        public DateTime MinDate

        {

            get { return minDate; }

            set { minDate = value; }

        }

    }

    var minTimeEntry = mapper.Load(typeof(TimeEntryAggregation), null as ICondition) as TimeEntryAggregation;

 
The following attributes can be used this way:

  • [Avg] 
  • [Count]
  • [First], [Last]
  • [Min], [Max]
  • [Sum]

Posted in Attributes | No Comments »

New Release – AdFactum ObjectMapper .NET 2.3.2607.0

Posted by Gerhard Stephan on 7th March 2008

Today, the AdFactum ObjectMapper .NET reaches the next evolution level – hmm – I mean: the next release. But without joking, it’s a big step to a full integrated LINQ support and a big step further to complete the base functionality of the AdFactum ObjectMapper .NET.

First I implemented the base aggregation functions like Min, Max, First, Last, Sum and Count and grouping functionality with using the GroupBy Clause. This functionality can be used with projection classes or directly using the new Linq Syntax. The only thing that is still missing, is the Having Clause which caused me a lot of headache. But I’m confident that I can implement that feature in the next release.

As a second new feature, the AdFactum ObjectMapper .NET now offers Unicode support for Oracle and Microsoft SQL Server. To use this new feature, the properties must be tagged with an [Unicode] attribute.

Hope you enjoy the new version.

Cheers
– Gerhard

Posted in Releases | No Comments »