private static Version GetTenantVersion()
{
using (SqlConnection conn = SQLAzureUtilities.GetActiveSqlConnection())
using (SqlCommand cmd = conn.CreateCommand())
{
conn.Open();
cmd.CommandText = "GetTenantVersion";
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter name = cmd.Parameters.Add("@Name", SqlDbType.NVarChar);
name.Value = sPContext.SPHostUrl.ToString();
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.HasRows)
{
reader.Read();
return new Version(reader["Version"].ToString());
}
else
throw new Exception("Unknown tenant: " + sPContext.SPHostUrl.ToString());
}
}//dispose conn and cmd
}