SpecialName + LazyLoad + New() + .Save

Feb 17, 2009 at 3:22 PM
[SpecialName]
[LazyLoad]
public abstract DateTime CreatedOn { get; set; }

When a table Define this

Insert will error.

throw exception
Feb 17, 2009 at 3:45 PM
重现

    public abstract class t_user : LinqObjectModel<t_user>
    {
        [Length(40)]
        public abstract string mc { get; set; }

        [SpecialName]
        [LazyLoad]
        public abstract DateTime CreatedOn { get; set; }

    }

    public abstract class t_test1 : LinqObjectModel<t_test1>
    {
        public abstract string ttt { get; set; }

        [BelongsTo, DbColumn("userId")]
        public abstract t_user user { get; set; }

        [SpecialName]
        [LazyLoad]
        public abstract DateTime CreatedOn { get; set; }
    }

执行:

 DbContext de = DbEntry.Context;

                de.DropAndCreate(typeof(t_user));
                de.DropAndCreate(typeof(t_test1));

                var d = t_user.New();
                d.mc = "张三";
                d.Save();//抛~

Coordinator
Feb 18, 2009 at 6:14 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.