Questions tagged [poco]

Plain Old CLR Object

Plain Old CLR Object or POCO is a play on the term POJO, from the Java EE programming world (which was coined by Martin Fowler in 2000 [1]), and is used by developers targeting the Common Language Runtime of the .NET Framework. Simply put, a POCO object does not have any dependency on an external framework. It is PLAIN.

9 questions
18
votes
4 answers

Use composition and inheritance for DTOs

We have a ASP.NET Web API that provides a REST API for our Single Page Application. We use DTOs/POCOs to pass data through this API. The problem is now, that these DTOs are getting bigger over time, so now we want to refactor the DTOs. I am looking…
officer
  • 299
  • 1
  • 2
  • 6
16
votes
3 answers

What is the benefit to having pure POCO models?

What is the major benefit of having pure POCO models? I get that Models should be clean and simple, but I tend to like to keep the maintenance of child objects within the model classes. For example if I have a ClassA and ClassB defined as…
Jesse
  • 321
  • 1
  • 2
  • 7
3
votes
2 answers

Web API - strong classes or dynamic?

My web api method should return some structured data about my profile. To do it I created the following POCO classes: public class ProfileInfo { public string FirstName { get; set; } public string LastName { get; set; } //.... …
user285336
  • 205
  • 3
  • 6
2
votes
2 answers

Entity Framework Code First, C# class separation and EAV

I'm in the process of redesigning a portion of my ASP.NET MVC application. I'm currently using Entity Framework 6.1 code first approach. I've been reading as of late that (Correct me if I'm wrong, I don't know much about DBs): Joins are expensive;…
Jose A
  • 275
  • 3
  • 12
1
vote
2 answers

Where to place POCOs validation - N-layers architecture

I am developing an n-layer app. One of the layer is the BusinessLayer and consumes a set of POCOs defined in the CoreLayer. Also I have a PresentationLayer (WinForms) CoreLayer POCOs (classes with properties) Repository interfaces (use the POCOs as…
X.Otano
  • 612
  • 2
  • 7
  • 17
1
vote
2 answers

How about using a DTO class as a property in the corresponding BO class?

I was reading this blog post and liked the idea of using the DTO class for an entity and using it as a property in the corresponding business object class like so: public class Person : BALBase { public PersonDTO Data { get; set; } This…
Tony_Henrich
  • 565
  • 4
  • 7
0
votes
1 answer

How to design thread safe class when separating business logic from POCOs

I like to separate business logic out of POCOs into controllers. If an object must be thread safe, where do I put the lock code? In the POCO itself? Or in a controller? Might make sense because value types cannot be locked? I.e., the…
Hoppe
  • 101
  • 5
-2
votes
1 answer

How do I use the same entities in multiple projects with the entity framework?

I have to create two different projects with the Entity Framework: Web API Services UI and Business Logic (MVC). Both the projects have to work with same POCO entities. I see two alternatives and would like to know the pros and cons of each, and…
MNP
  • 9
  • 1
-2
votes
1 answer

Why C# ASP.NET MVC Code First POCO Classes must have getters and setters?

Why in, C# ASP.NET MVC Code First project, POCO Classes must have getters and setters ( {get; set; } ) in order to work? public float data { get; set; } or in db context class public DbSet MyData{ get; set; } I just don't…
Daniel Santos
  • 405
  • 4
  • 13