private bool CheckDataFactoryExists(string resourceGroupName, string dataFactoryName, out PSDataFactory dataFactory)
{
dataFactory = null;
// ToDo: use HEAD to check if a resource exists or not
try
{
dataFactory = GetDataFactory(resourceGroupName, dataFactoryName);
return true;
}
catch (CloudException e)
{
//Get throws NotFound exception if data factory not exists
if (e.Response.StatusCode == HttpStatusCode.NotFound)
{
return false;
}
throw;
}
}