Using C# 8 e ASP.NET Core I have the following:
Context context = new Context();
Post post1 = new Post {
Enabled = true,
Title = "Some title"
};
Post post2 = post1;
post2.Enabled = false;
context.Posts.Add(post1);
context.Posts.Add(post2);
On context
, which is an EF DBContext, I get only one post (post2
);
Maybe I am wrong but I think I should Copy / Clone post1 to define post2.
Am I right? How to do this?