I am currently facing a performance issue when creating POCO objects from my database. I am using Entity Framework 4 as an OR-Mapper. At the moment, the entire application is a prototype.
Suppose I want to have some business objects, such as Printer or Scanner. Both classes inherit from BaseClass called Product. Business classes exist.
I am trying to use a more general approach to the database. I do not want to create tables for "Printer" or "Scanner". I want to have 3 tables: one is called Product, and the other is Property and PropertyValue (which stores all the assigned values to a specific Product).
At my business level, I am creating a specific object like this:
public Printer GetPrinter(int IDProduct)
{
Printer item = new Printer();
return item;
}
This is how the EF model looks:

It works great. So far I am doing performance tests to extract multiple sets.
I created a prototype and improved it several times to increase productivity. This is still far from use. I take 919ms to create 300 objects that contain only 3 properties.
The reason for choosing such a database project is the creation of a common database. Adding new properties should only be done in the business model.
Am I just too stupid to create an efficient way to extract xx objects, or is my approach completely wrong? As far as I understand OR-Mapper, they basically do the same thing?
source
share