none
Configuring Relationships with Fluent API (Code First) in Vb.Net RRS feed

  • Question

  • Dear Sirs

        i am facing one problem while configure composite foreign with code first api

      Getting following error

    The properties expression 'p => new VB$AnonymousType_0`2(Code = p.ObjectCode, ObjectID = p.ObjectID)' is not valid. The expression should represent a property: C#: 't => t.MyProperty'  VB.Net: 'Function(t) t.MyProperty'. When specifying multiple properties use an anonymous type: C#: 't => new { t.MyProperty1, t.MyProperty2 }'  VB.Net: 'Function(t) New From { t.MyProperty1, t.MyProperty2 }'.

     

    this is syntax i am using

    HasRequired(Function(p) p.mstARAPAccount). _
                WithMany(Function(c) c.mstAddressDetails). _
                HasForeignKey(Function(p) New With {.Code = p.ObjectCode, .ObjectID = p.ObjectID})

     

     

    thanks

    Regards

    jignesh

    Friday, January 20, 2012 8:18 AM

Answers

  •  with the following syntax Error get Slove

    HasRequired(Function(p) p.mstARAPAccount). _
                WithMany(Function(c) c.mstAddressDetails). _
                HasForeignKey(Function(p) New With { p.ObjectCode, p.ObjectID})

     

     

    Thanks

     

    Jignesh

    • Marked as answer by Jigjosh Friday, January 20, 2012 1:56 PM
    Friday, January 20, 2012 1:56 PM

All replies

  •  with the following syntax Error get Slove

    HasRequired(Function(p) p.mstARAPAccount). _
                WithMany(Function(c) c.mstAddressDetails). _
                HasForeignKey(Function(p) New With { p.ObjectCode, p.ObjectID})

     

     

    Thanks

     

    Jignesh

    • Marked as answer by Jigjosh Friday, January 20, 2012 1:56 PM
    Friday, January 20, 2012 1:56 PM
  • Hi jigjosh,

    Welcome to MSDN Forum.

    I'm glad to hear that you have solved the issue, if you have any problems, please feel free to post in the forum.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us
    Monday, January 23, 2012 4:01 AM
    Moderator