// use ordinals to speed up access to DataReader // links: // docLink: http://sql2x.org/documentationLink/327451c3-64a8-4de8-b359-76742d634497 // parameters: // reader: IDataReader from SQLClient public void Populate(IDataReader reader, ProductReferenceAttributeSearchWithFilterDataOrdinals ordinals) { if (!reader.IsDBNull(ordinals.ProductAttributeName)) { ProductAttributeName = reader.GetString(ordinals.ProductAttributeName); } if (!reader.IsDBNull(ordinals.ProductAttributeRcd)) { ProductAttributeRcd = reader.GetString(ordinals.ProductAttributeRcd); } if (!reader.IsDBNull(ordinals.DateTime)) { DateTime = reader.GetDateTime(ordinals.DateTime); } }
/// <summary> /// Get Product Attribute Ref /// links: /// docLink: http://sql2x.org/documentationLink/06760f02-f3ec-45ad-bbfe-db43d7a0378f /// </summary> /// <template>DotNetFrameworkByServiceTableCrud</template> /// <cardinality>Many</cardinality> public List <ProductReferenceAttributeSearchWithFilterData> ProductReferenceAttributeSearchWithFilter() { var ret = new List <ProductReferenceAttributeSearchWithFilterData>(); string sql = @" select [par].product_attribute_name ,[par].product_attribute_rcd ,[par].date_time from product_attribute_ref as [par] where 1 = 1 "; using (var conn = new SqlConnection(ConfigurationManager.AppSettings["Conn"])) { conn.Open(); using (var command = new SqlCommand(sql, conn)) { command.CommandText = sql; // Logging log = Logging.PerformanceTimeStart("ProductReferenceAttributeSearchWithFilter"); IDataReader reader = command.ExecuteReader(CommandBehavior.SingleResult); // log.PerformanceTimeStop(sql, command); var ordinals = new ProductReferenceAttributeSearchWithFilterDataOrdinals(reader); while (reader.Read()) { var data = new ProductReferenceAttributeSearchWithFilterData(); data.Populate(reader, ordinals); ret.Add(data); } reader.Close(); } return(ret); } }