public void SetValuePropertyInfo(IDataBaseObject obj, IResultSet rs, IColumnInfo prop, ValueProperty destination) { var p = prop; SetDbBindColumn(obj, rs, p, destination.DbBindColumn); destination.Nullable = (p.IsNullable); if (p.NativeType == "timestamp") { destination.ReadOnly = true; destination.Undoable = false; destination.DeclarationMode = PropertyDeclaration.Managed; } if (_currentCslaObject.IsReadOnlyObject() || _currentCslaObject.IsNameValueList()) { destination.DeclarationMode = PropertyDeclaration.Managed; destination.ReadOnly = true; } if (p.IsPrimaryKey) { destination.Undoable = false; if (p.IsIdentity) { destination.PrimaryKey = ValueProperty.UserDefinedKeyBehaviour.DBProvidedPK; destination.ReadOnly = true; destination.PropSetAccessibility = AccessorVisibility.Default; } else { destination.PrimaryKey = ValueProperty.UserDefinedKeyBehaviour.UserProvidedPK; } if (destination.PropertyType == TypeCodeEx.Guid) { destination.DefaultValue = _currentUnit.Params.IDGuidDefaultValue; } else if (p.IsIdentity && _currentCslaObject.IsNotReadOnlyObject() && _currentCslaObject.IsNotNameValueList()) { switch (p.DbType) { case DbType.Int16: destination.DefaultValue = _currentUnit.Params.IDInt16DefaultValue; break; case DbType.Int32: destination.DefaultValue = _currentUnit.Params.IDInt32DefaultValue; break; case DbType.Int64: destination.DefaultValue = _currentUnit.Params.IDInt64DefaultValue; break; } } } if (_currentUnit.Params.CreationDateColumn == p.ColumnName) { destination.ReadOnly = true; destination.Undoable = false; destination.PropSetAccessibility = AccessorVisibility.Default; destination.DataAccess = ValueProperty.DataAccessBehaviour.CreateOnly; if (destination.PropertyType == TypeCodeEx.SmartDate) { destination.DefaultValue = _currentUnit.Params.LogDateAndTime ? "new SmartDate(" + GetNowValue(TypeCodeEx.DateTime) + ")" : "new SmartDate(DateTime.Today)"; } else { destination.DefaultValue = _currentUnit.Params.LogDateAndTime ? GetNowValue(destination.PropertyType) : "DateTime.Today"; } } else if (_currentUnit.Params.CreationUserColumn == p.ColumnName) { destination.ReadOnly = true; destination.Undoable = false; destination.PropSetAccessibility = AccessorVisibility.Default; destination.DataAccess = ValueProperty.DataAccessBehaviour.CreateOnly; destination.DefaultValue = _currentUnit.Params.GetUserMethod; } else if (_currentUnit.Params.ChangedDateColumn == p.ColumnName) { destination.ReadOnly = true; destination.Undoable = false; destination.PropSetAccessibility = AccessorVisibility.Default; if (_currentCslaObject.IsCreationDateColumnPresent()) { destination.DefaultValue = "$" + _currentUnit.Params.CreationDateColumn; } else { if (destination.PropertyType == TypeCodeEx.SmartDate) { destination.DefaultValue = _currentUnit.Params.LogDateAndTime ? "new SmartDate(" + GetNowValue(TypeCodeEx.DateTime) + ")" : "new SmartDate(DateTime.Today)"; } else { destination.DefaultValue = _currentUnit.Params.LogDateAndTime ? GetNowValue(destination.PropertyType) : "DateTime.Today"; } } } else if (_currentUnit.Params.ChangedUserColumn == p.ColumnName) { destination.ReadOnly = true; destination.Undoable = false; destination.PropSetAccessibility = AccessorVisibility.Default; if (_currentCslaObject.IsCreationUserColumnPresent()) { destination.DefaultValue = "$" + _currentUnit.Params.CreationUserColumn; } else { destination.DefaultValue = _currentUnit.Params.GetUserMethod; } } else if (_currentUnit.Params.DatesDefaultStringWithTypeConversion && (destination.PropertyType == TypeCodeEx.SmartDate || destination.PropertyType == TypeCodeEx.DateTime || destination.PropertyType == TypeCodeEx.DateTimeOffset)) { destination.BackingFieldType = destination.PropertyType; destination.PropertyType = TypeCodeEx.String; destination.DeclarationMode = PropertyDeclaration.ManagedWithTypeConversion; } }