本文整理汇总了C#中Media.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# Media.ToList方法的具体用法?C# Media.ToList怎么用?C# Media.ToList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Media
的用法示例。
在下文中一共展示了Media.ToList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateFakeMedias
//.........这里部分代码省略.........
MediaFolder rootFolder = null;
if (fakeRoot)
{
rootFolder = TestDataProvider.CreateNewMediaFolder(false);
rootFolder.Folder = null;
rootFolder.Title = string.Concat("TestFolder_", Guid.NewGuid().ToString());
}
var images1 = TestDataProvider.CreateNewMediaFolder(false);
var images2 = TestDataProvider.CreateNewMediaFolder(false);
var images1_1 = TestDataProvider.CreateNewMediaFolder(false);
var images1_2 = TestDataProvider.CreateNewMediaFolder(false);
var images2_1 = TestDataProvider.CreateNewMediaFolder(false);
var images1_1_1 = TestDataProvider.CreateNewMediaFolder(false);
var images1_1_2 = TestDataProvider.CreateNewMediaFolder(false);
var files1 = TestDataProvider.CreateNewMediaFolder(false, MediaType.File);
var files1_1 = TestDataProvider.CreateNewMediaFolder(false, MediaType.File);
images1.Folder = rootFolder;
images2.Folder = rootFolder;
images1_1.Folder = images1;
images1_2.Folder = images1;
images2_1.Folder = images2;
images1_1_1.Folder = images1_1;
images1_1_2.Folder = images1_1;
files1.Folder = rootFolder;
files1_1.Folder = files1;
images1.Title = "Images1";
images2.Title = "Images2";
images1_1.Title = "Images1_1";
images1_2.Title = "Images1_2";
images2_1.Title = "Images2_1";
images1_1_1.Title = "Images1_1_1";
images1_1_2.Title = "Images1_1_2";
files1.Title = "Files1";
files1_1.Title = "Files1_1";
var rootImage1 = TestDataProvider.CreateNewMediaImage();
var rootImage2 = TestDataProvider.CreateNewMediaImage();
var rootImage3 = TestDataProvider.CreateNewMediaImage();
var image1__1 = TestDataProvider.CreateNewMediaImage(images1);
var image1__2 = TestDataProvider.CreateNewMediaImage(images1);
var image1_1__1 = TestDataProvider.CreateNewMediaImage(images1_1);
var rootFile1 = TestDataProvider.CreateNewMediaFile();
var file1_1 = TestDataProvider.CreateNewMediaFile(files1);
rootImage1.Folder = rootFolder;
rootImage2.Folder = rootFolder;
rootImage3.Folder = rootFolder;
rootFile1.Folder = rootFolder;
rootImage1.Title = "RootImage1";
rootImage2.Title = "RootImage2";
rootImage3.Title = "RootImage3";
image1__1.Title = "Image1__1";
image1__2.Title = "Image1__2";
image1_1__1.Title = "Image1_1__1";
rootFile1.Title = "RootFile1";
file1_1.Title = "File1_1";
var medias = new Media[] {
// Image folders
images1,
images2,
images1_1,
images1_2,
images2_1,
images1_1_1,
images1_1_2,
// File folders
files1,
files1_1,
// Images
rootImage1,
rootImage2,
rootImage3,
image1__1,
image1__2,
image1_1__1,
// Files
rootFile1,
file1_1
};
if (!fakeRoot)
{
var suffix = Guid.NewGuid().ToString();
medias.ToList().ForEach(m => m.Title = string.Concat(m.Title, "_", suffix));
}
medias.ToList().ForEach(m => session.SaveOrUpdate(m));
session.Flush();
session.Clear();
return medias;
}