本文整理汇总了C#中IDataReader.GetMemoryStream方法的典型用法代码示例。如果您正苦于以下问题:C# IDataReader.GetMemoryStream方法的具体用法?C# IDataReader.GetMemoryStream怎么用?C# IDataReader.GetMemoryStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDataReader
的用法示例。
在下文中一共展示了IDataReader.GetMemoryStream方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetItem
private BaseItem GetItem(IDataReader reader)
{
var typeString = reader.GetString(0);
var type = _typeMapper.GetType(typeString);
if (type == null)
{
_logger.Debug("Unknown type {0}", typeString);
return null;
}
BaseItem item;
using (var stream = reader.GetMemoryStream(1))
{
try
{
item = _jsonSerializer.DeserializeFromStream(stream, type) as BaseItem;
if (item == null)
{
return null;
}
}
catch (SerializationException ex)
{
_logger.ErrorException("Error deserializing item", ex);
return null;
}
}
if (!reader.IsDBNull(2))
{
var hasStartDate = item as IHasStartDate;
if (hasStartDate != null)
{
hasStartDate.StartDate = reader.GetDateTime(2).ToUniversalTime();
}
}
if (!reader.IsDBNull(3))
{
item.EndDate = reader.GetDateTime(3).ToUniversalTime();
}
if (!reader.IsDBNull(4))
{
item.IsOffline = reader.GetBoolean(4);
}
if (!reader.IsDBNull(5))
{
item.ChannelId = reader.GetString(5);
}
var hasProgramAttributes = item as IHasProgramAttributes;
if (hasProgramAttributes != null)
{
if (!reader.IsDBNull(6))
{
hasProgramAttributes.IsMovie = reader.GetBoolean(6);
}
if (!reader.IsDBNull(7))
{
hasProgramAttributes.IsSports = reader.GetBoolean(7);
}
if (!reader.IsDBNull(8))
{
hasProgramAttributes.IsKids = reader.GetBoolean(8);
}
if (!reader.IsDBNull(9))
{
hasProgramAttributes.IsSeries = reader.GetBoolean(9);
}
if (!reader.IsDBNull(10))
{
hasProgramAttributes.IsLive = reader.GetBoolean(10);
}
if (!reader.IsDBNull(11))
{
hasProgramAttributes.IsNews = reader.GetBoolean(11);
}
if (!reader.IsDBNull(12))
{
hasProgramAttributes.IsPremiere = reader.GetBoolean(12);
}
if (!reader.IsDBNull(13))
{
hasProgramAttributes.EpisodeTitle = reader.GetString(13);
}
//.........这里部分代码省略.........
示例2: GetItem
private BaseItem GetItem(IDataReader reader)
{
var typeString = reader.GetString(0);
var type = _typeMapper.GetType(typeString);
if (type == null)
{
_logger.Debug("Unknown type {0}", typeString);
return null;
}
BaseItem item;
using (var stream = reader.GetMemoryStream(1))
{
try
{
item = _jsonSerializer.DeserializeFromStream(stream, type) as BaseItem;
if (item == null)
{
return null;
}
}
catch (SerializationException ex)
{
_logger.ErrorException("Error deserializing item", ex);
return null;
}
}
if (!reader.IsDBNull(2))
{
item.IsOffline = reader.GetBoolean(2);
}
return item;
}
示例3: GetItem
private BaseItem GetItem(IDataReader reader)
{
var typeString = reader.GetString(0);
var type = _typeMapper.GetType(typeString);
if (type == null)
{
_logger.Debug("Unknown type {0}", typeString);
return null;
}
using (var stream = reader.GetMemoryStream(1))
{
try
{
return _jsonSerializer.DeserializeFromStream(stream, type) as BaseItem;
}
catch (SerializationException ex)
{
_logger.ErrorException("Error deserializing item", ex);
return null;
}
}
}
示例4: GetItem
private BaseItem GetItem(IDataReader reader)
{
var typeString = reader.GetString(0);
var type = _typeMapper.GetType(typeString);
if (type == null)
{
Logger.Debug("Unknown type {0}", typeString);
return null;
}
BaseItem item = null;
using (var stream = reader.GetMemoryStream(1))
{
try
{
item = _jsonSerializer.DeserializeFromStream(stream, type) as BaseItem;
}
catch (SerializationException ex)
{
Logger.ErrorException("Error deserializing item", ex);
}
if (item == null)
{
try
{
item = Activator.CreateInstance(type) as BaseItem;
}
catch
{
}
}
if (item == null)
{
return null;
}
}
if (!reader.IsDBNull(2))
{
var hasStartDate = item as IHasStartDate;
if (hasStartDate != null)
{
hasStartDate.StartDate = reader.GetDateTime(2).ToUniversalTime();
}
}
if (!reader.IsDBNull(3))
{
item.EndDate = reader.GetDateTime(3).ToUniversalTime();
}
if (!reader.IsDBNull(4))
{
item.IsOffline = reader.GetBoolean(4);
}
if (!reader.IsDBNull(5))
{
item.ChannelId = reader.GetString(5);
}
var hasProgramAttributes = item as IHasProgramAttributes;
if (hasProgramAttributes != null)
{
if (!reader.IsDBNull(6))
{
hasProgramAttributes.IsMovie = reader.GetBoolean(6);
}
if (!reader.IsDBNull(7))
{
hasProgramAttributes.IsSports = reader.GetBoolean(7);
}
if (!reader.IsDBNull(8))
{
hasProgramAttributes.IsKids = reader.GetBoolean(8);
}
if (!reader.IsDBNull(9))
{
hasProgramAttributes.IsSeries = reader.GetBoolean(9);
}
if (!reader.IsDBNull(10))
{
hasProgramAttributes.IsLive = reader.GetBoolean(10);
}
if (!reader.IsDBNull(11))
{
hasProgramAttributes.IsNews = reader.GetBoolean(11);
}
//.........这里部分代码省略.........
示例5: GetItem
private BaseItem GetItem(IDataReader reader)
{
var typeString = reader.GetString(0);
var type = _typeMapper.GetType(typeString);
if (type == null)
{
_logger.Debug("Unknown type {0}", typeString);
return null;
}
using (var stream = reader.GetMemoryStream(1))
{
return _jsonSerializer.DeserializeFromStream(stream, type) as BaseItem;
}
}
示例6: GetItem
private BaseItem GetItem(IDataReader reader, InternalItemsQuery query)
{
var typeString = reader.GetString(0);
var type = _typeMapper.GetType(typeString);
if (type == null)
{
//Logger.Debug("Unknown type {0}", typeString);
return null;
}
BaseItem item = null;
if (TypeRequiresDeserialization(type))
{
using (var stream = reader.GetMemoryStream(1, _memoryStreamProvider))
{
try
{
item = _jsonSerializer.DeserializeFromStream(stream, type) as BaseItem;
}
catch (SerializationException ex)
{
Logger.ErrorException("Error deserializing item", ex);
}
}
}
if (item == null)
{
try
{
item = Activator.CreateInstance(type) as BaseItem;
}
catch
{
}
}
if (item == null)
{
return null;
}
if (!reader.IsDBNull(2))
{
var hasStartDate = item as IHasStartDate;
if (hasStartDate != null)
{
hasStartDate.StartDate = reader.GetDateTime(2).ToUniversalTime();
}
}
if (!reader.IsDBNull(3))
{
item.EndDate = reader.GetDateTime(3).ToUniversalTime();
}
if (!reader.IsDBNull(4))
{
item.IsOffline = reader.GetBoolean(4);
}
if (!reader.IsDBNull(5))
{
item.ChannelId = reader.GetString(5);
}
var hasProgramAttributes = item as IHasProgramAttributes;
if (hasProgramAttributes != null)
{
if (!reader.IsDBNull(6))
{
hasProgramAttributes.IsMovie = reader.GetBoolean(6);
}
if (!reader.IsDBNull(7))
{
hasProgramAttributes.IsSports = reader.GetBoolean(7);
}
if (!reader.IsDBNull(8))
{
hasProgramAttributes.IsKids = reader.GetBoolean(8);
}
if (!reader.IsDBNull(9))
{
hasProgramAttributes.IsSeries = reader.GetBoolean(9);
}
if (!reader.IsDBNull(10))
{
hasProgramAttributes.IsLive = reader.GetBoolean(10);
}
if (!reader.IsDBNull(11))
{
//.........这里部分代码省略.........