示例#1
0
        /// <summary>
        /// 添加记录
        /// </summary>
        #region bool DAO_Add(T entity)
        public static bool DAO_Add(T entity)
        {
            try
            {
                ActiveRecordBase <T> .Save(entity);

                return(true);
            }
            catch (Exception ex)
            {
                //LogHelper.WriteLog(LogTag + ".DAO_Add(T entity) ", ex);
                return(false);
            }
        }
        internal static void SaveInstance(object instance,
                                          Controller controller, ArrayList errors, IDictionary prop2Validation)
        {
            if (instance is ActiveRecordValidationBase)
            {
                ActiveRecordValidationBase instanceBase = instance as ActiveRecordValidationBase;

                if (!instanceBase.IsValid())
                {
                    errors.AddRange(instanceBase.ValidationErrorMessages);
                    prop2Validation = instanceBase.PropertiesValidationErrorMessage;
                }
                else
                {
                    instanceBase.Save();
                }
            }
            else
            {
                ActiveRecordBase instanceBase = instance as ActiveRecordBase;

                instanceBase.Save();
            }
        }
示例#3
0
 public static void SaveLater(this ActiveRecordBase record)
 {
     RealmServer.IOQueue.AddMessage(() => record.Save());                                // leave it as a Lambda Expr to get a complete stacktrace
 }
示例#4
0
 public static void SaveLater(this ActiveRecordBase record)
 {
     ServerApp <WCell.RealmServer.RealmServer> .IOQueue.AddMessage((Action)(() => record.Save()));
 }