Stupid question maybe, yet still.
public class Foo : EntityObject
{
public Bar Bar { get; set; } // navigation property
}
public class Bar : EntityObject
{
// whatever
}
// code
var myFoo = Foo.Create(); // detached state after this line
var myBar = LoadMyBarFromDatabase(); // Bar comes from DB
myFoo.Bar = myBar; // myFoo.EntityState changes to 'Added'
I do not need myFoo
to be added to the database. It must remain detached. I just need it as a fake container of Bar
for some time. Nothing else.
Thoughts?
(At the moment I only have a thought to add a new interface IFoo
and implement it in FakeFoo
class, which is not an EntityObject
.