Click or drag to resize
XConnection Class
This class encapsulate a TConnection instance. A few maps are also created, to embed the original DataLayoutMap, TableDefMap and FieldDefMap
Inheritance Hierarchy
SystemObject
  Biolomics.BioCallbackXConnection

Namespace:  Biolomics.BioCallback
Assembly:  Biolomics.BioCallback (in Biolomics.BioCallback.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public class XConnection

The XConnection type exposes the following members.

Constructors
  NameDescription
Public methodXConnection
Initializes a new instance of the XConnection class.
Top
Properties
  NameDescription
Public propertyDatabaseName
Gets the name of the database.
Public propertyDataLayoutMap
Gets or sets the DataLayoutMap in the current connection.
Public propertyDbWorldId
Gets the DbWorldId : the unique identifier of the database.
Public propertyRootName
Gets the name of the root user in the database.
Top
Methods
  NameDescription
Public methodCanChangeHeaderInTable
Determines whether this instance can change header in the specified table .
Public methodCanDeleteFromTable
Determines whether this instance can delete from the specified table .
Public methodCanReadField
Determines whether this instance can read the specified field .
Public methodCanReadFromTable
Determines whether this connection can read from specified table.
Public methodCanWriteAllFieldsIntoTable
Determines whether this instance can write all fields into the specified table key.
Public methodCanWriteField
Determines whether this instance can write the specified field .
Public methodCanWriteIntoTable
Determines whether this instance can write into the specified table .
Public methodConnect
Connect to current database.
Public methodConnectionDef
Gets the Connection definition.
Public methodCurrentUserEmail
Gets the current user email.
Public methodCurrentUserName
Gets the current user name.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodFieldDefMap
Gets the FieldDefMap in the current connection.
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetFieldByDbName
Gets the field by db name.
Public methodGetFieldByUserName
Gets the field definition by user name.
Public methodGetFieldByUserNameEng
Gets the field by user name eng.
Public methodGetFieldDef(Int64)
Gets the field definition by field key.
Public methodGetFieldDef(Int64, String)
Gets the field definition by field Sql name.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetLayout
Gets the layout by layout key.
Public methodGetTableDef
Gets the table definition.
Public methodGetTableDefByDbName
Gets the table definition by Table SQL name.
Public methodGetTableDefByUserName
Gets the table definition by Table user name.
Public methodGetTableDefByUserNameEng
Gets the table definition by user name english.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetUserDef
Gets the user definition.
Public methodGroupDefMap
Gets the GroupDefMap in the current connection.
Public methodIsAdmin
Determines whether this user is admin.
Public methodIsConnected Obsolete.
Determines whether the current user is connected.
Public methodIsReachable
Determines whether this connection is reachable.
Public methodKey
Gets the Connection key.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodReadFastQuery
Same as ReadQuery just it is used to load fast queries with small timeout.
Public methodReadQuery
Executes a TQuery to load some records Used to load records or execute some specific queries.
Public methodTableDefMap
Gets the TableDefMap in the current connection.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Examples
Each record header contains some information, like the record name, creation date, last modification date, owner name. The last field is called "Details" and can contain any information. The example below will set the Details field.
Example VB.Net
Imports System
Imports BioloMICS.BioCallback
Imports BioloMICS.SharedClasses

Public Class Program

    <STAThread()>
    Shared Sub Main()
        Dim c As New Program
        c.ChangeRecordDetails()
    End Sub

    '    Write sub functions here
    Public Sub ChangeRecordDetails()
        '    get the current connection
        Dim SqlCo As XConnection = Run.GetCurrentConnection()
        If SqlCo Is Nothing Then
            Return
        End If

        '    get the current layout
        Dim Layout As XDataLayout = Run.GetCurrentLayout()
        If Layout Is Nothing Then  '    no current layout in a search page
            Return
        End If

        '    get the current table 
        Dim TableDef As XTableDef = SqlCo.GetTableDef(Layout.TableKey)
        If TableDef Is Nothing Then   '    should never happen
            Return
        End If
        '    load all records
        Dim Where As XWhere = XWhere.All
        '    use an empty FieldDefMap
        Dim FieldDefMap As New XFieldDefMap
        '    load the records
        Dim RecordMap As XRecordMap = Run.LoadRecords(TableDef.Key, FieldDefMap, Where)

        For Each Record As XRecord In RecordMap
            '    change the record details, located in the record header
            Record.Details = "This is record #" & Record.Id.ToString
            Record.Save(False)
        Next

        '    load the records second methode
        Dim newRecordMap As New XRecordMap
        Run.LoadRecords(newRecordMap, TableDef.Key, FieldDefMap, Where)

        For Each Record As XRecord In newRecordMap
            '    change the record details, located in the record header empty string instead of old value
            Record.Details = String.Empty
            Record.Save(False)
        Next

    End Sub

End Class
See Also