© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
16 replies
:

✅ Foreign key not working

Hi, I tried making a foreign key in my table, to another table which I made but it does not work as intended.

        [ForeignKey("FileName")]
        public Guid FileName { get; set; }
        public TextFileModel TextFileModel { get; set; }
        [ForeignKey("FileName")]
        public Guid FileName { get; set; }
        public TextFileModel TextFileModel { get; set; }

I tried making a filename field which is a fk to a textfilemodel, but it has instead made two separate fields:
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Entity Framework Foreign Key
C#CC# / help
2y ago
Foreign Key | Entity Framework
C#CC# / help
2y ago
❔ ✅ Key not working
C#CC# / help
3y ago
Entity Framework Foreign Key restraint
C#CC# / help
16mo ago