I'm using a SqlDataReader to populate an entity in a Winform app. The entity class has several foreign key attributes in the database that I want to setup as properties in the entity class. Each property will be of type 'Attribute' with an ID & Description property.
Some of the users of the system are far from the database, so data access performance is a serious consideration.
I could either execute the SqlCommand.ExecuteReader multiple times (once for each attribute) against a stored proc that returns a single resultset, or I could execute the SqlCommand.ExecuteReader once against a stored proc that returns multiple result sets and use the SqlDataReader.NextResult to move through them and setup the attributes.
If I loop through with .NextResult, I get into some issues with making sure the stored proc and the property assignment looping are aligned. If the order of SELECT statements in the proc change order, then the assignment order in the winform app would get messed up.
If the SqlDataReader goes back to the database for each read anyway, is there much time added executing the SqlCommand.ExecuteReader? Doing an ExecuteReader for each attribute would make things clearer on the assignment side.
Thanks!