本文整理汇总了C#中GenericRepository.GetAllTest方法的典型用法代码示例。如果您正苦于以下问题:C# GenericRepository.GetAllTest方法的具体用法?C# GenericRepository.GetAllTest怎么用?C# GenericRepository.GetAllTest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GenericRepository
的用法示例。
在下文中一共展示了GenericRepository.GetAllTest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadFile
public void LoadFile(string FileUri)
{
ResetModel();
IndexerModel db = new IndexerModel();
GenericRepository<Files> uRep = new GenericRepository<Files>(db);
try
{
var r = db.Files;
if (r.Any())
{
ReportMessage("First : " + r.Count().ToString());
}
}
catch (Exception)
{
ReportMessage("First doesnot work. ");
}
try
{
using (db = new IndexerModel())
{
var r = db.Files;
if (r.Any())
{
ReportMessage("Second : " + r.Count().ToString());
}
}
}
catch (Exception)
{
ReportMessage("Second doesnot work. ");
}
try
{
// Expression<Func<Files, bool>> filter = (x) => x.size > 325666;
var q = uRep.GetAllTest((x)=>x.size>325666);
if (q.Any())
{
ReportMessage("Repository : " + q.Count().ToString());
}
}
catch (Exception)
{
ReportMessage("Repository doesnot work. ");
}
var fi = new FileInfo(FileUri);
if (fi != null)
{
FilesRep.FilesExistsResult res = FilesRep.CheckFileExists(fi.FullName, fi.Name, fi.Length, fi.LastWriteTime.ToLongDateString(), fi.LastWriteTime.ToFileTime());
if (res == FilesRep.FilesExistsResult.FileDoesNotExist)
{
var item = new Files();
item.FileID = Guid.NewGuid();
item.Uri = fi.FullName;
item.size = fi.Length;
item.Date = fi.LastWriteTime;
item.FileTime = fi.LastWriteTime.ToFileTime();
item.strDate = fi.LastWriteTime.ToLongDateString();
FileNameOnly = item.Uri;
// Test GitHub
// Test GitHub 2
FilesRep.AddFileToDB(item);
}
}
}