Hi all,
I'm trying to project the results of a stored procedure on to an entity collection. It all works fine, the only problem is that the fields.state property is set to new. I need it to be 'fetched' as this gets checked during a separate process. Is there an easy way of setting this field during the projection process? Or do I have to loop around the entire collection again?
Current code
ProductCollection products = new ProductCollection(new ExtendedProductFactory());
using (IRetrievalQuery query = RetrievalProcedures.GetFuzzyProductSearchCallAsQuery(keyword))
{
TypedListDAO dao = new TypedListDAO();
using (IDataReader reader = dao.GetAsDataReader(null, query, CommandBehavior.CloseConnection))
{
List<IDataValueProjector> valueProjectors = new List<IDataValueProjector>();
valueProjectors.Add(new DataValueProjector(ProductFieldIndex.Id.ToString(), 2, typeof(int)));
valueProjectors.Add(new DataValueProjector(ProductFieldIndex.Code.ToString(), 3, typeof(string)));
valueProjectors.Add(new DataValueProjector(ProductFieldIndex.Name.ToString(), 4, typeof(string)));
etc etc...
DataProjectorToIEntityCollection projector = new DataProjectorToIEntityCollection(products);
dao.GetAsProjection(valueProjectors, projector, reader);
reader.Close();
}
}
return products;
Thanks in advance,
Chris Moseley.