Print Page | Close Window

Can synthetic properties be used in OQL (Object Query Language)?

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=190
Printed Date: 30-Mar-2025 at 8:52pm


Topic: Can synthetic properties be used in OQL (Object Query Language)?
Posted By: Customer
Subject: Can synthetic properties be used in OQL (Object Query Language)?
Date Posted: 12-Jul-2007 at 3:07pm

The table has columns ActualStartTime, AdjustedStartTime, ActualFinishTime and AdjustedFinishTime.

 
We added properties JobStartTime and JobFinishTime to the table entity (see the following code).
 
Can JobStartTime and JobFinishTime be used in OQL?
If not, can we write an OQL based on database that provide the same results?
 
     ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' JobStartTime, ActualStartTime otherwise AdjustedStartTime if actual not available
    ''' </summary>
    ''' ----------------------------------------------------------------------------
    Public ReadOnly Property JobStartTime() As Date
        Get
            Dim aJobStartTime As Date
            Try
                If Me.ActualStartTime.HasValue Then
                    aJobStartTime = Me.ActualStartTime.Value
                Else
                    aJobStartTime = Me.AdjustedStartTime.Value
                End If
            Catch
                aJobStartTime = Nothing
            End Try
            Return (aJobStartTime)
        End Get
    End Property
 
    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' JobFinishTime, ActualFinishTime otherwise AdjustedFinishTime if actual not available
    ''' </summary>
    ''' ----------------------------------------------------------------------------
    Public ReadOnly Property JobFinishTime() As Date
        Get
            Dim aJobFinishTime As Date
            Try
                If Me.ActualFinishTime.HasValue Then
                    aJobFinishTime = Me.ActualFinishTime.Value
                Else
                    aJobFinishTime = Me.AdjustedFinishTime.Value
                End If
            Catch
                aJobFinishTime = Nothing
            End Try
            Return (aJobFinishTime)
        End Get
    End Property



Replies:
Posted By: IdeaBlade
Date Posted: 12-Jul-2007 at 3:07pm
This would be a great feature to have, but unfortunately it is extremeful difficult to implement as the database doesn't understand synthetic, and because the query needs to behave properly in a variety of different environments including Cache only, Database only, and Cache and Database).
 
Sometimes, you can make on OQL query by translating the query to use only database properties.  For example, if I want all employees only than 30 years old, I can ask for all empluees born after March 14, 1977.
 
In other cases.  I can load some subset of entities into the cache, and filter the entities in the cache.



Print Page | Close Window