Login Skip Navigation LinksWilsonORMapper > Forums Search
Demo Version Demo Version
Download and try for yourself a fully working demo version, including sample apps and documentation.  The only limitation is that the demo version only works inside the debugger.

PayPal Subscribe
Get It All for $50 USD:
WebPortal, ORMapper,
Source Code, All Updates
PayPal

User Login User Login
Log In
 
 
Reset Password

Wilson ORMapper Forums Wilson ORMapper Forums : Advanced Topics : how to return my specific fiels in GetObjectSet

Date Post
7/7/2006 8:26:33 PM

Hello,

I wrote the code below:

string[] fields = new string[] { "CategoryId" };
DataSet partContacts = Global.Manager.GetDataSet(typeof(Category), String.Empty, fields);

And monitored my SQL Server then i saw the query executed:
SELECT CategoryId FROM [Categories] ORDER BY CategoryName ASC;

But I didn´t get the same with GetObjectSet, the query that object Set execute is:
SELECT [Categories].[CategoryId], [Categories].[CategoryName], [Categories].[Description] FROM [Categories] ORDER BY CategoryName ASC;

Can i return just the CategoryId in getObjectSet  ?

Thank You
Higor

 

7/7/2006 8:30:10 PM Hi Higor:

No, that option only exists for DataSets.  Why?  Because DataSets are non-typed "generic" containers that can contain any number of fields, while ObjectSets are collections of your strongly-typed objects and must therefore contain all the fields expected for your object.  You can get around this by creating two different strong-typed objects, one with all the fields and one with just the ones you want in some situations, with the one inheriting from the other, and then you can choose which type of ObjectSet you want -- but that may be more trouble than its worth.

Thanks, Paul Wilson