本文整理汇总了C#中IAlbum.Add方法的典型用法代码示例。如果您正苦于以下问题:C# IAlbum.Add方法的具体用法?C# IAlbum.Add怎么用?C# IAlbum.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAlbum
的用法示例。
在下文中一共展示了IAlbum.Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddChildObjects
private static void AddChildObjects(IAlbum album)
{
if (album == null)
throw new ArgumentNullException("album");
#region Add child albums
foreach (int albumId in GetDataProvider().Album_GetChildAlbumIdsById(album.Id))
{
album.Add(CreateAlbumInstance(albumId, album.GalleryId));
}
#endregion
#region Add child media objects
foreach (MediaObjectDto moDto in GetDataProvider().Album_GetChildMediaObjectsById(album.Id))
{
// SQL:
// SELECT
// MediaObjectID, FKAlbumID, Title, HashKey, ThumbnailFilename, ThumbnailWidth, ThumbnailHeight,
// ThumbnailSizeKB, OptimizedFilename, OptimizedWidth, OptimizedHeight, OptimizedSizeKB,
// OriginalFilename, OriginalWidth, OriginalHeight, OriginalSizeKB, ExternalHtmlSource, ExternalType, mo.Seq,
// CreatedBy, DateAdded, LastModifiedBy, DateLastModified, IsPrivate
// FROM [gs_MediaObject]
// WHERE FKAlbumID = @AlbumId
album.Add(LoadMediaObjectInstance(moDto, album));
}
#endregion
album.AreChildrenInflated = true;
}
示例2: AddChildObjects
private static void AddChildObjects(IAlbum album)
{
if (album == null)
throw new ArgumentNullException("album");
#region Add child albums
foreach (int albumId in GetDataProvider().Album_GetChildAlbumIdsById(album.Id))
{
album.Add(CreateAlbumInstance(albumId, album.GalleryId));
}
#endregion
#region Add child media objects
foreach (MediaObjectDto moDto in GetDataProvider().Album_GetChildMediaObjectsById(album.Id, album.AllowMetadataLoading))
{
album.Add(LoadMediaObjectInstance(moDto, album));
}
#endregion
album.AreChildrenInflated = true;
}
示例3: AddChildObjects
private static void AddChildObjects(IAlbum album)
{
#region Add child albums
IDataReader dr = null;
try
{
using (dr = Factory.GetDataProvider().Album_GetDataReaderChildAlbumsById(album.Id))
{
// SQL:
// SELECT AlbumID
// FROM Album
// WHERE AlbumParentID = @AlbumId
while (dr.Read())
{
album.Add(Factory.CreateAlbumInstance(Convert.ToInt32(dr[0], CultureInfo.InvariantCulture)));
}
}
}
finally
{
if (dr != null) dr.Close();
}
#endregion
#region Add child media objects
dr = null;
try
{
using (dr = Factory.GetDataProvider().Album_GetDataReaderChildMediaObjectsById(album.Id))
{
// SQL:
// SELECT
// MediaObjectID, FKAlbumID, Title, HashKey, ThumbnailFilename, ThumbnailWidth, ThumbnailHeight,
// ThumbnailSizeKB, OptimizedFilename, OptimizedWidth, OptimizedHeight, OptimizedSizeKB,
// OriginalFilename, OriginalWidth, OriginalHeight, OriginalSizeKB, ExternalHtmlSource, ExternalType, mo.Seq,
// CreatedBy, DateAdded, LastModifiedBy, DateLastModified, IsPrivate
// FROM [gs_MediaObject]
// WHERE FKAlbumID = @AlbumId
while (dr.Read())
{
album.Add(Factory.LoadMediaObjectInstance((IDataRecord)dr, album));
}
}
}
finally
{
if (dr != null) dr.Close();
}
#endregion
album.AreChildrenInflated = true;
}