I have read about POCO (Plain old CLR (or C#) object) here ,and confused about usage of it.
If i can go with Code First approach then weather i need to create .edmx file? Without that how can i use poco with code first approach?
Please correct me if i understood something wrong in this case!
Thanks.
POCO in EF is an entity class which is not dependent on EF = it doesn't derive from EF specific class (EntityObject
) and it doesn't contain EF dependent code (including EF specific attributes).
Code first always uses POCO (in terms of EF) because you write the class yourselves and it doesn't need to be derived from any EF specific parent. The corner case is situation where you are using data annotations for mapping because some data annotations are available only in EntityFramework.dll assembly - using these annotations violates POCO because your entity classes will become dependent on EF assembly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With