Exclude custom properties on entity in linq to llblgen

Posts   
 
    
aspicer
User
Posts: 65
Joined: 14-Nov-2008
# Posted on: 30-Jul-2010 15:16:42   

We have defined a few custom public getter properties on some of our Entities. We can't select those properties into an anonymous type in Linq to LLBLGen because they don't map to a database field. The code compiles fine, but I will get a runtime exception.

Do you know of a way (possibly an attribute declaration) that I can exclude those custom properties from being eligible for usage in the linq statement?

For example, we have an entity that has a 'Title' custom getter property. The complier allows us to select the custom property into an anonymous type but at runtime we will get an exception because the 'Title' doesn't exist in the actual database. I'd like to know if you know of a way that we can hide those public properties on the entity when being used in a linq expression?

Thanks,

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 31-Jul-2010 04:37:45   

I don't know anything like that. But... What if you just don't use such properties in your queries?

David Elizondo | LLBLGen Support Team
aspicer
User
Posts: 65
Joined: 14-Nov-2008
# Posted on: 02-Aug-2010 14:41:19   

daelmo wrote:

I don't know anything like that. But... What if you just don't use such properties in your queries?

We won't use them in the query, but it would be nice to have a way to exclude a property from being accidently used in the query through the use of some attribute declaration. Thanks anyway.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 02-Aug-2010 14:58:55   

Same here, I don't know whether there is a way around this.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 03-Aug-2010 12:15:00   

No, unfortunately this isn't possible. There's a way to exclude the property from intellisense, but that means it's always hidden, also not what you want.

When we started with Linq, we asked MS if there's a way to filter out properties in linq query intellisense because other properties on our entity classes showed up as well. They replied that there's no such system and that they were thinking about filtering capabilities for scopes but that it wasn't going to be released soon. I.o.w.: no, not possible.

Frans Bouma | Lead developer LLBLGen Pro
aspicer
User
Posts: 65
Joined: 14-Nov-2008
# Posted on: 03-Aug-2010 14:28:09   

Thanks everyone for weighing in.