c# - Telling EF 6 to Ignore a Private Property -


I use the unit framework 6.0.2 to map some handy coded models to an existing database structure I am here. At this time the primary model is:

  the public class event {Public Ent ID} set; } Public Guide Legacy ID {Receive; Set; } Public string note {get; Set; } Public virtual iconging & lt; Event history & gt; History {get; Set; }}  

( Event History Model is not really relevant to it, but this part is working properly, so that EF can record child records for this model Mapping is easy.)

Mapping is simple, and I try to be as clearly as I can (because the application increases there will be some less intuitive mapping):

  public class events map: EntityTypeConfiguration & lt; Occurrence & gt; {Public Opportunity Map () {ToTable ("Event"); HasKey (o = & gt; o.id); Property (o = & gt; OID). Asteruper (). Hack name ("id"); Property (o = & gt; o LegacyID). mandatory (). HasColumnName ("LegacyID"); Property (o = & gt; o Note). IUSUNIDDAD () Iooptional (). Hackle name ("note"); }}  

But if I add a personal property to the model, EF tries to map it to the database. Something like this:

  private event history history history {get; Set; }  

(Internal for the model to maintain that area, there will be some argument for other personal actions.) When EF generates a SELECT statement Is, for a column called CurrentHistory_ID which is definitely not present.

I can make the property public and set the mapping to ignore it:

  Ignore (o => O Content History);  

But I do not want the property to be public, the model is going to track some information internally that the application code should not be seen.

Is EF any way to ignore any and all private members? Even if it is on a per-map basis? I especially want to do EF data annotations without adding myself to the model because it would be only a bit of intangible (only information on firmly established ignorant models) of a leak, but this would also mean that The model that the Domain Core Assembly holds, goes everywhere in the context of EntityFramework.dll , which is not ideal.

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -