Custom database table and referencing member table
I want to create a custom datatable and reference member id as a ForeignKey - But when I do like below I get an Null reference on ForeignKey-attribute (Umbraco.Core.Models.Member) .
I've "googled" and searched this forum but can't find any relevant answer.
Which type must I use in the attribute?
[TableName(DatabaseTables.Order)]
[PrimaryKey(nameof(OrderId), autoIncrement = true)]
[ExplicitColumns]
public class OrderTable
{
[Column(nameof(OrderId))]
[PrimaryKeyColumn(AutoIncrement = true, Clustered = true, IdentitySeed = 1)]
public int OrderId { get; set; }
[Column(nameof(MemberId))]
[ForeignKey(typeof(Member), Column = nameof(Member.Id))]
public int MemberId { get; set; }
[Column(nameof(CreatedDate))]
public DateTime CreatedDate { get; set; }
}
Custom database table and referencing member table
I want to create a custom datatable and reference member id as a ForeignKey - But when I do like below I get an Null reference on ForeignKey-attribute (Umbraco.Core.Models.Member) .
I've "googled" and searched this forum but can't find any relevant answer.
Which type must I use in the attribute?
Hi Carl,
not sure that it is possible at all to reference Umbraco internals like content or members like this.
Think the best way would be to just save the id and then fetch the member using the umbraco services.
At least this is how I done it when I needed references to something like member.
Regards David
Hi David,
Ah that's too bad you have do to it that way. But I do understand it too.
Thanks.
is working on a reply...