Partial SELECT

Topics: Developer Forum, Project Management Forum, User Forum
May 14, 2010 at 11:48 AM
Edited May 14, 2010 at 11:52 AM


I've a big table with a big amount of columns. Sometimes, i want to be able to retrieve only 3 columns and map them to 3 properties of my DbObject, other times i need to obtain all columns (so i can't use Exclude attribute). Here is my DbObject:

    public abstract class Dummy : DbObjectModelBase<Dummy, string>
        [DbKey(IsDbGenerate = false, UnsavedValue = "")]
        public abstract string Numero { get; set; }

        public abstract string Descripcion { get; set; }

       ... many many fields


there is any possibility to retrieve some columns from a table and map these to properties?


Juan Pedro Rubio

May 14, 2010 at 12:27 PM

Use DbTable attribute you could map two classes to one table.

BTW: Your model has something wrong about DbKey: the PK already defined in DbObjectModel and its name is "Id" if you inherits from DbObjectModel. You can not define another PK here.