Click here to Skip to main content
15,885,537 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
I have Image Name in Database without extension like below

Database Entry
---------------> Blob
1_1 -----------------------> 1_1.jpg
1_2 -----------------------> 1_2.png
1_3 -----------------------> 1_3.jpg
1_4 -----------------------> 1_4.png


In database I have no Image Extension. I want to find particular image from blob.
below is my code it compare with every image if 1-1 and 1-1(blob remove extension from 1-1.jpg)
match then return blob url. So it is time consuming.

I want to return image without for loop return using Linq Query with comapare condition.
so please give me linq query regarding this issue.

Plase help me for performance purpose.

Below is my code just for help.

Thanks.
C#
public static string searchImageFromBlob(string intBLOBID, string strDataConnectionString, string strContainerName)
    {

     <   Microsoft.WindowsAzure.StorageClient.CloudBlobClient _BlobClient = null;
        var storageAccount = Microsoft.WindowsAzure.CloudStorageAccount.FromConfigurationSetting(strDataConnectionString);
        _BlobClient = storageAccount.CreateCloudBlobClient();

        Microsoft.WindowsAzure.StorageClient.CloudBlobContainer container = _BlobClient.GetContainerReference(strContainerName);
        if (container != null)
        {
            
            foreach (var properties in container.ListBlobs())
            {
                //litFeatureImage.Text = "";
                var blob = properties.Container.GetBlobReference(properties.Uri.ToString());
                if (intBLOBID == RemoveFileExtension(blob.Uri.Segments[2]))
                    return blob.Uri.ToString();

            }
        }


        return "";
    }
Posted
Updated 31-Jul-14 9:42am
v5

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900