public void Add(TestSqlEntityData value) { if (!immutable) { List.Add(value); } else { throw new System.Data.ReadOnlyException(); } }
public void Insert(Int32 index, TestSqlEntityData value) { if (!immutable) { List.Insert(index, value); } else { throw new System.Data.ReadOnlyException(); } }
/// <summary> /// Finds a TestSqlEntity entity using it's primary key. /// </summary> /// <returns>A TestSqlEntityData object.</returns> /// <exception cref="Spring2.Core.DAO.FinderException">Thrown when no entity exists witht he specified primary key..</exception> public static TestSqlEntityData Load() { WhereClause w = new WhereClause(); SqlDataReader dataReader = GetListReader(CONNECTION_STRING_KEY, VIEW, w, null); if (!dataReader.Read()) { dataReader.Close(); throw new FinderException("Load found no rows for TestSqlEntity."); } TestSqlEntityData data = GetDataObjectFromReader(dataReader); dataReader.Close(); return(data); }
/// <summary> /// Updates a record in the TestSqlEntities table. /// </summary> /// <param name=""></param> public static void Update(TestSqlEntityData data, SqlTransaction transaction) { // Create and execute the command SqlCommand cmd = GetSqlCommand(CONNECTION_STRING_KEY, "spTestSqlEntities_Update", CommandType.StoredProcedure, COMMAND_TIMEOUT, transaction); //Create the parameters and append them to the command object cmd.Parameters.Add(new SqlParameter("@float", SqlDbType.Float, 10, ParameterDirection.Input, false, 0, 0, "FloatProperty", DataRowVersion.Proposed, data.FloatProperty.DBValue)); cmd.Parameters.Add(new SqlParameter("@datetime", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, "DateTimeProperty", DataRowVersion.Proposed, data.DateTimeProperty.DBValue)); cmd.Parameters.Add(new SqlParameter("@bigint", SqlDbType.BigInt, 0, ParameterDirection.Input, false, 0, 0, "BigIntProperty", DataRowVersion.Proposed, data.BigIntProperty)); cmd.Parameters.Add(new SqlParameter("@bit", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, "BitProperty", DataRowVersion.Proposed, data.BitProperty.DBValue)); cmd.Parameters.Add(new SqlParameter("@smallint", SqlDbType.SmallInt, 0, ParameterDirection.Input, false, 0, 0, "SmallIntProperty", DataRowVersion.Proposed, data.SmallIntProperty.DBValue)); cmd.Parameters.Add(new SqlParameter("@tinyint", SqlDbType.TinyInt, 0, ParameterDirection.Input, false, 0, 0, "TinyIntProperty", DataRowVersion.Proposed, data.TinyIntProperty.DBValue)); cmd.Parameters.Add(new SqlParameter("@smallmoney", SqlDbType.SmallMoney, 0, ParameterDirection.Input, false, 0, 0, "SmallMoneyProperty", DataRowVersion.Proposed, data.SmallMoneyProperty.DBValue)); cmd.Parameters.Add(new SqlParameter("@money", SqlDbType.Money, 0, ParameterDirection.Input, false, 0, 0, "MoneyProperty", DataRowVersion.Proposed, data.MoneyProperty.DBValue)); cmd.Parameters.Add(new SqlParameter("@text", SqlDbType.Text, 0, ParameterDirection.Input, false, 0, 0, "TextProperty", DataRowVersion.Proposed, data.TextProperty.DBValue)); cmd.Parameters.Add(new SqlParameter("@smalldatetime", SqlDbType.SmallDateTime, 0, ParameterDirection.Input, false, 0, 0, "SmallDateTimeProperty", DataRowVersion.Proposed, data.SmallDateTimeProperty.DBValue)); cmd.Parameters.Add(new SqlParameter("@char", SqlDbType.Char, 10, ParameterDirection.Input, false, 0, 0, "CharProperty", DataRowVersion.Proposed, data.CharProperty.DBValue)); cmd.Parameters.Add(new SqlParameter("@varchar", SqlDbType.VarChar, 10, ParameterDirection.Input, false, 0, 0, "VarCharProperty", DataRowVersion.Proposed, data.VarCharProperty.DBValue)); cmd.Parameters.Add(new SqlParameter("@int", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "IntProperty", DataRowVersion.Proposed, data.IntProperty.DBValue)); cmd.Parameters.Add(new SqlParameter("@numeric", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 10, 3, "NumericProperty", DataRowVersion.Proposed, data.NumericProperty.DBValue)); cmd.Parameters.Add(new SqlParameter("@decimal", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 10, 3, "DecimalProperty", DataRowVersion.Proposed, data.DecimalProperty.DBValue)); cmd.Parameters.Add(new SqlParameter("@nchar", SqlDbType.NChar, 10, ParameterDirection.Input, false, 0, 0, "NCharProperty", DataRowVersion.Proposed, data.NCharProperty.DBValue)); cmd.Parameters.Add(new SqlParameter("@ntext", SqlDbType.NText, 0, ParameterDirection.Input, false, 0, 0, "NTextProperty", DataRowVersion.Proposed, data.NTextProperty.DBValue)); cmd.Parameters.Add(new SqlParameter("@nvarchar", SqlDbType.NVarChar, 10, ParameterDirection.Input, false, 0, 0, "NVarCharProperty", DataRowVersion.Proposed, data.NVarCharProperty.DBValue)); cmd.Parameters.Add(new SqlParameter("@real", SqlDbType.Real, 0, ParameterDirection.Input, false, 0, 0, "RealProperty", DataRowVersion.Proposed, data.RealProperty.DBValue)); cmd.Parameters.Add(new SqlParameter("@uniqueidentifier", SqlDbType.UniqueIdentifier, 0, ParameterDirection.Input, false, 0, 0, "UniqueIdentifierProperty", DataRowVersion.Proposed, data.UniqueIdentifierProperty)); // Execute the query cmd.ExecuteNonQuery(); // do not close the connection if it is part of a transaction if (transaction == null) { cmd.Connection.Close(); } }
public Int32 IndexOf(TestSqlEntityData value) { return(List.IndexOf(value)); }
public Boolean Contains(TestSqlEntityData value) { return(List.Contains(value)); }
/// <summary> /// Updates a record in the TestSqlEntities table. /// </summary> /// <param name=""></param> public static void Update(TestSqlEntityData data) { Update(data, null); }
/// <summary> /// Inserts a record into the TestSqlEntities table. /// </summary> /// <param name=""></param> public static void Insert(TestSqlEntityData data) { Insert(data, null); }
/// <summary> /// Builds a data object from the current row in a data reader.. /// </summary> /// <param name="dataReader">Container for database row.</param> /// <returns>Data object built from current row.</returns> private static TestSqlEntityData GetDataObjectFromReader(SqlDataReader dataReader) { TestSqlEntityData data = new TestSqlEntityData(); if (dataReader.IsDBNull(dataReader.GetOrdinal("float"))) { data.FloatProperty = DecimalType.UNSET; } else { data.FloatProperty = new DecimalType(dataReader.GetDouble(dataReader.GetOrdinal("float"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("datetime"))) { data.DateTimeProperty = DateType.UNSET; } else { data.DateTimeProperty = new DateType(dataReader.GetDateTime(dataReader.GetOrdinal("datetime"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("bigint"))) { data.BigIntProperty = 0; } else { data.BigIntProperty = dataReader.GetInt64(dataReader.GetOrdinal("bigint")); } if (dataReader.IsDBNull(dataReader.GetOrdinal("bit"))) { data.BitProperty = BooleanType.UNSET; } else { data.BitProperty = BooleanType.GetInstance(dataReader.GetBoolean(dataReader.GetOrdinal("bit"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("smallint"))) { data.SmallIntProperty = IntegerType.UNSET; } else { data.SmallIntProperty = new IntegerType(dataReader.GetInt16(dataReader.GetOrdinal("smallint"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("tinyint"))) { data.TinyIntProperty = IntegerType.UNSET; } else { data.TinyIntProperty = new IntegerType(dataReader.GetByte(dataReader.GetOrdinal("tinyint"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("smallmoney"))) { data.SmallMoneyProperty = CurrencyType.UNSET; } else { data.SmallMoneyProperty = new CurrencyType(dataReader.GetDecimal(dataReader.GetOrdinal("smallmoney"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("money"))) { data.MoneyProperty = CurrencyType.UNSET; } else { data.MoneyProperty = new CurrencyType(dataReader.GetDecimal(dataReader.GetOrdinal("money"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("text"))) { data.TextProperty = StringType.UNSET; } else { data.TextProperty = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("text"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("smalldatetime"))) { data.SmallDateTimeProperty = DateType.UNSET; } else { data.SmallDateTimeProperty = new DateType(dataReader.GetDateTime(dataReader.GetOrdinal("smalldatetime"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("char"))) { data.CharProperty = StringType.UNSET; } else { data.CharProperty = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("char"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("varchar"))) { data.VarCharProperty = StringType.UNSET; } else { data.VarCharProperty = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("varchar"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("int"))) { data.IntProperty = IntegerType.UNSET; } else { data.IntProperty = new IntegerType(dataReader.GetInt32(dataReader.GetOrdinal("int"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("numeric"))) { data.NumericProperty = DecimalType.UNSET; } else { data.NumericProperty = new DecimalType(dataReader.GetDecimal(dataReader.GetOrdinal("numeric"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("decimal"))) { data.DecimalProperty = DecimalType.UNSET; } else { data.DecimalProperty = new DecimalType(dataReader.GetDecimal(dataReader.GetOrdinal("decimal"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("nchar"))) { data.NCharProperty = StringType.UNSET; } else { data.NCharProperty = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("nchar"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("ntext"))) { data.NTextProperty = StringType.UNSET; } else { data.NTextProperty = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("ntext"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("nvarchar"))) { data.NVarCharProperty = StringType.UNSET; } else { data.NVarCharProperty = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("nvarchar"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("real"))) { data.RealProperty = DecimalType.UNSET; } else { data.RealProperty = new DecimalType(dataReader.GetFloat(dataReader.GetOrdinal("real"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("uniqueidentifier"))) { data.UniqueIdentifierProperty = new Guid(); } else { data.UniqueIdentifierProperty = dataReader.GetGuid(dataReader.GetOrdinal("uniqueidentifier")); } return(data); }