添加项目文件。
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user