I am investigating the use of an ORM to access our DataVault. Until now, PetaPoco looks most promising, but I am not bound to that one.
Most of the object we identify are embedded in a combination of a Hub and a Sat where the Hub contains the BusinessKey and the Sat the additional information. In a poco it would look like this (simplified):
// hub: H_Client
// sat: HS_Client
class Client
{
public string ClientId_BK { get; set; } // BusinessKey in the Hub
public long H_Client_SeqId { get; set; } // PK/Identity in Hub, FK in the Sat
public string? Address { get; set; } // additional attr. in the Sat
public string? Phone { get; set; } // additional attr. in the Sat
/* and a lot more attributes */
}
So, whenever we talk about a Client, it always involves the combination of a Hub with its Sat. Usually an ORM interfaces one table at a time, but that is not very useful with datavaults: you always want to query or insert a Hub with the applicable Sat.
Is it possible to update or insert into multiple tables from one poco?
It's trivial to retrieve the info using a
ResultColumn, but for insert/update, you will need to add your own logic (Insert in both tables with a Transaction, etc).Remember that this kind of small, performant ORMs are meant to be simple.