1

In a previous post, someone suggested an interesting approach to a problem I'm trying to solve. the solution included adding a property to one of my classes, a class that is generated by the Entity Framework.

Is there any way to exclude this new property from being stored by EF? so I have something like:

public partial class User
{
    UserState state; // property I do not want stored in the database

where User has a bunch of properties defined elsewhere by EF?

thanks - e

Community
  • 1
  • 1
ekkis
  • 9,804
  • 13
  • 55
  • 105
  • 1
    i'm probably missing the main point, but if a property is just added to the class, would the entity framework store it without explicit mapping in the EDMX? – Aaron Anodide Sep 12 '11 at 21:31
  • hmm... that's a good question. I assumed it would be stored but perhaps it isn't... – ekkis Sep 12 '11 at 22:34
  • perhaps your confusing it with n/hibernate? – Aaron Anodide Sep 12 '11 at 22:34
  • why did I get a down vote? is my question unclear? unuseful? what? – ekkis Sep 12 '11 at 22:35
  • @Gabriel, no. I don't use n/hibernate and don't know anything about it... – ekkis Sep 12 '11 at 22:35
  • 1
    anyway, i can confirm that EF will not store things unless they are mapped to a storage entity explcitly, you can extend the partial classes as you wish without fear – Aaron Anodide Sep 12 '11 at 22:36
  • your question was fine, everybody is a different level of expertise - anyway if you get a down vote and no comment to go along with it, just shrug it off.. it's not worth worrying about – Aaron Anodide Sep 12 '11 at 23:33
  • @Gabriel, I have that happen to me often and I lose reputation but there's never feedback on why... anyway, thanks. – ekkis Sep 13 '11 at 00:18

1 Answers1

0

as per @Gabriel above, I need not worry, properties are not automatically stored.

ekkis
  • 9,804
  • 13
  • 55
  • 105