internal PocoData(Type type) { Type = type; // Get the mapper for this type //var mapper = Singleton<StandardMapper>.Instance; // Get the table info TableInfo = TableInfo.FromPoco(type); // Work out bound properties Columns = new Dictionary <string, PocoColumn>(StringComparer.OrdinalIgnoreCase); foreach (var pi in type.GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)) { ColumnInfo ci = ColumnInfo.FromProperty(pi);// mapper.GetColumnInfo(pi); if (ci == null) { continue; } var pc = new PocoColumn(); pc.PropertyInfo = pi; pc.PropertyName = pi.Name; pc.ColumnName = ci.ColumnName; pc.ResultColumn = ci.ResultColumn; pc.ForceToUtc = ci.ForceToUtc; pc.ResultSql = ci.ResultSql; // Store it Columns.Add(pc.ColumnName, pc); } }
/// <inheritdoc/> public ColumnInfo GetColumnInfo(PropertyInfo pocoProperty) { bool includeColumn = true; // Check if the class has the ExplictColumnsAttribute bool declareColumns = pocoProperty.DeclaringType != null && pocoProperty.DeclaringType.GetCustomAttributes(typeof(DeclareColumnsAttribute), true).Length > 0; if (declareColumns) { if (pocoProperty.GetCustomAttributes(typeof(IncludeColumnAttribute), true).Length == 0) { includeColumn = false; } } else { if (pocoProperty.GetCustomAttributes(typeof(IgnoreColumnAttribute), true).Length > 0) { includeColumn = false; } } ColumnInfo ci = null; if (includeColumn) { ci = ColumnInfo.FromProperty(pocoProperty); ci.ColumnName = DataUtil.GetColumnName(pocoProperty, ci.ColumnName); ci.ResultColumn = pocoProperty.GetCustomAttributes(typeof(ReadOnlyColumnAttribute), true).Length > 0; } return(ci); }
public ColumnInfo GetColumnInfo(PropertyInfo pocoProperty) { var ci = ColumnInfo.FromProperty(pocoProperty); //Column Name ci.ColumnName = Util.GetAttributeValue <ColumnNameAttribute, string>(pocoProperty, "ColumnName", ci.ColumnName); return(ci); }
public ColumnInfo GetColumnInfo(System.Reflection.PropertyInfo pi) { var ci = ColumnInfo.FromProperty(pi); if (ci == null) { return(null); } if (pi.DeclaringType == typeof(Poco2)) { switch (pi.Name) { case "prop1": // Leave this property as is break; case "prop2": // Rename this column ci.ColumnName = "remapped2"; break; case "prop3": // Mark this as a result column ci.ResultColumn = true; break; case "prop4": // Ignore this property return(null); } } // Do default property mapping return(ci); }
string COLUMN_NAME(string propertyname) { return(ColumnInfo.FromProperty(typeof(Ambulance).GetProperty(propertyname)).ColumnName); }
public ColumnInfo GetColumnInfo(object obj, PropertyInfo property) { return(ColumnInfo.FromProperty(obj, property)); }
public ColumnInfo GetColumnInfo(PropertyInfo pocoProperty) { return(ColumnInfo.FromProperty(pocoProperty)); }