FieldAttribute And DefaultType

Feb 4, 2013 at 2:05 PM
Hi,
How the Default property is used in FIled Attribute?
I tryed this but it doesn't work.
[Field(Default = new SqlDateTimeDefault())]
public DateTime Date{ get; set; }
thank you in advance.
Coordinator
Feb 4, 2013 at 4:24 PM
Make sure you get the latest change set, then take a look at the (new as of a couple minutes ago) documentation on Defaults
Feb 5, 2013 at 1:02 PM
I tried but it but it doesn't work
[Field(DefaultType = DefaultType.CurrentDateTime)]
public DateTime CreateDate { get; set; }
or
[Field(DefaultValue="getdate()")]
public DateTime CreateDate { get; set; }
I have this error
'Field' does not contain a definition for 'DefaultValue' (or 'DefaultType')

in Field Class there is no properties with this names
Feb 5, 2013 at 1:43 PM
I added this property in the Field class
public DefaultType DefaultType
        {
            set
            {
                switch (value)
                {
                    case OpenNETCF.ORM.DefaultType.CurrentDateTime:
                        Default = new SqlDateTimeDefault();
                        break;
                    default:
                        break;

                }
            }
            get { return Default != null ? Default.DefaultType : DefaultType.String; }
        }
Coordinator
Feb 5, 2013 at 1:53 PM
Did you get the latest change set (101517)? Not the latest releases, but from the Source Code link?