SourceProfile class | QSYS API Reference Guide

Estimated reading time: 15 minutes

The SourceProfile class represents a profile in the source system.

Namespace: ASNA.DataGate.Providers Assembly: ASNA.QSys.DataGate.Client.dll

Inheritance: Object

Remarks

This class is used to map the profile data from the source system to the target system.



Constructors

Name Description
SourceProfile() Initializes a new instance of the class with default values.
SourceProfile(SourceProfile) Initializes a new instance of the class with the specified source profile.

SourceProfile()

Initializes a new instance of the class with default values.

SourceProfile()

SourceProfile(SourceProfile)

Initializes a new instance of the class with the specified source profile.

SourceProfile(SourceProfile)

Parameters

Type Parameter name Description
SourceProfile sp The source profile to initialize the new instance with.

Properties

Type Name Description
ITransformProperties AltDecoderProps Gets or sets the alternative decoder properties for the source profile.
ITransformProperties AltEncoderProps Gets or sets the alternative encoder properties for the source profile.
String AltEncodingName Alternative character encoding string identifiers must becase-insensitive in the invariant culture.
IDataGateCredential Credential Gets or sets the credentials for the source profile.
String DGPLATFORM Constant for the DataLink platform attribute.
IEnumerable<String> InitialLibraryList Get or Set initial library list
Boolean IsSqlClientPlatform Gets a value indicating whether the platform attribute of the source profile is SQL Client-based.
Boolean IsSqlPlatform Gets a value indicating whether the platform attribute of the source profile is SQL-based.
String Label Get or Set label name
String PlatformAttribute Gets or sets the platform attribute for the source profile.
Byte PoolingTimeout Gets or sets the pooling timeout for the source profile.
Int32 Port Gets or sets the port for the source profile.
String Server Get or Set server name
String ServicePrincipalName Gets or sets the Service Principal Name (SPN) for the source profile.
String SQLCLIENTPLATFORM Constant for the SQL Client platform attribute.
String SQLOLEDBPLATFORM Constant for the SQL OLE DB platform attribute.
String SslCertificateName Gets or sets the SSL certificate name for the source profile.
SslOptions SslOptions Gets or sets the SSL options for the source profile.
String Text Gets or sets the text associated with the source profile.

Methods

Signature Description
Clone() Creates a new object that is a copy of the current instance.
Equals(SourceProfile) Determines whether the current instance of is equal to the specified instance.
Equals(Object) Determines whether the current instance of is equal to the specified instance.
Equals(Object, Boolean) Determines whether the current instance of is equal to the specified object.
GetHashCode() Serves as the default hash function.
IsKnownPlatformAttribute(String) Determines whether the provided platform attribute is a known platform attribute.
op_Equality(SourceProfile, SourceProfile) Determines whether two instances of are equal.
op_Inequality(SourceProfile, SourceProfile) Determines whether two instances of are not equal.
ToString() Returns a string that represents the current SourceProfile.

object Clone()

Creates a new object that is a copy of the current instance.

Remarks

This method is used to create a copy of the current instance of the SourceProfile class. The copy is made by calling the Copy method with a new instance of the SourceProfile class and the current instance as parameters.

object Clone()

bool Equals(SourceProfile other)

Determines whether the current instance of is equal to the specified instance.

Remarks

This method is used to compare the current instance with another instance of the SourceProfile class. The comparison is based on the properties of the instances.

bool Equals(SourceProfile other)

Parameters

Type Parameter name Description
SourceProfile other The instance to compare with the current instance.

Returns

Type Description
Boolean True if the current instance is equal to the specified instance; otherwise, false.

bool Equals(object other)

Determines whether the current instance of is equal to the specified instance.

bool Equals(object other)

Parameters

Type Parameter name Description
Object other The instance to compare with the current instance.

Returns

Type Description
Boolean True if the current instance is equal to the specified instance; otherwise, false.

bool Equals(object obj, bool bIgnoreDatabaseName)

Determines whether the current instance of is equal to the specified object.

Remarks

This method is used to compare the current instance with another object of the same type. If the bIgnoreDatabaseName parameter is set to true, the comparison will ignore the database name.

bool Equals(object obj, bool bIgnoreDatabaseName)

Parameters

Type Parameter name Description
Object obj The object to compare with the current instance.
Boolean bIgnoreDatabaseName A boolean value that indicates whether to ignore the database name in the comparison.

Returns

Type Description
Boolean True if the current instance is equal to the specified object; otherwise, false.

int GetHashCode()

Serves as the default hash function.

Remarks

This method is used to generate a hash code for the current instance of the SourceProfile class. It takes into account all the properties of the class to generate a unique hash code.

int GetHashCode()

bool IsKnownPlatformAttribute(string platformAttr)

Determines whether the provided platform attribute is a known platform attribute.

Remarks

This method is used to validate that the platform attribute provided is one that the system recognizes and can handle.

bool IsKnownPlatformAttribute(string platformAttr)

Parameters

Type Parameter name Description
String platformAttr The platform attribute to check.

Returns

Type Description
Boolean True if the provided platform attribute is a known platform attribute; otherwise, false.

bool op_Equality(SourceProfile x, SourceProfile y)

Determines whether two instances of are equal.

bool op_Equality(SourceProfile x, SourceProfile y)

Parameters

Type Parameter name Description
SourceProfile x The first instance to compare.
SourceProfile y The second instance to compare.

Returns

Type Description
Boolean True if the instances are equal; otherwise, false.

bool op_Inequality(SourceProfile x, SourceProfile y)

Determines whether two instances of are not equal.

bool op_Inequality(SourceProfile x, SourceProfile y)

Parameters

Type Parameter name Description
SourceProfile x The first instance to compare.
SourceProfile y The second instance to compare.

Returns

Type Description
Boolean True if the instances are not equal; otherwise, false.

string ToString()

Returns a string that represents the current SourceProfile.

Remarks

This method overrides the base ToString method and provides a string representation of the SourceProfile, typically including key properties of the SourceProfile for debugging or logging purposes.

string ToString()

Example 1. Most simple constructor.

  /* Opens the database "*PUBLIC/DG NET iSeries" and changes the user
   * name and password. */
  SourceProfile sp = new SourceProfile("*PUBLIC/DG NET iSeries");
  sp.User = "NewUser";
  sp.Password = "NewPassword";
  sp.Register(); /* Updates the information. */

Example 2. Using Constructor using an existing Source Profile.

  /* This creates a brand new database name using the
   * old source profile.*/
  SourceProfile newDbProfile2 = new SourceProfile("Brand New DB Name", sp);

Example 3. Using Constructor bypassing Registry.

  /* When we specify false with this constructor, we're
   * telling Datagate not to get information from the
   * registry. Thus we can use it to create an entirely
   * new database name. */
  SourceProfile newDbProfile = new SourceProfile("New database", false);
  newDbProfile.Server = "valid ip address";
  newDbProfile.User = "User1";
  newDbProfile.Password = "password"; /* Note- not very secure. */
  newDbProfile.Port = 5047;
  newDbProfile.PoolingTimeout = 0;
  newDbProfile.PlatformAttribute = "*DATALINK";
  newDbProfile.Text = "New database at valid ip address, on port 5047.";
  /* Register the database name. */
  newDbProfile.Register();

Example 4. Unregistering a Database Profile

  /* Open up and unregistered the database profile "Worthless Db". */
  try
  {
      SourceProfile.Unregister("Worthless Db");
  }
  catch(dgException)
  {
      MessageBox.Show("\"Worthless DB\" is not a 
            registered database profile.",
          "Could not unregister.");
      return;
  }

Example 5. Getting a List of Database Names

  /* This code displays all of the *PUBLIC database
   * names, along with their descriptive text, to the list view
   * "lvDbNames" whose view is set to "View.Details". */
  ListViewItem newItem;
  SourceProfile currentProfile;
  foreach(string name in SourceProfile.GetNames(true))
  {
      currentProfile = new SourceProfile(name);
      newItem = new ListViewItem(currentProfile.DatabaseName);
      newItem.SubItems.Add(currentProfile.Text);
      lvDbNames.Items.Add(newItem);
  }

Example 6. Use of Server property.

  /* The code below updates a database profile to use a different IP address. */
  SourceProfile sp = new SourceProfile("CustomerDB");
  sp.Server = "555.93.279.303";
  sp.Register(); /* Save changes. */

Example 7. Updating User and password, and then saves the changes by calling Register.

  /* When we specify false with this constructor, we're
   * telling Datagate not to get information from the
   * registry. Thus we can use it to create an entirely
   * new database name. */
  SourceProfile newDbProfile = new SourceProfile("New database", false);
  newDbProfile.Server = "valid ip address";
  newDbProfile.User = "User1";
  newDbProfile.Password = "password"; /* Note- not very secure. */
  newDbProfile.Port = 5047;
  newDbProfile.PoolingTimeout = 0;
  newDbProfile.PlatformAttribute = "*DATALINK";
  newDbProfile.Text = "New database at valid ip address, on port 5047.";
  /* Register the database name. */
  newDbProfile.Register();

Example 8. Using the PoolingTimeout property.

  /* Connect using the already established database name 
   * "*PUBLIC/DG NET iSeries" but use a different idle
   * timeout time. */
  SourceProfile sp = new SourceProfile("*PUBLIC/DG NET iSeries");
  sp.PoolingTimeout = 10;
  AdgConnection database = new AdgConnection(sp);

Example 9. Using the Platform property.

  /* Register the database name "My Local" to specify the local database. */
  SourceProfile newDbProfile = new SourceProfile("My Local", false);
  newDbProfile.Server = "*LOCAL";
  newDbProfile.User = "User1";
  newDbProfile.Password = "password"; /* Note- not very secure. */
  newDbProfile.Label = "DG 7 Database";
  newDbProfile.PoolingTimeout = 0;
  /* Specify *DATALINK since we're connecting to the datagate engine. */
  newDbProfile.PlatformAttribute = "*DATALINK";
  newDbProfile.Text = "New database at valid ip address, on port 5047.";
  /* Register the database name. */
  newDbProfile.Register();

Example 10. Using the PasswordType property.

  /* Connect using the already established database name 
   * "*PUBLIC/DG NET iSeries" but use a different
   * username and password. */
  SourceProfile sp = new SourceProfile("*PUBLIC/DG NET iSeries");
  sp.User = "NewUser";
  sp.Password = "NewPassword";
  sp.PasswordType = "Legacy";
  AdgConnection database = new AdgConnection(sp);

Example 11. Using the Label property.

  /* Register the database name "My Local" to specify the local database.
   * Because the local database is a Windows DataGate server, 
   * you need to include a valid label as well. */
  SourceProfile newDbProfile = new SourceProfile("My Local", false);
  newDbProfile.Server = "*LOCAL";
  newDbProfile.User = "User1";
  newDbProfile.Password = "password"; /* Note- not very secure. */
  newDbProfile.Label = "DG 7 Database";
  newDbProfile.PoolingTimeout = 0;
  /* Specify *DATALINK since we're connecting to the datagate engine. */
  newDbProfile.PlatformAttribute = "*DATALINK";
  newDbProfile.Text = "New database at valid ip address, on port 5047.";
  /* Register the database name. */
  newDbProfile.Register();

Example 12. Changing the Initial Library List.

  /* This code will update the database name "SalesDB" to include
   * "IMPORTS" in its library list. */
  SourceProfile sp = new SourceProfile("SalesDB");
  string[] newList = new string[sp.InitialLibl.Length + 1];
  int i;
  for (i = 0; i< sp.InitialLibl.Length; i ++)
  {
      newList[i] = sp.InitialLibl[i];
  }
  newList[i] = "IMPORTS";
  sp.InitialLibl = newList;
  sp.Register();

Example 13. Loading a ComboBox with Database Names.

  /* This code will fill a combo box with all of the available database
   * names. */
  foreach(string name in SourceProfile.GetNames(true)) /* Get *PUBLIC databases. */
      cbDbName.Items.Add(name); /* NOTE: The names appear without the "*PUBLIC/" prefix. */
  foreach(string name in SourceProfile.GetNames(false)) /* Get non public databases. */
      cbDbName.Items.Add(name);