Class PrimaveraDbSettings

PrimaveraDbSettings class

Allows to set necessary options to read project data from Primavera database.

public class PrimaveraDbSettings : DbSettings

Constructors

NameDescription
PrimaveraDbSettings(string, int)Initializes a new instance of the PrimaveraDbSettings class.

Properties

NameDescription
ConnectionString { get; set; }Gets or sets the connection string.
ProjectId { get; }Gets id of the project to read.
ProviderInvariantName { get; set; }Gets or sets provider invariant name which is used to get an instance of the DbProviderFactory class. Default value is SqlClient.

Examples

Shows how to import a project from a Primavera database.

var sb = new SqlConnectionStringBuilder();
sb.DataSource = "192.168.56.3,1433";
sb.Encrypt = true;
sb.TrustServerCertificate = true;
sb.InitialCatalog = "PrimaveraEDB";
sb.NetworkLibrary = "DBMSSOCN";
sb.UserID = "privuser";
sb.Password = "***";

// Initialize a new instance of the PrimaveraDbSettings class with connection string and project id
var settings = new PrimaveraDbSettings(sb.ConnectionString, 4502);

Console.WriteLine("Project UID to read: " + settings.ProjectId);

// read the project with UID = 4502
var project = new Project(settings);
Console.WriteLine(project.Get(Prj.Uid));

See Also