Exemplo n.º 1
0
        internal ColumnPredicate CreatePredicate <TDataRecord>(TDataRecord record) where TDataRecord : DataRecord <TDataRecord>, new()
        {
            ColumnPredicate predicate = PrimaryKey.CreatePredicate(record);

            if (!Equals(predicate, null))
            {
                return(predicate);
            }

            foreach (var property in record.GetUpdatedProperties())
            {
                object value = property.InvokeGetter(record);
                if (value == null)
                {
                    continue; // TODO: Maybe handle setting null on DataRecords and creating predicates that look for the null.
                }
                if (Equals(predicate, null))
                {
                    predicate = (Columns.FindColumn(property.Name) == value);
                }
                else
                {
                    predicate = (predicate & (Columns.FindColumn(property.Name) == value));
                }
            }

            return(predicate);
        }