示例#1
0
        protected virtual async Task <DatabaseFileContainer> GetOrCreateContainerAsync(
            string name,
            CancellationToken cancellationToken = default)
        {
            var container = await DatabaseFileContainerRepository.FindAsync(name, cancellationToken);

            if (container != null)
            {
                return(container);
            }

            container = new DatabaseFileContainer(GuidGenerator.Create(), name, CurrentTenant.Id);
            await DatabaseFileContainerRepository.InsertAsync(container, cancellationToken : cancellationToken);

            return(container);
        }
示例#2
0
        protected virtual string BuildAccessUrl(DatabaseFileContainer container, string fileId)
        {
            var accessUrl = container.IncludeContainer ? $"{container.HttpServer.TrimEnd('/')}/{container.Name}/{fileId}" : $"{container.HttpServer.TrimEnd('/')}/{fileId}";

            return(accessUrl);
        }