Can I creat a custom entity?

Posts   
 
    
BexMed
User
Posts: 63
Joined: 18-Jul-2007
# Posted on: 11-Mar-2009 10:12:28   

Hello!

I need to make an EntityCollection built up of entities that aren't related to tables in the DB.

I just need a collection of data I can bind to a grid that is made up of custom columns containing values dervied from custom functions.

Before LLBL I would have used a dataset and just added custom columns and then just added data to them..

Do I need to still do it this way or can I create a custom entity.

Thanks

Bex

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 11-Mar-2009 10:31:22   

You can't create custom entities nor there is a need to do so.

If you are displaying fields from more than one entity (fetrched from the database), you may use a DynamicList (DataTable), to fetch the fields and display them in a flat way.

BexMed
User
Posts: 63
Joined: 18-Jul-2007
# Posted on: 11-Mar-2009 10:43:24   

Hello!

Maybe I need to explain exactly what I am trying to do.

I have a tracking table called JobTracking which tracks all changes on a job, this table has columns for each property of a job so it can be used for reporting some of the columns in this table are as follows:

TrackingID JobID DateChanged UserID NumPages Qty BindingType PaperType DeliveryMethod Price

I need to create a grid of the history of a job this will have column names something like this:

DateChanged FieldName (this actually refers to the column names of the JobTracking Table.. Num Pages, Qty, BindingType, PaperType, deliveryMethod..) PreviousValue New Value Price

So Ideally I would like to create an entity or something that I can add properties to that are the headers of my grid and populate it in code myself so I can just bind from it.

Thanks

Bex

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 11-Mar-2009 10:50:04   

A DataTable...?

Or just create your own class - almost any grid will bind to any collection/list/dictionary of any class.

Matt

BexMed
User
Posts: 63
Joined: 18-Jul-2007
# Posted on: 11-Mar-2009 10:53:02   

Thanks MTrinder. I know I can use a datatable, I was just hoping I could use an EntityCollection because I like working with them.

simon831
User
Posts: 152
Joined: 19-Jan-2006
# Posted on: 13-Mar-2009 17:10:27   

Don't fully understand what you are trying to do, but do some reading about 'dependancy injection'.

Basically you have a normal JobTrackingEntity that has a column defined in the partial class that is not mapped to an actual column in the table. In here you can use dependency injection to decide what value that column should have.

BexMed
User
Posts: 63
Joined: 18-Jul-2007
# Posted on: 13-Mar-2009 17:16:30   

Hello Simon...

Sorted now.. used a dataset, much easier, but thanks for that!

Honestly replying to me on a forum..!!

Bex