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].

1502 questions
631
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…
416
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,103
  • 7
  • 53
  • 99
252
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,118
  • 2
  • 17
  • 11
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
  • 25,223
  • 23
  • 108
  • 188
107
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,171
  • 5
  • 19
  • 19
104
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
  • 15,494
  • 8
  • 47
  • 54
85
votes
1 answer

What is POCO in Entity Framework?

I just started learning POCO but cannot understand its use and advantage. Even 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
81
votes
7 answers

What does POCO mean?

I have seen many articles about POCO. What is this?
chugh97
  • 8,936
  • 24
  • 81
  • 132
68
votes
7 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
  • 32,571
  • 60
  • 151
  • 250
44
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,522
  • 2
  • 15
  • 31
41
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,093
  • 4
  • 31
  • 52
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,478
  • 5
  • 30
  • 45
41
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
  • 122,952
  • 42
  • 199
  • 241
37
votes
3 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
  • 713
  • 1
  • 5
  • 12
37
votes
5 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
  • 32,399
  • 19
  • 69
  • 124
1
2 3
99 100