private string CreateScriptLocator(string connectionString, string scriptId) { var scriptKey = new ScriptIdentityKey(connectionString, Guid.Parse(scriptId), this.Name, this.Host.GetHostname()); return scriptKey.ScriptLocator(); }
public override object GetDetails(string moniker) { if(string.IsNullOrWhiteSpace(moniker)) { throw new ArgumentNullException("moniker"); } var monikerData = new ScriptIdentityKey(moniker); var settings = this.GetConnectionStringSettings(monikerData.ConnectionString); if(settings != null) { var connString = settings.ConnectionString; var details = new Script(); using(var connection = new SqlConnection(connString)) { connection.Open(); using(var command = new SqlCommand()) { command.Connection = connection; command.CommandType = System.Data.CommandType.StoredProcedure; command.CommandText = "GetDetails"; command.Parameters.Add(new SqlParameter("Id", monikerData.ScriptId)); var reader = command.ExecuteReader(System.Data.CommandBehavior.CloseConnection); if(reader.Read()) { details.Author = reader["Author"].ToString(); details.Source = GetDBName(connString); details.Description = reader["Description"].ToString(); details.Organization = reader["Organization"].ToString(); details.PublishedDate = DateTime.Parse(reader["PublishedDate"].ToString(), CultureInfo.CurrentCulture); details.Raters = int.Parse(reader["Raters"].ToString(), CultureInfo.CurrentCulture); details.Rating = double.Parse(reader["Rating"].ToString(), CultureInfo.CurrentCulture); details.ScriptCode = reader["ScriptCode"].ToString(); details.SupportedPlatform = reader["SupportedPlatform"].ToString(); details.Tags = reader["Tags"].ToString(); details.Disclaimer = Properties.Resources.DatabaseDisclaimer; details.Link = reader["Id"].ToString(); details.ContentType = Microsoft.iX.AggregationService.Entities.Constants.Entity; } return details; } } } return null; }