当前位置: 首页>>代码示例>>C#>>正文


C# Criteria.IsComposite方法代码示例

本文整理汇总了C#中Criteria.IsComposite方法的典型用法代码示例。如果您正苦于以下问题:C# Criteria.IsComposite方法的具体用法?C# Criteria.IsComposite怎么用?C# Criteria.IsComposite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Criteria的用法示例。


在下文中一共展示了Criteria.IsComposite方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MergeCriteriaSource

 private void MergeCriteriaSource(Criteria criteria)
 {
     if (criteria == null) return;
     if (criteria.IsComposite())
     {
         MergeCriteriaSource(criteria.LeftCriteria);
         MergeCriteriaSource(criteria.RightCriteria);
     }
     else
     {
         this.Source.MergeWith(criteria.Field.Source);
     }
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:13,代码来源:SelectQuery.cs

示例2: TestIsComposite_TrueForNotCriteria

        public void TestIsComposite_TrueForNotCriteria()
        {
            //---------------Set up test pack-------------------
            Criteria dateTimeCriteria = new Criteria("DateTime", Criteria.ComparisonOp.GreaterThan, DateTime.Now);

            //---------------Execute Test ----------------------
            Criteria notCriteria = new Criteria(Criteria.LogicalOp.Not, dateTimeCriteria);
            //---------------Test Result -----------------------
            Assert.IsTrue(notCriteria.IsComposite());
            //---------------Tear Down -------------------------
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:11,代码来源:TestCriteria.cs

示例3: TestIsComposite_True

 public void TestIsComposite_True()
 {
     //---------------Set up test pack-------------------
     Criteria dobCriteria = new Criteria("DateOfBirth", Criteria.ComparisonOp.Equals, "sfd");
     Criteria nameCriteria = new Criteria("Surname", Criteria.ComparisonOp.Equals, "dfsd");
     Criteria twoPropCriteria = new Criteria(dobCriteria, Criteria.LogicalOp.And, nameCriteria);
     //---------------Execute Test ----------------------
     bool isComposite = twoPropCriteria.IsComposite();
     //---------------Test Result -----------------------
     Assert.IsTrue(isComposite, "A criteria made up of two others should be composite");
     //---------------Tear Down -------------------------
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:12,代码来源:TestCriteria.cs

示例4: TestIsComposite_False

 public void TestIsComposite_False()
 {
     //---------------Set up test pack-------------------
     Criteria criteria = new Criteria("bob", Criteria.ComparisonOp.LessThan, "hello");
     //---------------Execute Test ----------------------
     bool isComposite = criteria.IsComposite();
     //---------------Test Result -----------------------
     Assert.IsFalse(isComposite, "A single criteria should not be composite");
     //---------------Tear Down -------------------------
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:10,代码来源:TestCriteria.cs

示例5: TestConstruct_WithSpecifiedSource

        public void TestConstruct_WithSpecifiedSource()
        {
            //---------------Set up test pack-------------------
            const string propvalue = "PropValue";

            //---------------Execute Test ----------------------
            Criteria criteria = new Criteria("SourceName.PropName", Criteria.ComparisonOp.Equals, propvalue);

            //---------------Test Result -----------------------
            Assert.IsFalse(criteria.IsComposite());
            Assert.AreEqual(Criteria.ComparisonOp.Equals, criteria.ComparisonOperator);
            Assert.AreEqual(propvalue, criteria.FieldValue);
            Assert.AreEqual("PropName", criteria.Field.PropertyName);
            Assert.AreEqual("PropName", criteria.Field.FieldName);
            Assert.AreEqual("SourceName", criteria.Field.Source.ToString());
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:16,代码来源:TestCriteria.cs

示例6: PrepareDiscriminatorCriteria

 ///<summary>
 ///</summary>
 ///<param name="classDef"></param>
 ///<param name="criteria"></param>
 public static void PrepareDiscriminatorCriteria(IClassDef classDef, Criteria criteria)
 {
     if (criteria == null) return;
     if (criteria.IsComposite())
     {
         PrepareDiscriminatorCriteria(classDef, criteria.LeftCriteria);
         PrepareDiscriminatorCriteria(classDef, criteria.RightCriteria);
     }
     else
     {
         criteria.Field.FieldName = criteria.Field.PropertyName;
         criteria.Field.Source = new Source(((ClassDef)classDef).GetBaseClassOfSingleTableHierarchy().ClassNameExcludingTypeParameter,
                                            classDef.GetTableName());
     }
 }
开发者ID:Celtic691,项目名称:habanero,代码行数:19,代码来源:QueryBuilder.cs

示例7: PrepareCriteria

 ///<summary>
 /// Based on the class definition the given <see cref="Criteria"/> object is set up with the correct entity 
 /// names and field names, in preparation for using it as part of a <see cref="SelectQuery"/> that has been built using
 /// the <see cref="QueryBuilder"/> and the same <see cref="ClassDef"/>
 ///</summary>
 ///<param name="classDef">The class definition to use for preparing the <see cref="Criteria"/>.</param>
 ///<param name="criteria">The <see cref="Criteria"/> to prepare for use with a <see cref="SelectQuery"/>.</param>
 public static void PrepareCriteria(IClassDef classDef, Criteria criteria)
 {
     if (classDef == null) throw new ArgumentNullException("classDef");
     if (criteria == null) return;
     if (criteria.IsComposite())
     {
         PrepareCriteria(classDef, criteria.LeftCriteria);
         PrepareCriteria(classDef, criteria.RightCriteria);
     }
     else
     {
         var field = criteria.Field;
         var fieldPropDef = PrepareField(field.Source, classDef, field);
         if (fieldPropDef != null)
         {
             field.FieldName = fieldPropDef.DatabaseFieldName;
             if (null == field.Source) throw new NullReferenceException("the field.Source is null");
             if (null == field.Source.RelatedClassDef) throw new NullReferenceException("the field.Source.RelatedClassDef is null");
             if (null == field.Source.ChildSourceLeaf) throw new NullReferenceException("the field.Source.ChildSourceLeaf is null");
             field.Source.ChildSourceLeaf.EntityName = field.Source.RelatedClassDef.GetTableName(fieldPropDef);
             if (criteria.CanBeParametrised()
                     && (criteria.ComparisonOperator != Criteria.ComparisonOp.In 
                     && criteria.ComparisonOperator != Criteria.ComparisonOp.NotIn))
             {
                 object returnedValue;
                 fieldPropDef.TryParsePropValue(criteria.FieldValue, out returnedValue);
                 criteria.FieldValue = returnedValue;
             }
         }
     }
 }
开发者ID:Celtic691,项目名称:habanero,代码行数:38,代码来源:QueryBuilder.cs


注:本文中的Criteria.IsComposite方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。