Hack job for my first complicated LINQ query.

Answered Hack job for my first complicated LINQ query.

  • Friday, December 21, 2012 4:16 AM
     
      Has Code

    Hello,

    I am not well versed at LINQ yet so I was wondering if someone could explain why I am getting the results I am getting. I have an ORM wrapping the db and my scalar valued function is a Linq extension that calls the svf. I am getting two of the exact same record. The info is correct but why the duplication?

    So you understand the query:

    ctx_DBORM is the ORM context.

    ORM_DomainModel is the the ORM object with the extension method.

    The parameters are a string and int.

    var query = from ExConst in ctx_DBORM.TableA
    let RepCount = ORM_DomainModel.MySVF(parameters._strVal, parameters._UsrID)
    select new
    {
         Total = RepCount
    };

    As I mentioned I get the correct result it's just duplicated?? There are only two rows in that table right now. Seems like more than a coincidence??

    ?????

    JB


    • Edited by zzpluralza Friday, December 21, 2012 4:22 AM
    •  

All Replies

  • Friday, December 21, 2012 9:27 AM
     
     Answered

    If you have a normal sql and can set up a profiler I think it will tell you.

    In SQL management studio it's under tools > SQL server profiler

    I don't think express got thatone though.

  • Monday, December 24, 2012 7:11 AM
    Moderator
     
     

    Hi Zzpluralza,

    As Thomas has put it, please check the SQL Profiler to check the generated SQL. If you still confused, could you please post the generated SQL here?

    Merry Christmas!


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.