/// <summary> /// Creates a <see cref="DbParameterValues"/> for a <see cref="DbParameterCollection"/>. /// </summary> /// <param name="dbParameterCollection">The <see cref="DbParameterCollection"/>.</param> /// <returns>The <see cref="DbParameterValues"/> instance.</returns> /// <exception cref="ArgumentNullException"><paramref name="dbParameterCollection" /> is <c>null</c>.</exception> public static DbParameterValues Create(DbParameterCollection dbParameterCollection) { if (dbParameterCollection == null) { throw new ArgumentNullException("dbParameterCollection"); } // Grab from the pool first DbParameterValues ret = null; lock (_poolLock) { if (_pool.Count > 0) { ret = _pool.Pop(); } } // Only create a new instance if we have to (nothing came from the pool) if (ret == null) { ret = new DbParameterValues(); } Debug.Assert(ret._collection == null, "Since Dispose() sets the _collection to null, how did this happen?"); // Set the internal collection ret._collection = dbParameterCollection; return(ret); }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this IWorldStatsNetworkTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "connections": paramValues[i] = (System.UInt16)source.Connections; break; case "id": paramValues[i] = (System.UInt32)source.ID; break; case "recv_bytes": paramValues[i] = (System.UInt32)source.RecvBytes; break; case "recv_messages": paramValues[i] = (System.UInt32)source.RecvMessages; break; case "recv_packets": paramValues[i] = (System.UInt32)source.RecvPackets; break; case "sent_bytes": paramValues[i] = (System.UInt32)source.SentBytes; break; case "sent_messages": paramValues[i] = (System.UInt32)source.SentMessages; break; case "sent_packets": paramValues[i] = (System.UInt32)source.SentPackets; break; case "when": paramValues[i] = (System.DateTime)source.When; break; } } }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The keys must already exist in the DbParameterValues; /// this method will not create them if they are missing. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void CopyValues(this IMapSpawnTable source, NetGore.Db.DbParameterValues paramValues) { paramValues["amount"] = (System.Byte)source.Amount; paramValues["character_template_id"] = (System.UInt16)source.CharacterTemplateID; paramValues["direction_id"] = (System.Int16)source.DirectionId; paramValues["height"] = (System.Nullable <System.UInt16>)source.Height; paramValues["id"] = (System.Int32)source.ID; paramValues["map_id"] = (System.UInt16)source.MapID; paramValues["respawn"] = (System.UInt16)source.Respawn; paramValues["width"] = (System.Nullable <System.UInt16>)source.Width; paramValues["x"] = (System.Nullable <System.UInt16>)source.X; paramValues["y"] = (System.Nullable <System.UInt16>)source.Y; }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The keys must already exist in the DbParameterValues; /// this method will not create them if they are missing. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void CopyValues(this IAccountTable source, NetGore.Db.DbParameterValues paramValues) { paramValues["creator_ip"] = (System.UInt32)source.CreatorIp; paramValues["current_ip"] = (System.Nullable <System.UInt32>)source.CurrentIp; paramValues["email"] = (System.String)source.Email; paramValues["friends"] = (System.String)source.Friends; paramValues["id"] = (System.Int32)source.ID; paramValues["name"] = (System.String)source.Name; paramValues["password"] = (System.String)source.Password; paramValues["permissions"] = (System.Byte)source.Permissions; paramValues["time_created"] = (System.DateTime)source.TimeCreated; paramValues["time_last_login"] = (System.DateTime)source.TimeLastLogin; }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The keys must already exist in the DbParameterValues; /// this method will not create them if they are missing. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void CopyValues(this IWorldStatsNpcKillUserTable source, NetGore.Db.DbParameterValues paramValues) { paramValues["id"] = (System.UInt32)source.ID; paramValues["map_id"] = (System.Nullable <System.UInt16>)source.MapID; paramValues["npc_template_id"] = (System.Nullable <System.UInt16>)source.NPCTemplateID; paramValues["npc_x"] = (System.UInt16)source.NpcX; paramValues["npc_y"] = (System.UInt16)source.NpcY; paramValues["user_id"] = (System.Int32)source.UserID; paramValues["user_level"] = (System.Int16)source.UserLevel; paramValues["user_x"] = (System.UInt16)source.UserX; paramValues["user_y"] = (System.UInt16)source.UserY; paramValues["when"] = (System.DateTime)source.When; }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The keys must already exist in the DbParameterValues; /// this method will not create them if they are missing. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void CopyValues(this IWorldStatsUserShoppingTable source, NetGore.Db.DbParameterValues paramValues) { paramValues["amount"] = (System.Byte)source.Amount; paramValues["character_id"] = (System.Int32)source.CharacterID; paramValues["cost"] = (System.Int32)source.Cost; paramValues["id"] = (System.UInt32)source.ID; paramValues["item_template_id"] = (System.Nullable <System.UInt16>)source.ItemTemplateID; paramValues["map_id"] = (System.Nullable <System.UInt16>)source.MapID; paramValues["sale_type"] = (System.SByte)source.SaleType; paramValues["shop_id"] = (System.UInt16)source.ShopID; paramValues["when"] = (System.DateTime)source.When; paramValues["x"] = (System.UInt16)source.X; paramValues["y"] = (System.UInt16)source.Y; }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this IMapSpawnTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "amount": paramValues[i] = (System.Byte)source.Amount; break; case "character_template_id": paramValues[i] = (System.UInt16)source.CharacterTemplateID; break; case "height": paramValues[i] = (System.Nullable <System.UInt16>)source.Height; break; case "id": paramValues[i] = (System.Int32)source.ID; break; case "map_id": paramValues[i] = (System.UInt16)source.MapID; break; case "width": paramValues[i] = (System.Nullable <System.UInt16>)source.Width; break; case "x": paramValues[i] = (System.Nullable <System.UInt16>)source.X; break; case "y": paramValues[i] = (System.Nullable <System.UInt16>)source.Y; break; } } }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this IAllianceHostileTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "alliance_id": paramValues[i] = (System.Byte)source.AllianceID; break; case "hostile_id": paramValues[i] = (System.Byte)source.HostileID; break; } } }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this ICharacterTemplateSkillTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "character_template_id": paramValues[i] = (System.UInt16)source.CharacterTemplateID; break; case "skill_id": paramValues[i] = (System.Byte)source.SkillID; break; } } }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this IQuestRequireFinishQuestTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "quest_id": paramValues[i] = (System.UInt16)source.QuestID; break; case "req_quest_id": paramValues[i] = (System.UInt16)source.ReqQuestID; break; } } }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this IShopItemTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "item_template_id": paramValues[i] = (System.UInt16)source.ItemTemplateID; break; case "shop_id": paramValues[i] = (System.UInt16)source.ShopID; break; } } }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this IActiveTradeItemTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "character_id": paramValues[i] = (System.Int32)source.CharacterID; break; case "item_id": paramValues[i] = (System.Int32)source.ItemID; break; } } }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this IAppliedPatchesTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "date_applied": paramValues[i] = (System.DateTime)source.DateApplied; break; case "file_name": paramValues[i] = (System.String)source.FileName; break; } } }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this IAllianceTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "id": paramValues[i] = (System.Byte)source.ID; break; case "name": paramValues[i] = (System.String)source.Name; break; } } }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this IAccountBanTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "account_id": paramValues[i] = (System.Int32)source.AccountID; break; case "end_time": paramValues[i] = (System.DateTime)source.EndTime; break; case "expired": paramValues[i] = (System.Boolean)source.Expired; break; case "id": paramValues[i] = (System.Int32)source.ID; break; case "issued_by": paramValues[i] = (System.String)source.IssuedBy; break; case "reason": paramValues[i] = (System.String)source.Reason; break; case "start_time": paramValues[i] = (System.DateTime)source.StartTime; break; } } }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this IWorldStatsQuestCompleteTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "id": paramValues[i] = (System.UInt32)source.ID; break; case "map_id": paramValues[i] = (System.Nullable <System.UInt16>)source.MapID; break; case "quest_id": paramValues[i] = (System.UInt16)source.QuestID; break; case "user_id": paramValues[i] = (System.Int32)source.UserID; break; case "when": paramValues[i] = (System.DateTime)source.When; break; case "x": paramValues[i] = (System.UInt16)source.X; break; case "y": paramValues[i] = (System.UInt16)source.Y; break; } } }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this IShopTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "can_buy": paramValues[i] = (System.Boolean)source.CanBuy; break; case "id": paramValues[i] = (System.UInt16)source.ID; break; case "name": paramValues[i] = (System.String)source.Name; break; } } }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this IEventCountersNpcTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "counter": paramValues[i] = (System.Int64)source.Counter; break; case "npc_event_counter_id": paramValues[i] = (System.Byte)source.NPCEventCounterID; break; case "npc_template_id": paramValues[i] = (System.UInt16)source.NPCTemplateID; break; } } }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this IEventCountersGuildTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "counter": paramValues[i] = (System.Int64)source.Counter; break; case "guild_event_counter_id": paramValues[i] = (System.Byte)source.GuildEventCounterId; break; case "guild_id": paramValues[i] = (System.UInt16)source.GuildID; break; } } }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this IQuestRequireFinishItemTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "amount": paramValues[i] = (System.Byte)source.Amount; break; case "item_template_id": paramValues[i] = (System.UInt16)source.ItemTemplateID; break; case "quest_id": paramValues[i] = (System.UInt16)source.QuestID; break; } } }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this IAccountCharacterTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "account_id": paramValues[i] = (System.Int32)source.AccountID; break; case "character_id": paramValues[i] = (System.Int32)source.CharacterID; break; case "time_deleted": paramValues[i] = (System.Nullable <System.DateTime>)source.TimeDeleted; break; } } }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this ICharacterSkillTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "character_id": paramValues[i] = (System.Int32)source.CharacterID; break; case "skill_id": paramValues[i] = (System.Byte)source.SkillID; break; case "time_added": paramValues[i] = (System.DateTime)source.TimeAdded; break; } } }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this IWorldStatsCountShopBuyTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "count": paramValues[i] = (System.Int32)source.Count; break; case "last_update": paramValues[i] = (System.DateTime)source.LastUpdate; break; case "shop_id": paramValues[i] = (System.UInt16)source.ShopID; break; } } }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The keys must already exist in the DbParameterValues; /// this method will not create them if they are missing. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void CopyValues(this IWorldStatsCountShopBuyTable source, NetGore.Db.DbParameterValues paramValues) { paramValues["count"] = (System.Int32)source.Count; paramValues["last_update"] = (System.DateTime)source.LastUpdate; paramValues["shop_id"] = (System.UInt16)source.ShopID; }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this IWorldStatsCountNpcKillUserTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "count": paramValues[i] = (System.Int32)source.Count; break; case "last_update": paramValues[i] = (System.DateTime)source.LastUpdate; break; case "npc_template_id": paramValues[i] = (System.UInt16)source.NPCTemplateID; break; case "user_id": paramValues[i] = (System.Int32)source.UserID; break; } } }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The keys must already exist in the DbParameterValues; /// this method will not create them if they are missing. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void CopyValues(this IAllianceHostileTable source, NetGore.Db.DbParameterValues paramValues) { paramValues["alliance_id"] = (System.Byte)source.AllianceID; paramValues["hostile_id"] = (System.Byte)source.HostileID; }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The keys must already exist in the DbParameterValues; /// this method will not create them if they are missing. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void CopyValues(this ICharacterSkillTable source, NetGore.Db.DbParameterValues paramValues) { paramValues["character_id"] = (System.Int32)source.CharacterID; paramValues["skill_id"] = (System.Byte)source.SkillID; paramValues["time_added"] = (System.DateTime)source.TimeAdded; }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The keys must already exist in the DbParameterValues; /// this method will not create them if they are missing. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void CopyValues(this IAllianceTable source, NetGore.Db.DbParameterValues paramValues) { paramValues["id"] = (System.Byte)source.ID; paramValues["name"] = (System.String)source.Name; }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The keys must already exist in the DbParameterValues; /// this method will not create them if they are missing. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void CopyValues(this IShopTable source, NetGore.Db.DbParameterValues paramValues) { paramValues["can_buy"] = (System.Boolean)source.CanBuy; paramValues["id"] = (System.UInt16)source.ID; paramValues["name"] = (System.String)source.Name; }
/// <summary> /// Copies the column values into the given DbParameterValues using the database column name /// with a prefixed @ as the key. The key must already exist in the DbParameterValues /// for the value to be copied over. If any of the keys in the DbParameterValues do not /// match one of the column names, or if there is no field for a key, then it will be /// ignored. Because of this, it is important to be careful when using this method /// since columns or keys can be skipped without any indication. /// </summary> /// <param name="source">The object to copy the values from.</param> /// <param name="paramValues">The DbParameterValues to copy the values into.</param> public static void TryCopyValues(this IItemTable source, NetGore.Db.DbParameterValues paramValues) { for (int i = 0; i < paramValues.Count; i++) { switch (paramValues.GetParameterName(i)) { case "action_display_id": paramValues[i] = (System.Nullable <System.UInt16>)source.ActionDisplayID; break; case "amount": paramValues[i] = (System.Byte)source.Amount; break; case "description": paramValues[i] = (System.String)source.Description; break; case "equipped_body": paramValues[i] = (System.String)source.EquippedBody; break; case "graphic": paramValues[i] = (System.UInt16)source.Graphic; break; case "height": paramValues[i] = (System.Byte)source.Height; break; case "hp": paramValues[i] = (System.Int16)source.HP; break; case "id": paramValues[i] = (System.Int32)source.ID; break; case "item_template_id": paramValues[i] = (System.Nullable <System.UInt16>)source.ItemTemplateID; break; case "mp": paramValues[i] = (System.Int16)source.MP; break; case "name": paramValues[i] = (System.String)source.Name; break; case "range": paramValues[i] = (System.UInt16)source.Range; break; case "skill_id": paramValues[i] = (System.Nullable <System.Byte>)source.SkillID; break; case "stat_agi": paramValues[i] = (System.Int16)source.GetStat((DemoGame.StatType)DemoGame.StatType.Agi); break; case "stat_defence": paramValues[i] = (System.Int16)source.GetStat((DemoGame.StatType)DemoGame.StatType.Defence); break; case "stat_int": paramValues[i] = (System.Int16)source.GetStat((DemoGame.StatType)DemoGame.StatType.Int); break; case "stat_maxhit": paramValues[i] = (System.Int16)source.GetStat((DemoGame.StatType)DemoGame.StatType.MaxHit); break; case "stat_maxhp": paramValues[i] = (System.Int16)source.GetStat((DemoGame.StatType)DemoGame.StatType.MaxHP); break; case "stat_maxmp": paramValues[i] = (System.Int16)source.GetStat((DemoGame.StatType)DemoGame.StatType.MaxMP); break; case "stat_minhit": paramValues[i] = (System.Int16)source.GetStat((DemoGame.StatType)DemoGame.StatType.MinHit); break; case "stat_req_agi": paramValues[i] = (System.Int16)source.GetReqStat((DemoGame.StatType)DemoGame.StatType.Agi); break; case "stat_req_int": paramValues[i] = (System.Int16)source.GetReqStat((DemoGame.StatType)DemoGame.StatType.Int); break; case "stat_req_str": paramValues[i] = (System.Int16)source.GetReqStat((DemoGame.StatType)DemoGame.StatType.Str); break; case "stat_str": paramValues[i] = (System.Int16)source.GetStat((DemoGame.StatType)DemoGame.StatType.Str); break; case "type": paramValues[i] = (System.Byte)source.Type; break; case "value": paramValues[i] = (System.Int32)source.Value; break; case "weapon_type": paramValues[i] = (System.Byte)source.WeaponType; break; case "width": paramValues[i] = (System.Byte)source.Width; break; } } }