Internal .NET Framework Data Provider error 1025.


  • The data model looks like this: [Right] 1-n [GroupRight] n-1 [Group]
    GroupRight is a mapping table with its own primary key (don't discuss about this, it's not our model we have to live with it!)
    Now I want to get the rights for groups id 1 and 2:
    entities.RightSet.Where(r => r.GroupRight.Any(gr => gr.Group.GroupId == 1 || gr.Group.GroupId == 2));
    And this works, but I have to create the "contains" statement dynamically, so I use a  BuildContainsExpression static method to do it but when the linq query is executed it throws the exception: Internal .NET Framework Data Provider error 1025.
    So I tried to simplify the problem but as soon as I take the "contains" statement out of the query it throws the exception, for example with:
    Func<GroupRight, bool> test = gr => gr.Group.GroupId == 1 || gr.Group.GroupId == 2:
    I can I solve this problem? How can I build a dynamic "contains" statement which works?
    Tuesday, March 16, 2010 11:57 AM


  • Hello,

    The BuildContainsExpression or the BuildOrExpression in this blog should be used in the ObjectContext.EntitySet (ObjectQuery) directly.  The error seems to be caused when we use it in EntityCollection.  Please consider using the following query instead:

       var query = context.GroupSet.Where(BuildContainsExpression<Group, int>(g=> g.GroupId, new int[] { 1, 2 }))
                             .SelectMany(g => g.GroupRight, (g, gr) => gr.Right).Distinct();


    Best Regards,
    Lingzhi Sun

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, March 22, 2010 4:04 PM