poco

How to runtime proxy POCOs?

I would like to be able to create a runtime proxy for a POCO, in the same style as I might in Java using the JRE or cglib proxying libraries. I've seen Castle DynamicProxy which looks like it fits the bill, but the documentation isn't great. I'm also surprised that this kind of thing isn't in the .Net Framework itself. Does anyone: K...

Corrupting POCO Domain Model when creating LINQ Entity Classes?

Say I've got a domain model created from C# classes like this: public class MyClass { public string MyProperty { get; set; } } Along with the model, I have defined repository interfaces classes for IoC. Now, I'm trying to turn this POCO domain model into a set of Entity classes using LINQ mapping. (This approch was recommended in a b...

LinqtoSQL -- Mapping Problem: Unable to resolve root for type

We are experimenting with several different persistence layers for our current project. We are trying for a POCO/PI approach. One of our candidates is LinqToSql. I am following the work presented by Vijay Mehta in "Pro LINQ Object Relational Mapping with C# 2008", in which the POCOs and the mapping files are created by hand. I have t...

DDD, Repository, & Encapsulation

I apologize in advance if folks think this has been beaten to death. I've just spent the last few hours searching and reading many excellent posts here in SO but I'm still confused. The source of my confusion is DTO vs. DDD and repositories. I want my POCO domain objects to have the smarts, and I want to get them from repositories. But ...

Trying to find the top 3 properties of a POCO instance.

Hi folks, I have a simple POCO class that contains the student's scores. eg. Math - 83% Engrish - 82% Chemistry - 81% Drama - 100% etc.. Is there a way (using linq?) that i could figure out the top 3 properties ordered by score? I'm assuming the final object will be an IList of an anonymous type, which will have two fields. Name (t...

Can't do projections to Persistence Ignorance (POCO) class using EFPocoAdapter

Given a simple POCO class such as: public class User { public int Id { get; set; } public string Name { get; set; } public string Password { get; set; } } When I try a query with projection to itself like so: using (var context = new Context()) { var user = context.User.Select(u => new User { Id = u.Id }).FirstOrDefault(); } ... I ...

Virtual vs Interface poco, what's faster?

I am maintaining an application which has been designed like this: messy code --abuses--> simplePoco (POCO data capsule) The data capsule is a simple class with lots of getters and setters (properties) It uses a DI framework and consistently use the IoC container to provide instances of the data capsule (lucky me!). The problem is, I...

Converting from base object to inherrited object

I'm trying to go the opposite way of what you would normally do. I have two POCO classes A and B where B inherrits from A public class A { public int Foo { get; set; } } public class B : A { public int Bar { get; set; } } B is ment as an extention to A with additional information. I start by having an instance of class A A a...

Entity Framework connection metadata extraction

Hi, I am using the EntityFramework POCO adapter and since there are limitations to what microsoft gives access to with regards to the meta data, i am manually extracting the information i need out of the xml. The only problem is i want to get the ssdl, msl, csdl file names to load without having to directly check for the connection stri...

Trying to find the top 3 properties of a POCO instance, Part 2

Hi folks, a month ago I asked this question: Trying to find the top 3 properties of a POCO instance. Got an answer, worked well. Now, I'm trying to find the top 3 properties of a POCO object (like my previous question) but where each property has a WEIGHT. The value of the property comes first. The weight then comes in second ... if tw...

Serialize to XML - private properties

Hello. I'm looking for a way to serialize a POCO that contains some read-only properties. In some Google and StackOverflow searches, I've seen the following suggestions: use DataContractSerializer; or use SoapFormatter or BinaryFormatter; or replace my readonly properties by read/write properties; My classes are very simple, they loo...

How do I convert a datatable into a POCO object in Asp.Net MVC?

How do I convert a datatable into a POCO object in Asp.Net MVC? ...

How to format some ASP.NET MVC Json result?

Hi folks, i've got a really simple POCO (business) object which I'm returning to the client as some json, using ASP.NET MVC. eg. (please ignore the lack of error checking, etc). public JsonAction Index() { Foo myFoo = MyService(); return Json(myFoo); } kewl. Now, this object includes following public properties... public cl...

Is a POCO not supposed to have a base class?

I have 3 different types of data: images, videos, and audio clips. Each one has an associated GPS point, so I have a base class as such: public abstract class Data { public Latitude { get; set; } public Longitude { get; set; } } This is so I can plot everything on a map without worrying about what kind of data it is. However, ...

Linq2Sql generated classes able to put into a separate project?

Can anyone tell me if its possible to extract the linq2sql generated classes into a separate project in c#? - I presume I can just create the files and then copy them to a new project and add a reference to my Data project? The problem I have is that I have my UI, Service Layer and Data layer... Currently the data layer also has the ge...

Should I put validation logic in a POCO?

Let's say I have a POCO like so: public class Name { public string FirstName { get; set; } public string LastName { get; set; } } FirstName and LastName cannot be null. Should I add in a method like this: public List<Error> Validate() { var errors = new List<Error>(); if (String.IsNullOrEmpty(FirstName)) erro...

Linux runtime linker error

Hi All - I'm working though the First Steps tutorial on the POCO Project site, and I've successfully built the library (Debian Linux, 2.6.26, gcc 4.3.2) under my home directory ~/Development/POCO with the shared libraries located in ~/Development/POCO/lib/Linux/x86_64/lib My problem is that any application I build that depends on t...

Poco C++ SAX parser: how to get element "inner text"?

I've been going over the Poco SAX parser header files a few times but I can't seem to find any info on how to obtain an element's inner text. For example: <description>This is the inner text.</description> Can anyone point me in the right direction? ...

C# code to serialize plain-old-CLR-objects to JSON

Within an ASP.NET application, I'd like to serialize a collection of plain-old-CLR-objects (POCO) to a JSON string, which will then be sent down to the client as part of a web response. Is there a light-weight C# library that does this? ...

POCO C++ - NET SSL - how to POST HTTPS request

Hello How to correctly do a POST to HTTPS server and embed the login data correctly. Below code does not return any cookies (in Wininet it does). I wonder how POCO HTTP library handles HTTP redirections? MyApp() { try { const Poco::URI uri( "https://localhost.com" ); const Poco::Net::Context::Ptr context( new Po...