Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contains predicate is not working for LookupMulti fields #2

Open
Shm-Alex opened this issue Apr 4, 2017 · 1 comment
Open

Contains predicate is not working for LookupMulti fields #2

Shm-Alex opened this issue Apr 4, 2017 · 1 comment

Comments

@Shm-Alex
Copy link

Shm-Alex commented Apr 4, 2017

Entity class:
`

   /// <summary>
    ///  Содержание мероприятий 
    ///  
    ///  List27List
    /// </summary>
    [SharepointList("Содержание мероприятий")]
    public partial class EventContent : ISharepointItem
    {

        [SharepointField("ID")]
        public int Id { get; set; } //ID:Counter , 

        /// <summary>
        ///Title:Text , 
        /// </summary>
        [SharepointField("Title")]
        public String Title { get; set; }

     
        /// <summary>
        ///lookup Id(s) for MontBlocks:
        ///LookupMulti 
        ///Блоки с контентом данного мероприятия  
        /// </summary>
        [SharepointField("MontBlocks", MapData.LookupId)]
        public List<int> MontBlocksId { get; set; }

      
        /// <summary>
        ///MontBlocks:LookupMulti , Блоки с контентом данного мероприятия
        /// </summary>
        [SharepointField("MontBlocks", MapData.LookupValue)]
        public List<String> MontBlocks { get; set; }

    }//Содержание мероприятий

`

Mapping is ok:

    [TestMethod]
    public void TestMethod4()
    {
        List<EventContent> eventContents = _sharepointClient.GetAll<EventContent>();
        }

But where query fails
Test:

  [TestMethod]
        public void TestMethod3()
        {
            var ecc= _sharepointClient.Query<EventContent>(ec => ec.MontBlocksId.Contains(1)).FirstOrDefault();
          
        }

with:

{CamlexNET.NonSupportedOperandTypeException: Operand type 'System.Collections.Generic.List1[System.Int32]' is not supported at CamlexNET.Impl.Factories.OperandBuilder.CreateValueOperand(Type type, Object value, Boolean includeTimeValue, Boolean parseExactDateTime, Boolean isComparisionOperation, Boolean isIntegerForUserId) at CamlexNET.Impl.Factories.OperandBuilder.createValueOperand(Type type, Object value, Expression expr) at CamlexNET.Impl.Factories.OperandBuilder.createValueOperandFromConstantExpression(ConstantExpression expr, Type explicitOperandType, Expression sourceExpr) at CamlexNET.Impl.Factories.OperandBuilder.CreateValueOperandForNativeSyntax(Expression expr, Type explicitOperandType, Expression sourceExpr) at CamlexNET.Impl.Factories.OperandBuilder.CreateValueOperandForNativeSyntax(Expression expr, Type explicitOperandType) at CamlexNET.Impl.UnaryExpressionBaseAnalyzer.getValueOperand(LambdaExpression expr) at CamlexNET.Impl.Operations.Contains.ContainsAnalyzer.GetOperation(LambdaExpression expr) at CamlexNET.Impl.GenericTranslator.TranslateWhere(LambdaExpression expr) at CamlexNET.Impl.Query.Where(Expression1 expr)
at Shmapper.SharepointClient.Query[T](Expression`1 filter) in 49}

`

@Shm-Alex
Copy link
Author

Shm-Alex commented Apr 5, 2017

This code working:
`
string camelQuery =Camlex.Query().Where(x => (x["MontBlocks"] == (DataTypes.LookupMultiId) id.ToString())).ToString();
EventContent eventContent = spEventContentRepository.Query(camelQuery).FirstOrDefault();

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant