Print Page | Close Window

Adding aggregation columns dynamically to entities

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3274
Printed Date: 24-Apr-2024 at 3:01am


Topic: Adding aggregation columns dynamically to entities
Posted By: Thomas
Subject: Adding aggregation columns dynamically to entities
Date Posted: 21-Feb-2012 at 2:12am
I am trying to add a aggregated column to one of my entities and so this column should not get persisted or treated in any way by DevForce. I do this because I would like to show a column with all the invoices (seperated by a comma) in a table where the shipment info should be displayed (and this information should be possible to be edited) and the table should be generated automatically from the model (this works perfectly for entities).

I don't know if there is maybe some attribute that I could apply to my "table entity" so that I would only extend the base entity with these columns and the EntityManager knows that he has to treat this class like the base class or if I have to write some mapper code to create a base entity again and persist/work with this one.



Replies:
Posted By: kimj
Date Posted: 21-Feb-2012 at 12:54pm
Hi Thomas,
 
You can add custom properties to either your entity classes or to an "injected" base type. 
 
Here's some information on adding custom properties:  http://drc.ideablade.com/xwiki/bin/view/Documentation/model-partial-class-file - http://drc.ideablade.com/xwiki/bin/view/Documentation/model-partial-class-file
 
And on injected base types:  http://drc.ideablade.com/xwiki/bin/view/Documentation/model-custom-base-class - http://drc.ideablade.com/xwiki/bin/view/Documentation/model-custom-base-class
 
If you're using a Code First model you do need to decorate these custom properties with a NotMapped attribute, but for other model types there's nothing special you need to do to tell DevForce not to persist them.
 



Print Page | Close Window