public static Field GetLocalizationMatch(Field field) { var info = EnsureInfo(); if (!field.IsTableField()) { return(null); } var name = field.Name.Substring(info.rowFieldPrefixLength); name = ((Field)info.localRowInterface.IdField).Name.Substring(0, info.localRowFieldPrefixLength) + name; var match = info.localRowInstance.FindField(name); if (ReferenceEquals(null, match)) { return(null); } if (!match.IsTableField()) { return(null); } if (ReferenceEquals(match, info.localRowInterface.IdField) || ReferenceEquals(match, info.localRowInterface.CultureIdField)) { return(null); } if (info.localRowInstance is IIsActiveRow && ReferenceEquals(match, ((IIsActiveRow)info.localRowInstance).IsActiveField)) { return(null); } if (info.localRowInstance is IIsDeletedRow && ReferenceEquals(match, ((IIsDeletedRow)info.localRowInstance).IsDeletedField)) { return(null); } var logging = info.localRowInstance as ILoggingRow; if (logging != null && ( ReferenceEquals(match, logging.InsertUserIdField) || ReferenceEquals(match, logging.UpdateUserIdField) || ReferenceEquals(match, logging.UpdateDateField) || ReferenceEquals(match, logging.InsertDateField))) { return(null); } return(match); }
/// <summary> /// Gets a dictionary of table fields (e.g. not a foreign or calculated field) in a row.</summary> /// <param name="row"> /// The row to return dictionary of table fields</param> /// <returns> /// A dictionary of table fields in which field objects are keys.</returns> public static IEnumerable <Field> EnumerateTableFields(this Row row) { var fields = row.GetFields(); for (int i = 0; i < fields.Count; i++) { Field field = fields[i]; if (field.IsTableField()) { yield return(field); } } }