Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Max 80 posts 437 karma points
    Mar 29, 2017 @ 14:03
    Max
    0

    Umbraco Models umbracoUser foreign key on custom table

    I'm trying to save the current user logged in to a custom table created in the database; ( I have the ID using authResource)

    I have the schema created and want to add a foreign key constraint on field in my model.

    I've created the constraint in my database, now I want to define it explicitly in my model.cs

    (End goal is that I want it (explicitly) exposed to my controller.)

        [Column("modified_by"), ForeignKey(typeof(xxxx), Name = "FK_")]
            [IndexAttribute(IndexTypes.NonClustered, Name = "IX_")]
    public int modified_by { get; set; } // int
    

    How do I (can I) declare the umbracoUser table for the typeof() ?

  • Max 80 posts 437 karma points
    Mar 29, 2017 @ 15:22
    Max
    0

    I think my new decoration will look like this:

    [Column("modified_by"), ForeignKey(typeof(Umbraco.Core.Models.Membership.User), Name = "FK_nftaFeatures_umbracoUser_modified")]
            public int modified_by { get; set; } // int
    
    [Column("created_by"), ForeignKey(typeof(Umbraco.Core.Models.Membership.User), Name = "FK_nftaFeatures_umbracoUser_modified")]
            public int created_by { get; set; } // int
    
Please Sign in or register to post replies

Write your reply to:

Draft