Esempio n. 1
0
        public static void SetValueToObject(object srcObj, IStorageObject desObj, string propertyName, Type propertyType)
        {
            bool   nullable = IsNullable(propertyType);
            object obj2     = ToObject(srcObj, propertyType, nullable);

            desObj.SetValue(propertyName, obj2);
        }
Esempio n. 2
0
        public void Insert(IStorageObject obj)
        {
            DbEventArgs         args;
            string              insertSQL = this.SqlFormatter.GetInsertSQL(obj);
            Type                type      = obj.GetType();
            int                 num       = this.DbOperator.ExecuteScalar <int>(insertSQL);
            DynamicPropertyInfo autoIncrementDynamicPropertyInfo = DbObjectTools.GetAutoIncrementDynamicPropertyInfo(DbObjectTools.GetDbObjectInfo(type));

            if ((autoIncrementDynamicPropertyInfo != null) & (num != 0))
            {
                obj.SetValue(autoIncrementDynamicPropertyInfo.PropertyName, num);
            }
            Action item = delegate
            {
                args = new DbEventArgs(this, DbOperationAction.Insert);
                obj.OnWrote(this, args);
            };

            if (this.DbOperator.IsBeginTransaction)
            {
                this.transActions.Add(item);
            }
            else
            {
                item();
            }
        }