Partial SELECT

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

Hi,

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:

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

        [DbColumn("TARJ_DESCRIPCION")]
        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?

Thanks

Juan Pedro Rubio
INDITAR

Coordinator
May 14, 2010 at 11:27 AM

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.