Print Page | Close Window

'EntityState' property not available?

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=3446
Printed Date: 03-Jun-2024 at 9:25am


Topic: 'EntityState' property not available?
Posted By: TonyHansen
Subject: 'EntityState' property not available?
Date Posted: 19-May-2012 at 12:58am
Hmmm ... I think I'll really be demonstrating my newbie cred now ...
 
Trying to perform a simple entity deletion, as outlined here:
 
http://drc.ideablade.com/xwiki/bin/view/Documentation/entity-deletion - http://drc.ideablade.com/xwiki/bin/view/Documentation/entity-deletion
 
Only one minor problem ... none of my entities appear to have an "EntityAspect" property I can change!
 
I get my entity from the backend store like this:
 

var contactType = manager.Gen_ContactType

.Where(c => c.ContactTypeId == 7)

.FirstOrNullEntity();

The contactType entity that is returned has all the properties I expect ... but no "EntityAspect" property.
 
Interestingly, when I bound a grid to the object class in my domain model, the grid is actually showing an "EntityAspect" property.
 
So ... what am I doing wrong?
 
I will point out that I used the "Code Second" method of generation, and opted to include the OData option during creation.  As a result, my class header looks like this:
 

/// <summary>The auto-generated Gen_ContactType class. </summary>

[IbAop.ProvideEntityAspect]

[DataContract(IsReference = true)]

[Table("Gen_ContactType", Schema = "dbo")]

[IgnoreProperties(@"EntityAspect")]

[DataServiceKey(@"ContactTypeId")]

public partial class Gen_ContactType

{

All of the samples I've seen appear to pre-date the incorporation of PostSharp, and none seem to have the "EntityAspect" in the "IgnoreProperties".
 
I've tried removing the "IgnoreProperties" attribute ... but that doesn't appear to make any difference.
 
Any suggestions?
 
T



Replies:
Posted By: DenisK
Date Posted: 21-May-2012 at 12:26pm
Hi TonyHansen,

See if this DRC might help.  http://drc.ideablade.com/xwiki/bin/view/Documentation/code-first-entityaspect - http://drc.ideablade.com/xwiki/bin/view/Documentation/code-first-entityaspect


Posted By: TonyHansen
Date Posted: 21-May-2012 at 7:36pm
Ah yes, that's perfect.
 
Maybe I need to go right back to basics, and RTFM! :-D
 
Thanks for the quick reply!

T



Print Page | Close Window