Disco.Services.AttachmentDataStoreExtensions.RepositoryFilename C# (CSharp) Method

RepositoryFilename() public static method

public static RepositoryFilename ( this Attachment, DiscoDataContext Database ) : string
Attachment this
Database Disco.Data.Repository.DiscoDataContext
return string
        public static string RepositoryFilename(this IAttachment Attachment, DiscoDataContext Database)
        {
            switch (Attachment.AttachmentType)
            {
                case AttachmentTypes.Device:
                    return Path.Combine(DataStore.CreateLocation(Database, "DeviceAttachments", Attachment.Timestamp),
                        string.Format("{0}_{1}_file", Attachment.Reference, Attachment.Id));
                case AttachmentTypes.Job:
                    return Path.Combine(DataStore.CreateLocation(Database, "JobAttachments", Attachment.Timestamp),
                        string.Format("{0}_{1}_file", Attachment.Reference, Attachment.Id));
                case AttachmentTypes.User:
                    return Path.Combine(DataStore.CreateLocation(Database, "UserAttachments", Attachment.Timestamp),
                        string.Format("{0}_{1}_file", ((string)Attachment.Reference).Replace('\\', '_'), Attachment.Id));
                default:
                    throw new ArgumentException("Unknown Attachment Type", nameof(Attachment));
            }
        }