I have an entity
public class classA
{
public virtual classAId id {get;set;}
}
It has a compositeId
public class classAId
{
public virtual int a {get;set;}
public virtual int b {get;set;}
}
classB references classA
public class classB
{
public virtual classA ref {get;set;}
}
The database table for classB has only one column for the reference ref, the other column (for the compositeId of the reference which is classA) is retrieved from the program and is not persisted in the database, nor can I persist it in the database (normally it is 0 for instance).
So how can I implement the reference in classB so that it retrieves and saves an instance of classA correctly without persisting the additional column in the database?
Edit: or can I somehow filter classA on the column in question first, so that classA then has only a 1 column key?