Hierarchical foreign key - causes CS0542error

Hello.

CREATE TABLE [dbo].[Diagnose] (
[DiagnoseId] INT IDENTITY (1, 1) NOT NULL,
[DiagnoseParentId] INT NULL,
CONSTRAINT [PK_Diagnose] PRIMARY KEY CLUSTERED ([DiagnoseId] ASC),
CONSTRAINT [FK_Diagnose_DiagnoseParent] FOREIGN KEY ([DiagnoseParentId]) REFERENCES [dbo].[Diagnose] ([DiagnoseId]),

will get

[Table(“Diagnose”, Schema = “dbo”)]
public partial class Diagnose
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int DiagnoseId
{
get;
set;
}
[InverseProperty(“Diagnoses”)]
public ICollection Diagnoses1 { get; set; }
public int? DiagnoseParentId
{
get;
set;
}

[ForeignKey("DiagnoseParentId")]
public Diagnose Diagnose { get; set; }      <--- **this is where the problem lies, should be public Diagnose DiagnoseParent**

which throws a CS0542 error - “member names cannot be the same as their enclosing type”.

When I change this manually in the code file, radzen allways regenerates this code again.

How to solve this problem? Thanks.

Kind regards

Marc

Hi Marc,

The problem was fixed immediately and the fix will be part of our next release (before the end of the week or early next week). Please send us email at info@radzen.com and we will provide you private build before the release.

Best Regards,
Vladimir