Wednesday, 15 June 2011

.net - Can Entity Framework classes have non-Entity Framework members? -



.net - Can Entity Framework classes have non-Entity Framework members? -

i have properties want in database have functions, , members don't want in database in same class? bad idea?

functions not stored in database. can exclude members database mapping (property or class not stored in database). can notmapped attribute:

[notmapped] public string bar { get; set; }

or ignore in fluent mapping:

protected override void onmodelcreating(dbmodelbuilder modelbuilder) { modelbuilder.entity<foo>().ignore(f => f.bar); base.onmodelcreating(modelbuilder); }

.net entity-framework

No comments:

Post a Comment