コード例 #1
0
        public ImagesController(AzureToolkitContext context)
        {
            _context = context;

            // Get a reference to a container named "sample-container" and then create it
            this._container = new BlobContainerClient(ConnectionString, ContainerName);
        }
コード例 #2
0
        public void ImagesControllerTest()
        {
            AzureToolkitContext context = GetAzureToolkitContext();
            var controller = new ImagesController(context);

            Assert.IsNotNull(controller);
        }
コード例 #3
0
        private static AzureToolkitContext GetAzureToolkitContext()
        {
            var connection     = @"Server=tcp:azuretoolkit-oleier.database.windows.net,1433;Initial Catalog=azuretoolkit;Persist Security Info=False;Integrated Security=true;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;";
            var builder        = new SqlConnectionStringBuilder(connection);
            var optionsBuilder = new DbContextOptionsBuilder <AzureToolkitContext>();

            optionsBuilder.UseSqlServer(builder.ConnectionString);
            var context = new AzureToolkitContext(optionsBuilder.Options);

            return(context);
        }
コード例 #4
0
        public ImagesController(AzureToolkitContext context)
        {
            _context = context;
            CloudStorageAccount storageAccount = new CloudStorageAccount(
                new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials(
                    "azuretkstoragekapeltol",
                    "q0G+LdWBn7JjlbQ7nQxluufU+3mkRQw6YtwrvW5H8547ZxmKNzMiZmQmWmDuOq3bZP7KEjno2NifKzUW8/z80g=="), true);
            // Create a blob client.
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

            _container = blobClient.GetContainerReference("savedimages");
        }
コード例 #5
0
        public ImagesController(AzureToolkitContext context)
        {
            CloudStorageAccount storageAccount = new CloudStorageAccount(
                new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials(
                    "azrtkthectagon",
                    "/kZ740n7/npVoCm35EzlCt1djhzh4G/ziPs9+9WIeAtGdsvKkQanDBkWx5llQumuGyGf5v7di5AuITeupWPTZw=="), true);
            // Create a blob client.
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

            _container = blobClient.GetContainerReference("savedimages");
            _context   = context;
        }
コード例 #6
0
        public ImagesController(AzureToolkitContext context)
        {
            this._context = context;
            CloudStorageAccount storageAccount = new CloudStorageAccount(
                new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials(
                    "azurestoragethilina",
                    "AaSEdv+1TcDWIUFDSe4QrkNegv7DLq2Sx05tCq0Zr7JLqROXAq6P3dBK4Rme9OiCsno4X5JcBredjzKkrf/YMQ=="), true);
            // Create a blob client.
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

            _container = blobClient.GetContainerReference("savedimages");
        }
コード例 #7
0
        public ImagesController(AzureToolkitContext context)
        {
            _context = context;

            CloudStorageAccount storageAccount = new CloudStorageAccount(
                new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials(
                    "<STORAGE_ACCOUNT_NAME_GOES_HERE>",
                    "<STORAGE_ACCOUNT_KEY_GOES_HERE>"), true);
            // Create a blob client.
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

            _container = blobClient.GetContainerReference("savedimages");
        }
コード例 #8
0
        public void PostImageTest()
        {
            AzureToolkitContext context = GetAzureToolkitContext();
            var controller = new ImagesController(context);

            var request = new ImagePostRequest()
            {
                URL            = new Uri("https://azuretkstorageoleier.blob.core.windows.net/savedimages/D30DFA0F40F3410C282A831D55AF58D9792C225F.jpeg"),
                EncodingFormat = "jpg",
                Id             = Guid.NewGuid().ToString()
            };
            Task <IActionResult> task = controller.PostImage(request);

            task.Wait();
        }
コード例 #9
0
        public ImagesController(AzureToolkitContext context)
        {
            _context = context;

            var storageAccount = new CloudStorageAccount(
                new StorageCredentials(
                    "azuretktstorage",
                    "JbDRkZ+v5/M48J53UQz53EM5jzEOXRzDtSKxy0z1rfgTLpRI0s48p1T+7lDM9kwCtzfH9UtfPgzSJroYE5hsKg=="
                    ), true
                );

            // create a blob client
            var blobClient = storageAccount.CreateCloudBlobClient();

            _container = blobClient.GetContainerReference("savedimages");
        }
コード例 #10
0
        public ImagesController(IConfiguration config, AzureToolkitContext context)
        {
            this.config  = config;
            this.context = context;

            var accountName = config.GetValue <string>("StorageCredentials.accountName");
            var keyValue    = config.GetValue <string>("StorageCredentials.keyValue");

            CloudStorageAccount storageAccount = new CloudStorageAccount(
                new StorageCredentials(accountName, keyValue),
                true);
            // Create a blob client.
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

            this.container = blobClient.GetContainerReference("savedimages");
        }
コード例 #11
0
        public ImagesController(IConfiguration iconfig, AzureToolkitContext context)
        {
            this._context = context;
            this._iconfig = iconfig;
            this._logger  = LogManager.GetLogger("Logger");

            var storageAccount = new CloudStorageAccount(
                new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials(
                    iconfig.GetValue <string>("StorageCredentials_AccountName"),
                    iconfig.GetValue <string>("StorageCredentials_KeyValue")
                    ), true);

            // Create a blob client.
            var blobClient = storageAccount.CreateCloudBlobClient();

            _container = blobClient.GetContainerReference("saveimages");
        }
コード例 #12
0
        public ImagesController(IConfiguration config, AzureToolkitContext context)
        {
            _context = context;
            var san          = config["azure:san"];
            var sanAccessKey = config["azure:sanAccessKey"];

            _searchApiKey      = config["azure:searchApiKey"];
            _searchServiceName = config["azure:searchServiceName"];

            CloudStorageAccount storageAccount = new CloudStorageAccount(
                new StorageCredentials(san, sanAccessKey), true);

            // Create a blob client.
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

            _container = blobClient.GetContainerReference("savedimages");
        }
コード例 #13
0
        public ImagesController(IConfiguration configuration,
                                ILogger <ImagesController> logger,
                                AzureToolkitContext context)
        {
            _logger            = logger;
            _context           = context;
            _configuration     = configuration;
            _searchServiceName = _configuration["searchservicename"];
            _searchServiceKey  = _configuration["searchservicekey"];

            _logger.LogInformation("storage account: " + configuration["storageaccount"]);
            _logger.LogInformation("storage key: " + configuration["storagekey"]);

            CloudStorageAccount storageAccount = new CloudStorageAccount(
                new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials(
                    configuration["storageaccount"],
                    configuration["storagekey"]), true);
            // Create a blob client.
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

            _container = blobClient.GetContainerReference("savedimages");
        }