Questions tagged [poco]

Means Plain Old CLR Object, a simple object that does not follow any object model, convention or framework. For questions about the POCO C++ library, please use [poco-libraries].

Means Plain Old CLR Object, a simple object that does not follow any object model, convention or framework. For questions about the POCO C++ library (http://pocoproject.org), please use [poco-libraries].

1553 questions
654
votes
10 answers

Code-first vs Model/Database-first

What are the pros & cons of using Entity Framework 4.1 Code-first over Model/Database-first with EDMX diagram? I'm trying to fully understand all the approaches to building data access layer using EF 4.1. I'm using Repository pattern and IoC. I know…
436
votes
10 answers

Plain Old CLR Object vs Data Transfer Object

POCO = Plain Old CLR (or better: Class) Object DTO = Data Transfer Object In this post there is a difference, but frankly most of the blogs I read describe POCO in the way DTO is defined: DTOs are simple data containers used for moving data between…
Patrick Peters
  • 9,456
  • 7
  • 57
  • 106
280
votes
11 answers

'POCO' definition

Can someone define what exactly 'POCO' means? I am encountering the term more and more often, and I'm wondering if it is only about plain classes or it means something more?
saku
  • 3,476
  • 2
  • 19
  • 12
183
votes
12 answers

Entity Framework 4 / POCO - Where to start?

I've been programming for a while and have used LINQ-To-SQL and LINQ-To-Entities before (although when using entities it has been on a Entity/Table 1-1 relationship - ie not much different than L2SQL) I've been doing a lot of reading about Inversion…
Basic
  • 26,321
  • 24
  • 115
  • 201
111
votes
5 answers

Update relationships when saving changes of EF4 POCO objects

Entity Framework 4, POCO objects and ASP.Net MVC2. I have a many to many relationship, lets say between BlogPost and Tag entities. This means that in my T4 generated POCO BlogPost class I have: public virtual ICollection Tags { // getter…
peterfoldi
  • 7,451
  • 5
  • 21
  • 19
107
votes
4 answers

Code First: Independent associations vs. Foreign key associations?

I have a mental debate with myself every time I start working on a new project and I am designing my POCOs. I have seen many tutorials/code samples that seem to favor foreign key associations: Foreign key association public class Order { public…
Daniel Liuzzi
  • 16,807
  • 8
  • 52
  • 57
87
votes
1 answer

What is POCO in Entity Framework?

I just started learning POCO but I cannot understand the usage and advantage. Even the following link of StackOverflow did not help me. what is Entity Framework with POCO Can anybody explain the usage of POCO with a simple example?
user1556433
84
votes
7 answers

What does POCO mean?

I have seen many articles about POCO. What is this?
chugh97
  • 9,602
  • 25
  • 89
  • 136
79
votes
9 answers

Using JsonConvert.DeserializeObject to deserialize Json to a C# POCO class

Here is my simple User POCO class: /// /// The User class represents a Coderwall User. /// public class User { /// /// A User's username. eg: "sergiotapia, mrkibbles, matumbo" /// public…
Only Bolivian Here
  • 35,719
  • 63
  • 161
  • 257
46
votes
8 answers

What exactly is "persistence ignorance"?

Persistence ignorance is typically defined as the ability to persist & retrieve standard .NET objects (or POCOs if you really insist on giving them a name). And a seemingly well accepted definition of a standard .NET object is: "...ordinary classes…
Greg Beech
  • 133,383
  • 43
  • 204
  • 250
43
votes
3 answers

Why is my Entity Framework Code First proxy collection null and why can't I set it?

I am using DBContext and have two classes whose properties are all virtual. I can see in the debugger that I am getting a proxy object when I query the context. However, a collection property is still null when I try to add to it. I thought that the…
Rob Kent
  • 5,183
  • 4
  • 33
  • 54
43
votes
3 answers

Generate POCO classes in different project to the project with Entity Framework model

I'm trying to use the Repository Pattern with EF4 using VS2010. To this end I am using POCO code generation by right clicking on the entity model designer and clicking Add code generation item. I then select the POCO template and get my…
Max
  • 1,543
  • 2
  • 16
  • 31
41
votes
4 answers

Entity Framework loading child collection with sort order

I have two tables a parent and a child table. The child table has a column sortorder (a numeric value). Because of the missing support of the EF to persist a IList inclusive the sort order without exposing the sortorder (see: Entity Framework…
X181
  • 753
  • 1
  • 5
  • 12
41
votes
5 answers

Automapper : mapping issue with inheritance and abstract base class on collections with Entity Framework 4 Proxy Pocos

I am having an issue using AutoMapper (which is an excellent technology) to map a business object to a DTO where I have inheritance off of an abstract base class within a collection. Here are my objects: abstract class Payment class CashPayment :…
Ken Burkhardt
  • 3,528
  • 6
  • 33
  • 45
37
votes
7 answers

how to manage _id field when using POCO with mongodb c# driver

If I want to read and write mongo data with a POCO public class Thingy { public string Foo {get;set;} } ... coll.Insert(new Thing(Foo = "hello")); When I read back I get a failure saying that _id is an unexpected attribute (which it is). So…
pm100
  • 48,078
  • 23
  • 82
  • 145
1
2 3
99 100