So, this is actually this question is my current keystone. I'm working on refactoring of my personal project, trying increase performance, optimize memory usage, make code easy and clear. I have a different application layers (actually, DAL, BLL, ServiceAgents which is WCF services). I'm using Entities/Models/DTOs to pass data between those layers, which is stateless (don't have any logic at all). Currently they're objects like this:
public class Person
{
public ComplexId Id { get; set; }
public string Name { get; set; }
// ...
}
I used to use such approach, it's like a "best practice", is it? Is this best way to store transferred data? What if I change it for struct like this:
public struct Person
{
public ComplexIdentifier ComplexId;
public string Name;
}
public struct ComplexIdentifier
{
public int LocalId;
public int GlobalId;
}
Is this would be better way from performance/memory usage perspective? Or maybe there is some kind of traps acting that way?