poco

POCO design question

Can/Should my POCO's encompass multiple Databases if applicable? The reason I ask is that I am in the process of refactoring a legacy Enterprise App that was built in stages. Unfortunately, each stage had it's own separate DB (at least they are all on the same SQL instance). Because of this I can easily see where a typical Business ...

Modify Child Object during Gridview OnUpdate using ObjectDataSource

Backgroud: I'm using NHibernate for my model layer, and I have a HTTP module taking care of instantiating the session at the beginning of each request and cleaning it up at the end of each request (i.e. Session Per Request). In this case, I have two object types: ParentItem - an object with a bunch of properties and a collection of...

Entity Framework.. How do I map a self referencial foreign key.. eg Category has many Categories..

I have the following poco class: public class Category : IDisplayName { private ICollection<Category> children; private Category parent; public Category() { children = new List<Category>(); } public int Id { get; set; } public string Name { get; set; } public virtual Category Parent { ...

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<Tag> Tags { // getter and setter with the magic FixupCollection } private ICollection<Tag> _tags; I ask for a B...

Is my understanding of POCO's + Entity Framework v4, correct?

Hi folks, can someone please confirm/correct me, with my understanding of using POCO's with the Entity Framework v4? If I'm going to want to use POCO's with my EF4 context, do I still need to place/create ENTITIES on the designer/.edmx ? Isn't the idea of using POCO's so I don't need to use those 'heavy' entities? or do i still need th...

Entity Framework 4 - How To Map Lookup Table To Enum?

Hi Guys, Suppose i have the following 2 SQL tables: Foo Column DataType --------------------------- Title NVARCHAR(20) Body NVARCHAR(MAX) FooTypeId TINYINT FooType Column DataType -------------------------- FooTypeId TINYINT Name NVARCHAR(10) Now, im using Entity Framework 4.0 with...

Where/when should i validate my data when using EF and POCOs?

I started a project to see what EF 4 can do with POCOs. I created a db and a custom POCO. Now i want to validate my data. For this i'm using the Enterprise Library Validation Block 5. I have no problem including the validation in my POCOs through attributes and using it with Entity Framework but this means that my POCOs wouldn't be POCO...

Is there a FluentNHibernate provider for Active Directory?

I would like to use FluentNHibernate to map an Active Directory user object to a POCO object but can't find a provider in the FluentNHibernate.Cfg.Db namespace that will allow me to setup the connection. This is the data layer of a WCF RIA Service. Is there a way to do this? ...

Adding [DataMember] [DataContract] attributes in Entity Framework POCO Template

I would like some help adding in a POCO .tt Entity Framework template Attributes to support WCF serialization and if its possible how to add namespace usings to each entity. Thank you. ...

What is a good strategy to load a Poco referenced entity when disconected from context in EF4?

i started an ASP.net web project app to learn how EF4 can be used. In my project i have defined 3 layers(DAL => Entity Framework 4, BLL => Business Logic Layer, UI). The BLL and DAL share POCOs generated using the template feature of EF4. For example i have "User" Poco class that looks like this: public partial class User { #regio...

Entity Framework 4, SQLCe with POCO problem on delete.

Hello, I have a SQLCe database which had a unique primary key Id with type uniqueidentifier, and child relationship, 1 to many, where i keep the master id in a column and append unique id for every row too. Now I use POCO entities for my domain model NOT STE. While adding and modifying entities works OK, I have hard time to delete, say ...

Does the Poco C++ Library Support positional command line arguments?

I can see no way to support positional command line arguments with Poco's Poco::Util::Application class and related Poco::Util::OptionProcessor. Positional arguments are unnamed arguments on the command line, coming at the end after all other options, as such: someprogram -b --what=121 filename.bin In that example, filename.bin is a p...

Which is the way to add MVC behavior to existing classes?

Hello, I have a Windows Form project that I would like to migrate toward a web application using ASP.NET MVC2. In this project I have some POCO classes as in this example that are part of a class library and that I would like to use with a binary reference public class Person { public int PersonID { get; set; } public string ...

Entity Framework POCO with WCF software design question

I am going to use Entity Framework and WCF in my application. The suggested practice, as I saw, is using POCO with Entity Framework and also using POCO classes as DataContracts. That is actually what POCO and Attributes are used for, -if I am not wrong. However I am asked to use seperate classses for Entity Framework POCO's and WCF Data...

Entity framework, POCO, DTO

Hi, I'm starting a project using EF 4 and POCO. What is the best practice for sending data to the client ? Should I send the POCO or I should have a DTO instead? Are there any issue I should be aware of when sending the entity (that is disconnected from the context) to the client ? Is it a recommended practice to send the POCO to ...

Can serialize, but cannot deserialize?

I've created POCO classes with T4 Templates for EF 4.0 and generated mock for Context. Everything was great, but i don't like to initialize even small Mock-DB in C# code, so i've created some functions which generates Mock-DB from real DB and i wanted to serialize this object and use it later in some Unit Tests... XML serialization fail...

Entity Framework 4 POCO CRUD Repository - How to perform Smart INSERT/UPDATE?

Hi Guys, This could be a simple solution, but.... If i have a Entity Framework 4 Repository which exposes the following interface: void InsertOrUpdate(Foo foo); And my EDM is done with custom POCO's (no code generation), how do i perform UPDATE's to POCO's? I can INSERT a new object by doing this: var newFoo = new Foo { ... }; rep...

Add SQL Server extended properties to EF 4.0 model

Hi Is there a way to make EF model automatically fetch SQL Server extended property into model? I've read about POCO, but I'm a little confused since it states that you should turn automatic code generation off. If you do that, does your model still update automatically when you add new objects? and how should I update my model so it get...

Examples for Entity Framework 4: Mapping POCOs to EAV database?

Our customer advertises products but the product's attributes are vastly different from one another. There are almost as many product "classes" as there are products. Originally, we created an EAV database where we added and removed attributes for each "class" of product. The whole thing works very well, but the complexity is mind num...

Dynamic EF POCO classes

I'm wondering if using EF POCO classes (as here), will help me solve my problem. However I don't know enough about it. The problem being that i have a user "table", with name and email, in my current datamodel (which can't be changed at design time), and at runtime, make available on the "User" object a field called "company" which map...