I'm using Entity Framework with a code-first approach to generate the database. I have introduced row-Level security in SQL Server.
I want to create 3 tables where all the common properties go to ItemVersion
and document related properties to DocumentVersion
and form related things to FormVersion
so and so. I'm supposed to introduce row level security column TenantId
in all 3 tables.
interface ITenantSecurityPolicy
{
int TenantId { get; set; }
}
public class ItemVersion : ITenantSecurityPolicy
{
public int Id { get; set; }
public int CreatedPersonId { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public int TenantId { get; set; }
}
[Table("DocumentVersions")]
public class DocumentVersion : ItemVersion
{
[StringLength(100)]
public string DocumentVersionNumber { get; set; }
public int FileId { get; set; }
}
[Table("FormVersions")]
public class FormVersion : ItemVersion
{
public string DesignerContentId { get; set; }
}
When I generate the database, it does not create the TenantId
in child classes - the column TenantId
is created only in the ItemVersion
table.
How do I handle this situation? Are there any workaround or suggestions?