本文整理汇总了C#中ReadType.HasFlag方法的典型用法代码示例。如果您正苦于以下问题:C# ReadType.HasFlag方法的具体用法?C# ReadType.HasFlag怎么用?C# ReadType.HasFlag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReadType
的用法示例。
在下文中一共展示了ReadType.HasFlag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetChildren
public Result GetChildren(Folder folder, ReadType readType, out IEnumerable<Folder> folders, out IEnumerable<File> files)
{
if (folder == null) throw new ArgumentNullException("folder");
folders = new List<Folder>();
files = new List<File>();
SqlExpressionVisitor<Folder> folderEV = OrmLiteConfig.DialectProvider.ExpressionVisitor<Folder>();
folderEV.Where(f => f.ParentFolderId == folder.Id);
if (readType == ReadType.Default) folderEV.Where(f => f.IsDeleted == false);
if (readType == ReadType.OnlyDeleted) folderEV.Where(f => f.IsDeleted == true);
folders = db.Select<Folder>(folderEV);
var sql = new StringBuilder(@"
SELECT f.FileId as Id, f.Name, f.ParentFolderId, f.IsDeleted, f.IsPurged, f.CreatedTimeStamp, f.LastModifiedTimestamp
,fv.FileStore, fv.Version as CurrentVersion, fv.Size, d.FullPath + f.Name as FullPath
FROM [File] f
INNER JOIN [FileVersion] fv
ON fv.FileId = f.FileId
AND fv.IsCurrent = 1
INNER JOIN [Folder] d
ON d.FolderId = f.ParentFolderId
WHERE f.ParentFolderId = {0}".Params(folder.Id));
if (readType.HasFlag(ReadType.OnlyDeleted)) sql.Append(" AND f.IsDeleted = 1");
if (readType.HasFlag(ReadType.OnlyNonDeleted)) sql.Append(" AND f.IsDeleted = 0");
files = db.Query<File>(sql.ToString());
return Result.Success;
}