IsAssigned() public method

public IsAssigned ( Field field ) : bool
field Field
return bool
コード例 #1
0
ファイル: Field.cs プロジェクト: ganeshan/Serenity
        protected void CheckUnassignedRead(Row row)
        {
            if (row == null)
            {
                throw new ArgumentNullException("row");
            }

            if (!row.tracking)
            {
                return;
            }

            if (!row.trackWithChecks)
            {
                return;
            }

            if (row.IsAssigned(this))
            {
                return;
            }

            if (!this.GetIsNull(row))
            {
                return;
            }

            throw new InvalidOperationException(String.Format(
                                                    "{0} field on {1} is read before assigned a value!", this.Name, row.GetType().Name));
        }
コード例 #2
0
ファイル: Field.cs プロジェクト: zitechinc/Serenity
        protected void CheckUnassignedRead(Row row)
        {
            if (row == null)
            {
                throw new ArgumentNullException("row");
            }

            if (!row.tracking)
            {
                return;
            }

            if (!row.trackWithChecks)
            {
                return;
            }

            if (row.IsAssigned(this))
            {
                return;
            }

            if (!this.GetIsNull(row))
            {
                return;
            }

            throw new InvalidOperationException(String.Format(
                                                    "{0} field on {1} is read before assigned a value! Make sure this field is selected in your SqlQuery. Extensions like connection.List only loads table fields by default, view / expression fields are not loaded unless explicitly selected.",
                                                    this.Name, row.GetType().Name));
        }
コード例 #3
0
 /// <summary>
 ///   Adds all field values in a row to where clause with equality operator and auto named parameters
 ///   (field name prefixed with '@').</summary>
 /// <param field="row">
 ///   The row with modified field values to be added to the where clause (key row).  Must be in TrackAssignments mode,
 ///   or an exception is raised.</param>
 /// <returns>
 ///   Object itself.</returns>
 public static T WhereEqual <T>(this T self, Row row) where T : IFilterableQuery
 {
     if (row == null)
     {
         throw new ArgumentNullException("row");
     }
     if (!row.TrackAssignments)
     {
         throw new ArgumentException("row must be in TrackAssignments mode to determine modified fields.");
     }
     foreach (var field in row.GetFields())
     {
         if (row.IsAssigned(field))
         {
             self.Where(new Criteria(field) == self.AddParam(field.AsObject(row)));
         }
     }
     return(self);
 }
コード例 #4
0
        /// <summary>
        ///   Sets all field values in a row with auto named parameters (field name prefixed with '@').</summary>
        /// <param field="row">
        ///   The row with modified field values. Must be in TrackAssignments mode, or an exception is raised.</param>
        /// <returns>
        ///   Object itself.</returns>
        public static T Set <T>(this T self, Row row, IField exclude = null) where T : ISetFieldByStatement
        {
            if (row == null)
            {
                throw new ArgumentNullException("row");
            }

            if (!row.TrackAssignments)
            {
                throw new ArgumentException("row must be in TrackAssignments mode to determine modified fields.");
            }

            foreach (var field in row.GetFields())
            {
                if (!ReferenceEquals(field, exclude) && row.IsAssigned(field))
                {
                    self.Set((IField)field, field.AsObject(row));
                }
            }

            return(self);
        }
コード例 #5
0
ファイル: Field.cs プロジェクト: fzhenmei/Serenity
        protected void CheckUnassignedRead(Row row)
        {
            if (row == null)
                throw new ArgumentNullException("row");

            if (!row.tracking)
                return;

            if (!row.trackWithChecks)
                return;

            if (row.IsAssigned(this))
                return;

            if (!this.GetIsNull(row))
                return;

            throw new InvalidOperationException(String.Format(
                "{0} field on {1} is read before assigned a value!", this.Name, row.GetType().Name));
        }