public CreateDatabaseOptions(string databaseName, DbFileOptions dataFileOptions, DbFileOptions logFileOptions)
        {
            Guard.NotNullNorEmpty(databaseName, "databaseName");

            if (logFileOptions != null && dataFileOptions == null)
            {
                throw  new ArgumentException("Must specify dataFileOptions to set logFileOptions");
            }

            DatabaseName    = databaseName;
            DataFileOptions = dataFileOptions;
            LogFileOptions  = logFileOptions;
        }
Ejemplo n.º 2
0
        public CreateDatabaseOptions(string databaseName, DbFileOptions dataFileOptions, DbFileOptions logFileOptions)
        {
            Guard.NotNullNorEmpty(databaseName, "databaseName");

              if (logFileOptions != null && dataFileOptions == null)
              {
            throw  new ArgumentException("Must specify dataFileOptions to set logFileOptions");
              }

              DatabaseName = databaseName;
              DataFileOptions = dataFileOptions;
              LogFileOptions = logFileOptions;
        }
        private CreateDatabaseOptions BuildCreateDatabaseOptions()
        {
            if (string.IsNullOrEmpty(_databaseServer.DataDirPath))
              {
            return new CreateDatabaseOptions(_projectInfo.DbName);
              }

              string dataFileName = string.Format("{0}.mdf", _projectInfo.DbName);
              string dataFilePath = Path.Combine(_databaseServer.DataDirPath, dataFileName);
              var dataFileOptions = new DbFileOptions(_projectInfo.DbName, dataFilePath);

              DbFileOptions logFileOptions = null;

              if (!string.IsNullOrEmpty(_databaseServer.LogDirPath))
              {
            string logName = string.Format("{0}_log", _projectInfo.DbName);
            string logFileName = string.Format("{0}_log.ldf", _projectInfo.DbName);
            string logFilePath = Path.Combine(_databaseServer.LogDirPath, logFileName);
            logFileOptions = new DbFileOptions(logName, logFilePath);
              }

              return new CreateDatabaseOptions(_projectInfo.DbName, dataFileOptions, logFileOptions);
        }