Example #1
0
        private void AddFileDescription(DatabaseFileType type, DatabaseConnectionOptions server, DatabaseFileOptions option, StringBuilder sqlCommand)
        {
            var databasename  = GetDatabaseName(type, server.DatabaseName);
            var initString    = ConstantsMsSql.ON;
            var fileExtension = ConstantsMsSql.FILE_EXTENSION_MDF;
            var path          = option.FilePath.SetValidDirectoryPathEnd();

            if (type == DatabaseFileType.Log)
            {
                initString    = $"{ConstantsMsSql.LOG} {initString}";
                fileExtension = ConstantsMsSql.FILE_EXTENSION_LDF;
            }

            sqlCommand.AppendLine(initString);
            sqlCommand.AppendLine("(");
            sqlCommand.Append(JoinStatement(ConstantsMsSql.NAME, databasename));
            sqlCommand.AppendLine(",");
            sqlCommand.AppendLine(JoinStatement(ConstantsMsSql.FILENAME, $"{path}{databasename}{fileExtension}"));

            CheckOption(ConstantsMsSql.SIZE, option.Size, sqlCommand);
            CheckOption(ConstantsMsSql.MAXSIZE, option.MaxSize, sqlCommand);
            CheckOption(ConstantsMsSql.FILEGROWTH, option.FileGrowth, sqlCommand);

            sqlCommand.AppendLine();
            sqlCommand.AppendLine(")");
        }
Example #2
0
 /// <summary>
 /// Creates a deep copy of the passed object.
 /// </summary>
 /// <param name="old">A <b>Database Instance File</b> object to create the deep copy from.</param>
 private void CopyMembers(DatabaseInstanceFile old)
 {
     this.databaseFileType = old.databaseFileType;
     this.logicalName      = old.logicalName;
     this.filename         = old.filename;
     this.allocatedSpace   = old.allocatedSpace;
     this.usedSpace        = old.usedSpace;
     this.reservedSpace    = old.reservedSpace;
 }
Example #3
0
 /// <summary>
 /// Initializes member variables to their initial values.
 /// </summary>
 /// <remarks>
 /// This function is called by the contructors.
 /// </remarks>
 private void InitializeMembers()
 {
     this.databaseFileType = DatabaseFileType.Unknown;
     this.logicalName      = string.Empty;
     this.filename         = string.Empty;
     this.allocatedSpace   = 0;
     this.usedSpace        = 0;
     this.reservedSpace    = 0;
 }
        /// <summary>
        /// Initializes member variables to their initial values.
        /// </summary>
        /// <remarks>
        /// This function is called by the contructors.
        /// </remarks>
        private void InitializeMembers()
        {
            base.EntityType = EntityType.DatabaseInstanceFile;
            base.EntityGroup = EntityGroup.Layout;

            this.databaseFileType = DatabaseFileType.Unknown;
            this.logicalName = string.Empty;
            this.filename = string.Empty;
            this.allocatedSpace = 0;
            this.usedSpace = 0;
            this.reservedSpace = 0;
        }
 /// <summary>
 /// Creates a deep copy of the passed object.
 /// </summary>
 /// <param name="old">A <b>Database Instance File</b> object to create the deep copy from.</param>
 private void CopyMembers(DatabaseInstanceFile old)
 {
     this.databaseFileType = old.databaseFileType;
     this.logicalName = old.logicalName;
     this.filename = old.filename;
     this.allocatedSpace = old.allocatedSpace;
     this.usedSpace = old.usedSpace;
     this.reservedSpace = old.reservedSpace;
 }
Example #6
0
 private string GetDatabaseName(DatabaseFileType type, string database)
 {
     return(type == DatabaseFileType.Log ? $"{database}_log" : database);
 }