添加项目文件。
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FileService.Domain.ValueObjects
|
||||
{
|
||||
public class CheckSum
|
||||
{
|
||||
public string Algorithm { get; }
|
||||
public string Value { get; }
|
||||
|
||||
public CheckSum(string algorithm, string value)
|
||||
{
|
||||
Algorithm = algorithm;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Value;
|
||||
}
|
||||
|
||||
public static implicit operator CheckSum((string algorithm, string value) value)
|
||||
{
|
||||
return new CheckSum(value.algorithm, value.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FileService.Domain.ValueObjects
|
||||
{
|
||||
public class ContentType
|
||||
{
|
||||
public string Value { get; }
|
||||
public ContentType(string contentType)
|
||||
{
|
||||
Value = contentType;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Value;
|
||||
}
|
||||
|
||||
public static implicit operator ContentType(string contentType)
|
||||
{
|
||||
return new ContentType(contentType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FileService.Domain.ValueObjects
|
||||
{
|
||||
public class FileName
|
||||
{
|
||||
public string Value { get; }
|
||||
|
||||
public FileName(string value)
|
||||
{
|
||||
if(value.Length > 20)
|
||||
{
|
||||
throw new ArgumentException("文件名超出长度");
|
||||
}
|
||||
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Value;
|
||||
}
|
||||
|
||||
public static implicit operator FileName(string value)
|
||||
{
|
||||
return new FileName(value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FileService.Domain.ValueObjects
|
||||
{
|
||||
public class StorageLocation
|
||||
{
|
||||
public string StorageProvider { get; private set; } = "Local";
|
||||
public string Bucket { get; private set; } = string.Empty;
|
||||
public string ObjectKey { get; private set; } = string.Empty;
|
||||
public string? Region { get; private set; } = string.Empty;
|
||||
|
||||
public StorageLocation()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public StorageLocation(string storageProvider, string bucket, string objectKey, string? region = null)
|
||||
{
|
||||
this.StorageProvider = storageProvider;
|
||||
this.Bucket = bucket;
|
||||
this.ObjectKey = objectKey;
|
||||
this.Region = region;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user