Пример #1
0
        public override async Task BindAsync(BindingContext context)
        {
            string boundBlobPath = Path;

            if (context.BindingData != null)
            {
                boundBlobPath = _pathBindingTemplate.Bind(context.BindingData);
            }

            boundBlobPath = Resolve(boundBlobPath);

            var attribute = new ApiHubFileAttribute(Key, boundBlobPath, Access);

            RuntimeBindingContext runtimeContext = new RuntimeBindingContext(attribute);
            Stream blobStream = await context.Binder.BindAsync <Stream>(runtimeContext);

            if (Access == FileAccess.Write)
            {
                await context.Value.CopyToAsync(blobStream);
            }
            else
            {
                await blobStream.CopyToAsync(context.Value);
            }
        }
        public override async Task BindAsync(BindingContext context)
        {
            string boundBlobPath = Path;
            if (context.BindingData != null)
            {
                boundBlobPath = _pathBindingTemplate.Bind(context.BindingData);
            }

            boundBlobPath = Resolve(boundBlobPath);

            var attribute = new ApiHubFileAttribute(Key, boundBlobPath, Access);

            RuntimeBindingContext runtimeContext = new RuntimeBindingContext(attribute);
            await BindStreamAsync(context.Value, Access, context.Binder, runtimeContext);
        }
        public override async Task BindAsync(BindingContext context)
        {
            string boundBlobPath = Path;

            if (context.BindingData != null)
            {
                boundBlobPath = _pathBindingTemplate.Bind(context.BindingData);
            }

            boundBlobPath = Resolve(boundBlobPath);

            var attribute = new ApiHubFileAttribute(Key, boundBlobPath, Access);

            RuntimeBindingContext runtimeContext = new RuntimeBindingContext(attribute);

            await BindStreamAsync(context, Access, runtimeContext);
        }