public virtual string GetTrackValueComparisonForField(PocoField field) { string typeLower = field.Type.ToLowerInvariant(); if (typeLower.Equals("string")) { return String.Format("!value.Equals(base.{0});", field.Name); } return String.Format("value != base.{0};", field.Name); }
public virtual string GetPopulateForField(PocoField field) { string def = String.Format("default({0})", field.Type); string typeLower = field.Type.ToLowerInvariant(); if (typeLower.Equals("string")) { def = "String.Empty"; } else if (field.IsEnum) { return String.Format("this.{0} = ({1})Enum.Parse(typeof({1}), dr.GetOrDefault<string>(\"{2}\", \"--\"), true);", field.Name, field.Type, field.ColumnName); } return String.Format("this.{0} = dr.GetOrDefault<{1}>(\"{2}\", {3});", field.Name, field.Type, field.ColumnName, def); }