/// <summary> /// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this /// object's properties. The database column's name is used to as the key, so the value /// will not be found if any aliases are used or not all columns were selected. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param> public static void ReadValues(this WorldStatsQuestAcceptTable source, System.Data.IDataRecord dataRecord) { System.Int32 i; i = dataRecord.GetOrdinal("id"); source.ID = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); i = dataRecord.GetOrdinal("map_id"); source.MapID = (System.Nullable<NetGore.World.MapID>)(System.Nullable<NetGore.World.MapID>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.UInt16>)null : dataRecord.GetUInt16(i)); i = dataRecord.GetOrdinal("quest_id"); source.QuestID = (NetGore.Features.Quests.QuestID)(NetGore.Features.Quests.QuestID)dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("user_id"); source.UserID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i); i = dataRecord.GetOrdinal("when"); source.When = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); i = dataRecord.GetOrdinal("x"); source.X = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("y"); source.Y = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); }
/// <summary> /// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this /// object's properties. The database column's name is used to as the key, so the value /// will not be found if any aliases are used or not all columns were selected. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param> public static void ReadValues(this WorldStatsUserConsumeItemTable source, System.Data.IDataRecord dataRecord) { System.Int32 i; i = dataRecord.GetOrdinal("id"); source.ID = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); i = dataRecord.GetOrdinal("item_template_id"); source.ItemTemplateID = (DemoGame.ItemTemplateID)(DemoGame.ItemTemplateID)dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("map_id"); source.MapID = (System.Nullable<NetGore.World.MapID>)(System.Nullable<NetGore.World.MapID>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.UInt16>)null : dataRecord.GetUInt16(i)); i = dataRecord.GetOrdinal("user_id"); source.UserID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i); i = dataRecord.GetOrdinal("when"); source.When = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); i = dataRecord.GetOrdinal("x"); source.X = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("y"); source.Y = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); }
/// <summary> /// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this /// object's properties. The database column's name is used to as the key, so the value /// will not be found if any aliases are used or not all columns were selected. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param> public static void ReadValues(this AccountTable source, System.Data.IDataRecord dataRecord) { System.Int32 i; i = dataRecord.GetOrdinal("creator_ip"); source.CreatorIp = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); i = dataRecord.GetOrdinal("current_ip"); source.CurrentIp = (System.Nullable<System.UInt32>)(System.Nullable<System.UInt32>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.UInt32>)null : dataRecord.GetUInt32(i)); i = dataRecord.GetOrdinal("email"); source.Email = (System.String)(System.String)dataRecord.GetString(i); i = dataRecord.GetOrdinal("friends"); source.Friends = (System.String)(System.String)dataRecord.GetString(i); i = dataRecord.GetOrdinal("id"); source.ID = (DemoGame.AccountID)(DemoGame.AccountID)dataRecord.GetInt32(i); i = dataRecord.GetOrdinal("name"); source.Name = (System.String)(System.String)dataRecord.GetString(i); i = dataRecord.GetOrdinal("password"); source.Password = (System.String)(System.String)dataRecord.GetString(i); i = dataRecord.GetOrdinal("permissions"); source.Permissions = (DemoGame.UserPermissions)(DemoGame.UserPermissions)dataRecord.GetByte(i); i = dataRecord.GetOrdinal("time_created"); source.TimeCreated = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); i = dataRecord.GetOrdinal("time_last_login"); source.TimeLastLogin = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); }
/// <summary> /// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this /// object's properties. The database column's name is used to as the key, so the value /// will not be found if any aliases are used or not all columns were selected. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param> public static void ReadValues(this AccountIpsTable source, System.Data.IDataRecord dataRecord) { System.Int32 i; i = dataRecord.GetOrdinal("account_id"); source.AccountID = (DemoGame.AccountID)(DemoGame.AccountID)dataRecord.GetInt32(i); i = dataRecord.GetOrdinal("id"); source.ID = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); i = dataRecord.GetOrdinal("ip"); source.Ip = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); i = dataRecord.GetOrdinal("time"); source.Time = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); }
/// <summary> /// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this /// object's properties. The database column's name is used to as the key, so the value /// will not be found if any aliases are used or not all columns were selected. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param> public static void ReadValues(this WorldStatsNetworkTable source, System.Data.IDataRecord dataRecord) { System.Int32 i; i = dataRecord.GetOrdinal("connections"); source.Connections = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("id"); source.ID = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); i = dataRecord.GetOrdinal("recv_bytes"); source.RecvBytes = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); i = dataRecord.GetOrdinal("recv_messages"); source.RecvMessages = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); i = dataRecord.GetOrdinal("recv_packets"); source.RecvPackets = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); i = dataRecord.GetOrdinal("sent_bytes"); source.SentBytes = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); i = dataRecord.GetOrdinal("sent_messages"); source.SentMessages = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); i = dataRecord.GetOrdinal("sent_packets"); source.SentPackets = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); i = dataRecord.GetOrdinal("when"); source.When = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); }
/// <summary> /// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this /// object's properties. The database column's name is used to as the key, so the value /// will not be found if any aliases are used or not all columns were selected. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param> public static void ReadValues(this WorldStatsUserShoppingTable source, System.Data.IDataRecord dataRecord) { System.Int32 i; i = dataRecord.GetOrdinal("amount"); source.Amount = (System.Byte)(System.Byte)dataRecord.GetByte(i); i = dataRecord.GetOrdinal("character_id"); source.CharacterID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i); i = dataRecord.GetOrdinal("cost"); source.Cost = (System.Int32)(System.Int32)dataRecord.GetInt32(i); i = dataRecord.GetOrdinal("id"); source.ID = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); i = dataRecord.GetOrdinal("item_template_id"); source.ItemTemplateID = (System.Nullable<DemoGame.ItemTemplateID>)(System.Nullable<DemoGame.ItemTemplateID>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.UInt16>)null : dataRecord.GetUInt16(i)); i = dataRecord.GetOrdinal("map_id"); source.MapID = (System.Nullable<NetGore.World.MapID>)(System.Nullable<NetGore.World.MapID>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.UInt16>)null : dataRecord.GetUInt16(i)); i = dataRecord.GetOrdinal("sale_type"); source.SaleType = (System.SByte)(System.SByte)dataRecord.GetSByte(i); i = dataRecord.GetOrdinal("shop_id"); source.ShopID = (NetGore.Features.Shops.ShopID)(NetGore.Features.Shops.ShopID)dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("when"); source.When = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); i = dataRecord.GetOrdinal("x"); source.X = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("y"); source.Y = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); }
/// <summary> /// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this /// object's properties. The database column's name is used to as the key, so the value /// will not be found if any aliases are used or not all columns were selected. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param> public static void ReadValues(this WorldStatsNpcKillUserTable source, System.Data.IDataRecord dataRecord) { System.Int32 i; i = dataRecord.GetOrdinal("id"); source.ID = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); i = dataRecord.GetOrdinal("map_id"); source.MapID = (System.Nullable<NetGore.World.MapID>)(System.Nullable<NetGore.World.MapID>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.UInt16>)null : dataRecord.GetUInt16(i)); i = dataRecord.GetOrdinal("npc_template_id"); source.NPCTemplateID = (System.Nullable<DemoGame.CharacterTemplateID>)(System.Nullable<DemoGame.CharacterTemplateID>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.UInt16>)null : dataRecord.GetUInt16(i)); i = dataRecord.GetOrdinal("npc_x"); source.NpcX = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("npc_y"); source.NpcY = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("user_id"); source.UserID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i); i = dataRecord.GetOrdinal("user_level"); source.UserLevel = (System.Int16)(System.Int16)dataRecord.GetInt16(i); i = dataRecord.GetOrdinal("user_x"); source.UserX = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("user_y"); source.UserY = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); i = dataRecord.GetOrdinal("when"); source.When = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); }
/// <summary> /// Reads the values from an <see cref="IDataRecord"/> and assigns the read values to this /// object's properties. The database column's name is used to as the key, so the value /// will not be found if any aliases are used or not all columns were selected. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataRecord"/> to read the values from. Must already be ready to be read from.</param> public static void ReadValues(this WorldStatsGuildUserChangeTable source, System.Data.IDataRecord dataRecord) { System.Int32 i; i = dataRecord.GetOrdinal("guild_id"); source.GuildID = (System.Nullable<NetGore.Features.Guilds.GuildID>)(System.Nullable<NetGore.Features.Guilds.GuildID>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.UInt16>)null : dataRecord.GetUInt16(i)); i = dataRecord.GetOrdinal("id"); source.ID = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); i = dataRecord.GetOrdinal("user_id"); source.UserID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i); i = dataRecord.GetOrdinal("when"); source.When = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { base.GetObjectData(info, context); ErrorCode = (WiaScannerError)info.GetUInt32("ErrorCode"); }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this WorldStatsGuildUserChangeTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "guild_id": source.GuildID = (System.Nullable<NetGore.Features.Guilds.GuildID>)(System.Nullable<NetGore.Features.Guilds.GuildID>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.UInt16>)null : dataRecord.GetUInt16(i)); break; case "id": source.ID = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); break; case "user_id": source.UserID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i); break; case "when": source.When = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this WorldStatsNpcKillUserTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "id": source.ID = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); break; case "map_id": source.MapID = (System.Nullable<NetGore.World.MapID>)(System.Nullable<NetGore.World.MapID>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.UInt16>)null : dataRecord.GetUInt16(i)); break; case "npc_template_id": source.NPCTemplateID = (System.Nullable<DemoGame.CharacterTemplateID>)(System.Nullable<DemoGame.CharacterTemplateID>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.UInt16>)null : dataRecord.GetUInt16(i)); break; case "npc_x": source.NpcX = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); break; case "npc_y": source.NpcY = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); break; case "user_id": source.UserID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i); break; case "user_level": source.UserLevel = (System.Int16)(System.Int16)dataRecord.GetInt16(i); break; case "user_x": source.UserX = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); break; case "user_y": source.UserY = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); break; case "when": source.When = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this WorldStatsQuestAcceptTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "id": source.ID = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); break; case "map_id": source.MapID = (System.Nullable<NetGore.World.MapID>)(System.Nullable<NetGore.World.MapID>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.UInt16>)null : dataRecord.GetUInt16(i)); break; case "quest_id": source.QuestID = (NetGore.Features.Quests.QuestID)(NetGore.Features.Quests.QuestID)dataRecord.GetUInt16(i); break; case "user_id": source.UserID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i); break; case "when": source.When = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); break; case "x": source.X = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); break; case "y": source.Y = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); break; } } }
/// <summary> /// Initializes a new instance of the <see cref="ClientIdentifierException" /> class. /// </summary> /// <param name="info"> /// The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown. /// </param> /// <param name="context"> /// The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination. /// </param> /// <exception cref="T:System.ArgumentNullException"> /// The <paramref name="info" /> parameter is null. /// </exception> /// <exception cref="T:System.Runtime.Serialization.SerializationException"> /// The class name is null or <see cref="P:System.Exception.HResult" /> is zero (0). /// </exception> protected ConnectionException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { if (info == null) { throw new ArgumentNullException("info"); } ConnectionState = (ConnectionState) info.GetUInt32("ConnectionState"); }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this WorldStatsNetworkTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "connections": source.Connections = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); break; case "id": source.ID = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); break; case "recv_bytes": source.RecvBytes = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); break; case "recv_messages": source.RecvMessages = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); break; case "recv_packets": source.RecvPackets = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); break; case "sent_bytes": source.SentBytes = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); break; case "sent_messages": source.SentMessages = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); break; case "sent_packets": source.SentPackets = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); break; case "when": source.When = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this AccountTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "creator_ip": source.CreatorIp = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); break; case "current_ip": source.CurrentIp = (System.Nullable<System.UInt32>)(System.Nullable<System.UInt32>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.UInt32>)null : dataRecord.GetUInt32(i)); break; case "email": source.Email = (System.String)(System.String)dataRecord.GetString(i); break; case "friends": source.Friends = (System.String)(System.String)dataRecord.GetString(i); break; case "id": source.ID = (DemoGame.AccountID)(DemoGame.AccountID)dataRecord.GetInt32(i); break; case "name": source.Name = (System.String)(System.String)dataRecord.GetString(i); break; case "password": source.Password = (System.String)(System.String)dataRecord.GetString(i); break; case "permissions": source.Permissions = (DemoGame.UserPermissions)(DemoGame.UserPermissions)dataRecord.GetByte(i); break; case "time_created": source.TimeCreated = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); break; case "time_last_login": source.TimeLastLogin = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this AccountIpsTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "account_id": source.AccountID = (DemoGame.AccountID)(DemoGame.AccountID)dataRecord.GetInt32(i); break; case "id": source.ID = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); break; case "ip": source.Ip = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); break; case "time": source.Time = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); break; } } }
/// <summary> /// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this /// object's properties. Unlike ReadValues(), this method not only doesn't require /// all values to be in the <see cref="IDataReader"/>, but also does not require the values in /// the <see cref="IDataReader"/> to be a defined field for the table this class represents. /// Because of this, you need to be careful when using this method because values /// can easily be skipped without any indication. /// </summary> /// <param name="source">The object to add the extension method to.</param> /// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param> public static void TryReadValues(this WorldStatsUserShoppingTable source, System.Data.IDataRecord dataRecord) { for (int i = 0; i < dataRecord.FieldCount; i++) { switch (dataRecord.GetName(i)) { case "amount": source.Amount = (System.Byte)(System.Byte)dataRecord.GetByte(i); break; case "character_id": source.CharacterID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i); break; case "cost": source.Cost = (System.Int32)(System.Int32)dataRecord.GetInt32(i); break; case "id": source.ID = (System.UInt32)(System.UInt32)dataRecord.GetUInt32(i); break; case "item_template_id": source.ItemTemplateID = (System.Nullable<DemoGame.ItemTemplateID>)(System.Nullable<DemoGame.ItemTemplateID>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.UInt16>)null : dataRecord.GetUInt16(i)); break; case "map_id": source.MapID = (System.Nullable<NetGore.World.MapID>)(System.Nullable<NetGore.World.MapID>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.UInt16>)null : dataRecord.GetUInt16(i)); break; case "sale_type": source.SaleType = (System.SByte)(System.SByte)dataRecord.GetSByte(i); break; case "shop_id": source.ShopID = (NetGore.Features.Shops.ShopID)(NetGore.Features.Shops.ShopID)dataRecord.GetUInt16(i); break; case "when": source.When = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i); break; case "x": source.X = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); break; case "y": source.Y = (System.UInt16)(System.UInt16)dataRecord.GetUInt16(i); break; } } }