EntityKey Property

Sep 4, 2010 at 1:53 PM


Can u explain more about EntityKey Property.

i was using the template which generates CSLA classes form database, but addes EntityKey property to the entity.

which creates error when i bounds control with then list (collection) of then entity because of the EntityKey property.


saying invalid parameter error for EntityKey property of collection, i think compiler going to convert this byte[] to image

i m trying to bind data with sandgrid.


pls help me to over come the problem.



Sep 6, 2010 at 9:34 AM

Hi Akhil.

Lhotka's explanation of the EntityKey: http://forums.lhotka.net/forums/t/9151.aspx

You should remove the grid column that is auto created and bound to the EntityKey.




Sep 6, 2010 at 8:18 PM


The main reason for using the EntityKey is to avoid making a round trip back to the database when you want to update the Business Object.

Behind this is the fact that even though Entity Framework can track changes made to Entity objects, CSLA objects work in a "disconnected" way with regards to Entities. What this means is that as soon as you load the data into the CSLA BO, the EF object is discarded, and this is why you would otherwise need to fetch it again from the DB in order to update it.

With EntityKey, you avoid this round trip, thus improving performace.


Sep 7, 2010 at 7:15 AM
Dear  mrlucmorin,

As my grid is UI part and it is using the biz object, and EntityKey is to update/maintain BO so why it should be public..?
rather that that is must be internal to the biz layer, not need to maintained (or accessible) it by UI layer..?

Am I correct..?

Thanks for reply.

Sep 7, 2010 at 1:13 PM

Hello Akhil,

On the surface I think you may be right, but we need to make sure we're not going to break anything by changing its accessibility.

We'll look into it.

Thanks for bringing it up.