Esempio n. 1
0
        private Func <MyType, bool> Criteria2ToPredicate()
        {
            if (Criteria2 == null)
            {
                return((obj) => true);
            }

            // if you cannot use contains, you can use Any
            return((obj) => Criteria2.Any(critVal => obj.Criteria2 == critVal));
        }
Esempio n. 2
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = Name != null?Name.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (Criteria1 != null ? Criteria1.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Criteria2 != null ? Criteria2.GetHashCode() : 0);
                return(hashCode);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Creates or loads a <see cref="SampleUnitOfWork"/> unit of objects, based on given criteria.
 /// </summary>
 /// <param name="crit">The create/fetch criteria.</param>
 protected void DataPortal_Fetch(Criteria2 crit)
 {
     if (crit.CreateDoc)
     {
         LoadProperty(DocProperty, Doc.NewDoc());
     }
     else
     {
         LoadProperty(DocProperty, Doc.GetDoc(crit.DocID));
     }
     if (crit.CreateFolder)
     {
         LoadProperty(FolderProperty, Folder.NewFolder());
     }
     else
     {
         LoadProperty(FolderProperty, Folder.GetFolder(crit.FolderID));
     }
     LoadProperty(DocListProperty, DocList.GetDocList(crit.DocListFilteredCriteria));
 }