Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

EntityFramework does not work with ForeignKey

1031487Aug 7 2013 — edited Aug 19 2013

Hi,

I´m writing a Entity Framwork application using C#. Everything runs fine until I add a foreign key to my model.

Here´s a single example of a table that I´m mapping:

   [Table("DCDC", Schema = "MZMESDB")]

    public class EfDcDc

    {

        /// <summary>

        /// Element ID

        /// </summary>

        [Column("ID")]

        public int Id { get; set; }

        /// <summary>

        /// Name of DC

        /// </summary>

        [Column("NAME")]

        public string Name { get; set; }

        /// <summary>

        /// DC Description

        /// </summary>

        [Column("DESCRIPTION")]

        public string Description { get; set; }

        public virtual EfSystemDataModule Module { get; set; } <------------ This is the origin of my problem

        /// <summary>

        /// Name of module

        /// </summary>

        [Column("ENABLED")]

        public string Enabled { get; set; }

    }

If I ommit the public virtual EfSystemDataModule Module line, everything works fine, I can connect to database and make transactions. If I add that line (that´s actually my Foreign Key), EF adds a "Module_Id" (exactly like that with mixed case) reference on the EF SQL Script and every transaction with this object on dbcontext returns an error (ORA-00904: "Extent1"."Module_Id": invalid identifier)..

I could find no reference of where this Module_Id is coming from and I need help, as my development is stuck on that.

Thanks in advance for any hint or help.

Rds

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 16 2013
Added on Aug 7 2013
2 comments
1,394 views